Skip to content

Commit

Permalink
Another round of problem id mappings
Browse files Browse the repository at this point in the history
This time a lot of them are for errors that ECJ doesn't support

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 authored and rgrunber committed Oct 18, 2024
1 parent 2e17c6a commit 04e7d25
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,28 @@ yield switch (rootCauseCode) {
case "compiler.warn.finally.cannot.complete" -> IProblem.FinallyMustCompleteNormally;
case "compiler.err.generic.throwable" -> IProblem.GenericTypeCannotExtendThrowable;
case "compiler.warn.potentially.ambiguous.overload" -> IProblem.TypeRelated; // not in ECJ
case "compiler.warn.inexact.non-varargs.call" -> IProblem.MethodVarargsArgumentNeedCast;
case "compiler.note.deprecated.filename" -> IProblem.OverridingDeprecatedMethod;
case "compiler.note.unchecked.plural.additional" -> IProblem.TypeRelated; // not in ECJ; this is a project-wide warning
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" -> {
if (diagnostic instanceof JCDiagnostic jcDiagnostic && jcDiagnostic.getDiagnosticPosition() instanceof JCAnnotation jcAnnotation
&& jcAnnotation.type.tsym.getAnnotationTypeMetadata().getTarget() == null) {
yield IProblem.ExplicitAnnotationTargetRequired;
}
yield IProblem.DisallowedTargetForAnnotation;
}
case "compiler.err.pkg.annotations.sb.in.package-info.java" -> IProblem.InvalidFileNameForPackageAnnotations;
case "compiler.err.unexpected.type" -> IProblem.TypeMismatch;
case "compiler.err.intf.annotation.members.cant.have.params" -> IProblem.AnnotationMembersCannotHaveParameters;
case "compiler.err.static.declaration.not.allowed.in.inner.classes" -> {
if (diagnostic instanceof JCDiagnostic jcDiagnostic && jcDiagnostic.getDiagnosticPosition() instanceof JCClassDecl classDecl && classDecl.sym.isEnum()) {
yield IProblem.NonStaticContextForEnumMemberType;
}
yield IProblem.IllegalStaticModifierForMemberType;
}
default -> {
ILog.get().error("Could not convert diagnostic (" + diagnostic.getCode() + ")\n" + diagnostic);
yield 0;
Expand Down

0 comments on commit 04e7d25

Please sign in to comment.