ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter-javac

by SublimeLinter ST3

SublimeLinter 3 plugin for Java, using javac -Xlint.

Details

  • 1.1.11
  • github.​com
  • github.​com
  • 7 months ago
  • 59 minutes ago
  • 5 years ago

Installs

  • Total 29K
  • Win 14K
  • OS X 8K
  • Linux 6K
Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1
Windows 3 7 5 4 11 13 8 5 9 6 12 4 8 4 10 4 8 8 6 8 14 9 9 3 3 8 15 7 10 6 8 2 13 12 11 7 4 11 3 8 6 8 11 6 3 9
OS X 0 7 0 6 3 2 4 1 2 1 2 1 3 4 3 2 1 4 4 6 3 4 2 2 0 1 3 4 2 2 5 1 5 8 7 3 4 1 3 3 2 6 4 3 2 6
Linux 0 8 2 4 1 4 2 3 4 2 1 3 8 1 1 6 1 3 4 3 2 5 2 3 3 4 10 3 7 1 2 2 1 12 4 6 5 2 4 2 6 4 3 0 0 1

Readme

Source
raw.​githubusercontent.​com

SublimeLinter-javac

Build Status

This linter plugin for SublimeLinter provides an interface to javac. It will be used with files that have the “Java” syntax.

Please note that because javac requires a complete directory context in order to work, this linter plugin currently will only lint a file when it has been saved.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before using this plugin, ensure that javac (JDK 1.7+) is installed on your system. javac is part of the java developer SDK, which can be downloaded here.

Please make sure that the path to javac is available to SublimeLinter. The docs cover troubleshooting PATH configuration.

Settings

Additional SublimeLinter-javac settings:

Setting Description
lint A comma-delimited list of rules to apply.

Valid rule names are: all, cast, classfile, deprecation, dep-ann, divzero, empty, fallthrough, finally, options, overrides, path, processing, rawtypes, serial, static, try, unchecked, varargs, -cast, -classfile, -deprecation, -dep-ann, -divzero, -empty, -fallthrough, -finally, -options, -overrides, -path, -processing, -rawtypes, -serial, -static, -try, -unchecked, -varargs, none.

For example, to ignore deprecation warnings for all files in a project, you would add this to the linter settings:

"javac": {
    "lint": "all,-deprecation"
}

Passing options to javac

In order to configure javac options like the class path, source path, or file encoding, the args setting can be used.

Setting Description
args An array of strings, alternating between an option and the corresponding value.

A full list of available options is given here.

For example, the following configuration defines the source file encoding, includes the two libraries lib/some_lib.jar and lib/some_other_lib.jar in the classpath, and defines src/ as the project's source path:

"args": [
    "-encoding", "UTF8",
    "-cp", "${folder}/lib/some_lib.jar:${folder}/lib/some_other_lib.jar",
    "-sourcepath", "${folder}/src/"
]

Note that options and their values must be separate elements in the array (i.e. "args": ["-sourcepath", "/path/to/src"] does work, while "args": ["-sourcepath /path/to/src"] does not work).

Project-specific options

Settings like the class path often only apply to one specific project. The general SublimeLinter documentation also explains how to specify project-specific settings in the sublime-project file.

For the example above, such a project file could look like this: “ { "folders”: [ { “path”: “.” } ], “SublimeLinter”: { “linters”: { “javac”: { “lint”: “all”, “args”: [ “-encoding”, “UTF8”, “-cp”, “${folder}/lib/some_lib.jar:${folder}/lib/some_other_lib.jar”, “-sourcepath”, “${folder}/src/” ] } } } }