Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latest JLS for parser #46

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {
mavenCentral()
}

val jdt = "org.eclipse.jdt:org.eclipse.jdt.core:3.25.0"
val jdt = "org.eclipse.jdt:org.eclipse.jdt.core:3.27.0"
dependencies {
api(jdt)

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cadixdev/mercury/Mercury.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private void cleanup() {
}

private void run() throws Exception {
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.getJLSLatest());

// Set Java version
Map<String, String> options = JavaCore.getOptions();
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/org/cadixdev/mercury/remapper/RemapperVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.QualifiedType;
import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.TagElement;
Expand Down Expand Up @@ -428,6 +429,12 @@ public boolean visit(EnumDeclaration node) {
return true;
}

@Override
public boolean visit(RecordDeclaration node) {
pushImportContext(node.resolveBinding());
return true;
}

@Override
public boolean visit(TypeDeclaration node) {
pushImportContext(node.resolveBinding());
Expand All @@ -449,6 +456,11 @@ public void endVisit(EnumDeclaration node) {
this.importStack.pop();
}

@Override
public void endVisit(RecordDeclaration node) {
this.importStack.pop();
}

@Override
public void endVisit(TypeDeclaration node) {
this.importStack.pop();
Expand Down