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.3.0
    1.2.0
  • github.​com
  • github.​com
  • 5 years ago
  • 2 hours ago
  • 11 years ago

Installs

  • Total 41K
  • Win 21K
  • Mac 11K
  • Linux 9K
Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7
Windows 0 3 0 4 1 1 2 0 2 0 1 2 2 3 1 0 0 1 1 5 0 2 2 0 0 1 2 1 1 0 0 2 0 2 2 3 3 1 2 1 4 3 1 1 2 1
Mac 0 0 2 0 2 0 0 0 0 0 0 0 0 1 1 2 0 2 0 0 0 2 0 0 0 1 1 2 1 0 0 4 1 1 1 0 0 2 0 1 1 1 1 1 2 0
Linux 0 0 4 0 0 2 1 2 2 0 0 2 2 0 0 0 0 1 1 0 0 1 0 0 0 0 2 1 1 1 0 1 0 1 0 0 0 2 0 1 0 0 1 0 2 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).

Classpath

Setting Description
classpath Elements for the classpath. Accepts a list.

To configure classpaths with a lot of elements, the classpath setting may be used alternatively or in addition to args.

If *-sourcepath is unspecified* (in args), -classpath can also be used to configure source paths.

The above example would look like this:

"args": ["-encoding", "UTF8"],
"classpath": [
    "${folder}/lib/some_lib.jar",
    "${folder}/lib/some_other_lib.jar",
    "${folder}/src/", // sourcepath elements go here, too
]

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”: “.” } ], “settings”: { “SublimeLinter.linters.javac.lint”: “all”, “SublimeLinter.linters.javac.args”: [“-encoding”, “UTF8”], “SublimeLinter.linters.javac.classpath”: [ “${folder}/lib/some_lib.jar”, “${folder}/lib/some_other_lib.jar”, “${folder}/src/”, ] } }