Skip to content

Commit

Permalink
Error IDs for problems unique to javac
Browse files Browse the repository at this point in the history
This causes 6 regerssions because 'possible this escape' is now
reported.

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Nov 7, 2024
1 parent e114cb9 commit 6bd83c4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,10 @@ yield switch (rootCauseCode) {
case "compiler.err.call.must.only.appear.in.ctor" -> IProblem.InvalidExplicitConstructorCall;
case "compiler.err.void.not.allowed.here" -> IProblem.ParameterMismatch;
case "compiler.err.abstract.cant.be.accessed.directly" -> IProblem.DirectInvocationOfAbstractMethod;
case "compiler.warn.possible.this.escape" -> JavacProblemIds.PossibleThisEscape;
case "compiler.warn.possible.this.escape.location" -> JavacProblemIds.PossibleThisEscapeLocation;
case "compiler.warn.possible.loss.of.precision" -> JavacProblemIds.PossibleLossOfPrescision;
case "compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file" -> JavacProblemIds.AuxiliaryClassAccessedOutsideItsSourceFile;
default -> {
ILog.get().error("Could not accurately convert diagnostic (" + diagnostic.getCode() + ")\n" + diagnostic);
if (diagnostic.getKind() == javax.tools.Diagnostic.Kind.ERROR && diagnostic.getCode().startsWith("compiler.err")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2024 Red Hat Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.javac;

/**
* Constant IDs for problems that don't have a corresponding diagnostic in ECJ.
*/
public class JavacProblemIds {

private JavacProblemIds() {}

/// some large number, I chose this from the Wikipedia prime page for fun
private static final int BaseJavacProblemId = 39916801;

public static final int PossibleThisEscape = BaseJavacProblemId + 1;
public static final int PossibleThisEscapeLocation = BaseJavacProblemId + 2;
public static final int PossibleLossOfPrescision = BaseJavacProblemId + 3;
public static final int AuxiliaryClassAccessedOutsideItsSourceFile = BaseJavacProblemId + 4;

}

0 comments on commit 6bd83c4

Please sign in to comment.