Skip to content

Commit

Permalink
Some more problem IDs
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Sep 12, 2024
1 parent 871e2a8 commit a135144
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.DiagnosticSource;
import com.sun.tools.javac.util.Options;

/**
* Allows to create and resolve DOM ASTs using Javac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ yield switch (rootCauseCode) {
case "compiler.err.error.reading.file" -> IProblem.CannotReadSource;
case "compiler.err.dot.class.expected" -> IProblem.TypeRelated; //not in ECJ
case "compiler.err.feature.not.supported.in.source" -> IProblem.FeatureNotSupported;
case "compiler.err.annotation.type.not.applicable.to.type" -> {
case "compiler.err.annotation.type.not.applicable.to.type", "compiler.err.annotation.type.not.applicable" -> {
if (diagnostic instanceof JCDiagnostic jcDiagnostic && jcDiagnostic.getDiagnosticPosition() instanceof JCAnnotation jcAnnotation
&& jcAnnotation.type.tsym.getAnnotationTypeMetadata().getTarget() == null) {
yield IProblem.ExplicitAnnotationTargetRequired;
Expand All @@ -1035,6 +1035,15 @@ yield switch (rootCauseCode) {
}
yield IProblem.IllegalStaticModifierForMemberType;
}
case "compiler.err.new.not.allowed.in.annotation" -> IProblem.AnnotationValueMustBeConstant;
case "compiler.err.foreach.not.applicable.to.type" -> IProblem.InvalidTypeForCollection;
case "compiler.err.this.as.identifier" -> IProblem.Syntax;
case "compiler.err.int.number.too.large" -> IProblem.NumericValueOutOfRange;
case "compiler.err.type.var.cant.be.deref" -> IProblem.IllegalAccessFromTypeVariable;
case "compiler.err.try.with.resources.expr.needs.var" -> IProblem.Syntax;
case "compiler.err.catch.without.try" -> IProblem.Syntax;
case "compiler.err.not.encl.class" -> IProblem.IllegalEnclosingInstanceSpecification;
case "compiler.err.type.found.req" -> IProblem.DisallowedTargetForAnnotation;
default -> {
ILog.get().error("Could not convert diagnostic (" + diagnostic.getCode() + ")\n" + diagnostic);
yield 0;
Expand Down

0 comments on commit a135144

Please sign in to comment.