diff options
author | Stephan Herrmann | 2019-05-11 22:22:47 +0000 |
---|---|---|
committer | Stephan Herrmann | 2019-05-11 22:23:03 +0000 |
commit | 6b17b845d62c5069b21026c2cfe942c17aae6899 (patch) | |
tree | c5cda3fc3a0bc5088f9931f095641de9bbdf9dba /org.eclipse.jdt.core/model | |
parent | 97d56a861f97b4c7ba07d96dd452a88dcff1c1c9 (diff) | |
download | eclipse.jdt.core-6b17b845d62c5069b21026c2cfe942c17aae6899.tar.gz eclipse.jdt.core-6b17b845d62c5069b21026c2cfe942c17aae6899.tar.xz eclipse.jdt.core-6b17b845d62c5069b21026c2cfe942c17aae6899.zip |
Bug 547114 - NPE at ModuleBinding.addReads(...) on changing Module
Dependencies
Change-Id: I3689bb56f02eba46dcc9b5a8b689c109bbc227ff
Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
Diffstat (limited to 'org.eclipse.jdt.core/model')
3 files changed, 12 insertions, 5 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java index 704ee85a3b..abd540201d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -697,11 +697,16 @@ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] prob // but at the start of the next problem we should reset it to the source file's resource IResource resource = sourceFile.resource; - // handle missing classfile situation + // handle buildpath problems (missing classfile, unresolved add-reads...) + String buildPathProblemMessage = null; if (id == IProblem.IsClassPathCorrect) { - String missingClassfileName = problem.getArguments()[0]; + buildPathProblemMessage = Messages.bind(Messages.build_incompleteClassPath, problem.getArguments()[0]); + } else if (id == IProblem.UndefinedModuleAddReads) { + buildPathProblemMessage = Messages.bind(Messages.build_errorOnModuleDirective, problem.getMessage()); + } + if (buildPathProblemMessage != null) { if (JavaBuilder.DEBUG) - System.out.println(Messages.bind(Messages.build_incompleteClassPath, missingClassfileName)); + System.out.println(buildPathProblemMessage); boolean isInvalidClasspathError = JavaCore.ERROR.equals(this.javaBuilder.javaProject.getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true)); // insert extra classpath problem, and make it the only problem for this project (optional) if (isInvalidClasspathError && JavaCore.ABORT.equals(this.javaBuilder.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, true))) { @@ -712,7 +717,7 @@ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] prob marker.setAttributes( new String[] {IMarker.MESSAGE, IMarker.SEVERITY, IJavaModelMarker.CATEGORY_ID, IMarker.SOURCE_ID}, new Object[] { - Messages.bind(Messages.build_incompleteClassPath, missingClassfileName), + buildPathProblemMessage, Integer.valueOf(isInvalidClasspathError ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING), Integer.valueOf(CategorizedProblem.CAT_BUILDPATH), JavaBuilder.SOURCE_ID diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java index f1fe4d648a..a75bd65ad2 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java @@ -111,6 +111,7 @@ public final class Messages extends NLS { public static String build_inconsistentClassFile; public static String build_inconsistentProject; public static String build_incompleteClassPath; + public static String build_errorOnModuleDirective; public static String build_missingSourceFile; public static String build_prereqProjectHasClasspathProblems; public static String build_prereqProjectMustBeRebuilt; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties index 305dbb8237..ec02740544 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties @@ -103,6 +103,7 @@ build_duplicateResource = The resource is a duplicate of {0} and was not copied build_inconsistentClassFile = A class file was not written. The project may be inconsistent, if so try refreshing this project and building it build_inconsistentProject = The project was not built due to "{0}". Fix the problem, then try refreshing this project and building it since it may be inconsistent build_incompleteClassPath = The project was not built since its build path is incomplete. Cannot find the class file for {0}. Fix the build path then try building this project +build_errorOnModuleDirective = The project was not built since its build path has a problem: {0}. Fix the build path then try building this project build_missingSourceFile = The project was not built since the source file {0} could not be read build_prereqProjectHasClasspathProblems = The project was not built since it depends on {0}, which has build path errors build_prereqProjectMustBeRebuilt = The project cannot be built until its prerequisite {0} is built. Cleaning and building all projects is recommended |