Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 177816 Details for
Bug 323785
[builder] NPE when adding 'package-info.java' to default package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch.txt (text/plain), 4.65 KB, created by
Srikanth Sankaran
on 2010-08-31 04:47:32 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-08-31 04:47:32 EDT
Size:
4.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java,v >retrieving revision 1.110 >diff -u -r1.110 IncrementalImageBuilder.java >--- model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java 5 Oct 2009 14:44:21 -0000 1.110 >+++ model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java 31 Aug 2010 08:46:17 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -229,8 +229,16 @@ > if (isStructuralChange) { > String last = path.lastSegment(); > if (last.length() == TypeConstants.PACKAGE_INFO_NAME.length) >- if (CharOperation.equals(last.toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) >+ if (CharOperation.equals(last.toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) { > path = path.removeLastSegments(1); // the package-info file has changed so blame the package itself >+ /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785, in the case of default package, >+ there is no need to blame the package itself as there can be no annotations or documentation >+ comment tags in the package-info file that can influence the rest of the package. Just bail out >+ so we don't touch null objects below. >+ */ >+ if (path.isEmpty()) >+ return; >+ } > } > > if (isStructuralChange && !this.hasStructuralChanges) { >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java,v >retrieving revision 1.11 >diff -u -r1.11 PackageInfoTest.java >--- src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java 17 Dec 2008 17:55:22 -0000 1.11 >+++ src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java 31 Aug 2010 08:46:21 -0000 >@@ -228,6 +228,54 @@ > otherPackageInfoPath, > new Problem("my/foo/package-info.java", "The type package-info is already defined", otherPackageInfoPath, 0, 0, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785 >+// (NPE upon creation/deletion of package-info.java in default package) >+public void test323785 () throws JavaModelException { >+ >+ IPath projectPath = env.addProject("Project", "1.5"); >+ env.addExternalJars(projectPath, Util.getJavaClassLibs()); >+ fullBuild(projectPath); >+ >+ // remove old package fragment root so that names don't collide >+ env.removePackageFragmentRoot(projectPath, ""); >+ >+ IPath root = env.addPackageFragmentRoot(projectPath, "src"); >+ env.setOutputFolder(projectPath, "bin"); >+ >+ fullBuild(projectPath); >+ >+ env.addFile(root, "package-info.java", ""); >+ >+ incrementalBuild(projectPath); >+ expectingNoProblems(); >+ >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785 >+// verify that changes to package info containing secondary types do trigger incremental build. >+public void test323785a () throws JavaModelException { >+ >+ IPath projectPath = env.addProject("Project", "1.5"); >+ env.addExternalJars(projectPath, Util.getJavaClassLibs()); >+ fullBuild(projectPath); >+ >+ // remove old package fragment root so that names don't collide >+ env.removePackageFragmentRoot(projectPath, ""); >+ >+ IPath root = env.addPackageFragmentRoot(projectPath, "src"); >+ env.setOutputFolder(projectPath, "bin"); >+ >+ IPath xJavaPath = env.addFile(root, "X.java", "class X extends Y {}\n"); >+ fullBuild(projectPath); >+ env.addFile(root, "package-info.java", "class Y {}\n"); >+ incrementalBuild(projectPath); >+ expectingNoProblems(); >+ env.addFile(root, "package-info.java", "final class Y {}\n"); >+ incrementalBuild(projectPath); >+ expectingOnlySpecificProblemFor( >+ xJavaPath, >+ new Problem("X.java", "The type X cannot subclass the final class Y", xJavaPath, 16, 17, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); >+ >+} > protected void assertSourceEquals(String message, String expected, String actual) { > if (actual == null) { > assertEquals(message, expected, null);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 323785
: 177816