From b8c8b50ce5007aa5dbc6450fb43a5caa112dd68f Mon Sep 17 00:00:00 2001 From: Mickael Istria Date: Tue, 2 Jul 2024 09:05:53 +0200 Subject: [PATCH] Un-static JavacProblem converter --- .../internal/javac/JavacProblemConverter.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/JavacProblemConverter.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/JavacProblemConverter.java index fb641519f68..5d949e12832 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/JavacProblemConverter.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/JavacProblemConverter.java @@ -95,7 +95,7 @@ public JavacProblem createJavacProblem(Diagnostic diag (int) diagnostic.getColumnNumber()); } - private static org.eclipse.jface.text.Position getDiagnosticPosition(Diagnostic diagnostic, Context context) { + private org.eclipse.jface.text.Position getDiagnosticPosition(Diagnostic diagnostic, Context context) { if (diagnostic.getCode().contains(".dc")) { //javadoc return getDefaultPosition(diagnostic); } @@ -324,7 +324,7 @@ private int toSeverity(int jdtProblemId, Diagnostic di * And the examples to reproduce the Javac problems: * https://github.com/openjdk/jdk/tree/master/test/langtools/tools/javac/diags/examples */ - public static int toProblemId(Diagnostic diagnostic) { + public int toProblemId(Diagnostic diagnostic) { String javacDiagnosticCode = diagnostic.getCode(); return switch (javacDiagnosticCode) { case "compiler.err.expected" -> IProblem.ParsingErrorInsertTokenAfter; @@ -442,7 +442,7 @@ private static int convertUnresolvedVariable(Diagnostic diagnostic) { return IProblem.UnresolvedVariable; } - private static int convertUndefinedMethod(Diagnostic diagnostic) { + private int convertUndefinedMethod(Diagnostic diagnostic) { JCDiagnostic diagnosticArg = getDiagnosticArgumentByType(diagnostic, JCDiagnostic.class); if (diagnosticArg != null) { Type receiverArg = getDiagnosticArgumentByType(diagnosticArg, Type.class); @@ -461,7 +461,7 @@ private static int convertUndefinedMethod(Diagnostic diagnostic) { return IProblem.UndefinedMethod; } - private static T getDiagnosticArgumentByType(Diagnostic diagnostic, Class type) { + private T getDiagnosticArgumentByType(Diagnostic diagnostic, Class type) { if (!(diagnostic instanceof JCDiagnostic jcDiagnostic)) { return null; } @@ -478,7 +478,7 @@ private static T getDiagnosticArgumentByType(Diagnostic diagnostic, Class return null; } - private static Object[] getDiagnosticArguments(Diagnostic diagnostic) { + private Object[] getDiagnosticArguments(Diagnostic diagnostic) { if (!(diagnostic instanceof JCDiagnostic jcDiagnostic)) { return new Object[0]; } @@ -487,7 +487,7 @@ private static Object[] getDiagnosticArguments(Diagnostic diagnostic) { } // compiler.err.prob.found.req -> TypeMismatch, ReturnTypeMismatch, IllegalCast, VoidMethodReturnsValue... - private static int convertTypeMismatch(Diagnostic diagnostic) { + private int convertTypeMismatch(Diagnostic diagnostic) { Diagnostic diagnosticArg = getDiagnosticArgumentByType(diagnostic, Diagnostic.class); if (diagnosticArg != null) { if ("compiler.misc.inconvertible.types".equals(diagnosticArg.getCode())) { @@ -505,7 +505,7 @@ private static int convertTypeMismatch(Diagnostic diagnostic) { return IProblem.TypeMismatch; } - private static int convertUnresolvedSymbol(Diagnostic javacDiagnostic) { + private int convertUnresolvedSymbol(Diagnostic javacDiagnostic) { if (javacDiagnostic instanceof JCDiagnostic jcDiagnostic) { Object[] args = jcDiagnostic.getArgs(); if (args != null) { @@ -525,7 +525,7 @@ private static int convertUnresolvedSymbol(Diagnostic return IProblem.UndefinedName; } - private static int convertNotVisibleAccess(Diagnostic diagnostic) { + private int convertNotVisibleAccess(Diagnostic diagnostic) { if (diagnostic instanceof JCDiagnostic jcDiagnostic) { Object[] args = jcDiagnostic.getArgs(); if (args != null && args.length > 0) { @@ -550,7 +550,7 @@ private static int convertNotVisibleAccess(Diagnostic diagnostic) { return 0; } - private static int convertAmbiguous(Diagnostic diagnostic) { + private int convertAmbiguous(Diagnostic diagnostic) { Kinds.KindName kind = getDiagnosticArgumentByType(diagnostic, Kinds.KindName.class); return switch (kind) { case CLASS -> IProblem.AmbiguousType;