javalang-compiler

Library of compiler components to processs Java code.

License

License

GroupId

GroupId

org.walkmod
ArtifactId

ArtifactId

javalang-compiler
Last Version

Last Version

2.3.10
Release Date

Release Date

Type

Type

jar
Description

Description

javalang-compiler
Library of compiler components to processs Java code.
Project URL

Project URL

https://github.com/rpau/javalang-compiler
Source Code Management

Source Code Management

https://github.com/rpau/javalang-compiler.git

Download javalang-compiler

How to add to project

<!-- https://jarcasting.com/artifacts/org.walkmod/javalang-compiler/ -->
<dependency>
    <groupId>org.walkmod</groupId>
    <artifactId>javalang-compiler</artifactId>
    <version>2.3.10</version>
</dependency>
// https://jarcasting.com/artifacts/org.walkmod/javalang-compiler/
implementation 'org.walkmod:javalang-compiler:2.3.10'
// https://jarcasting.com/artifacts/org.walkmod/javalang-compiler/
implementation ("org.walkmod:javalang-compiler:2.3.10")
'org.walkmod:javalang-compiler:jar:2.3.10'
<dependency org="org.walkmod" name="javalang-compiler" rev="2.3.10">
  <artifact name="javalang-compiler" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.walkmod', module='javalang-compiler', version='2.3.10')
)
libraryDependencies += "org.walkmod" % "javalang-compiler" % "2.3.10"
[org.walkmod/javalang-compiler "2.3.10"]

Dependencies

compile (2)

Group / Artifact Type Version
org.walkmod : javalang jar [4.1.0, 5.0.0)
log4j : log4j jar 1.2.16

provided (1)

Group / Artifact Type Version
junit : junit jar 4.12

test (1)

Group / Artifact Type Version
org.assertj : assertj-core jar 2.6.0

Project Modules

There are no modules declared in this project.

javalang-compiler: Symbol and type resolution for Javalang

Build Status Coverage Status

Java 8 semantic analysis for the javalang project. Therefore, the Java 8 AST is enriched with data calculated during the semantic analysis. Mainly, the calculated data is:

  • Symbols data types: In other words, what are the Java runtime classes, fields and methods that a given type or expression is referencing. For example, if the AST contains a MethodCallExpr node, the method getSymbolData() of this node returns the java.lang.Method that this node is referencing.

  • Definitions and usages: For those nodes that are subclass of SymbolDefinition (e.g declarations), the nodes contain which external references(getBodyReferences()) they have and which nodes reference them inside the same compilation unit (getUsages()).

License

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.

Usage

If you are interested in creating a new walkmod plugin for Java code that requires this kind of information, you must add the following steps:

  1. Add the following dependency in your project.

<dependency>
    <groupId>org.walkmod</groupId>
    <artifactId>javalang-compiler</artifactId>
    <version>{last-version}</version>
</dependency>
  1. Annotate your code transformations (visitors) with the @RequiresSemanticAnalysis annotation. Walkmod (specifically the walkmod-javalang-plugin), will automatically run the org.walkmod.javalang.compiler.symbols.SymbolVisitorAdapter to enrich the nodes.

  2. Add a walkmod plugin in your walkmod.xml file that resolves your classpath and compiles your code (e.g walkmod-maven-plugin)

Contributing

If you want to hack on this, fork it, improve it and send me a pull request.

To get started using it, just clone it and call mvn install.

Versions

Version
2.3.10
2.3.9
2.3.8
2.3.7
2.3.6
2.3.5
2.3.3
2.3.2
2.3.1
2.3.0
2.2.12
2.2.11
2.2.10
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.1
2.1.0
2.0.1
2.0
1.0.2
1.0.1
1.0