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 118397 Details for
Bug 251690
[compiler] NPE if type collides with a package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch with testcase
patch.txt (text/plain), 3.56 KB, created by
Kent Johnson
on 2008-11-20 15:25:09 EST
(
hide
)
Description:
Proposed patch with testcase
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2008-11-20 15:25:09 EST
Size:
3.56 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v >retrieving revision 1.121 >diff -u -r1.121 CompilationUnitScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 24 Oct 2008 18:55:24 -0000 1.121 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 20 Nov 2008 20:24:29 -0000 >@@ -84,7 +84,8 @@ > } > } else { > if ((this.fPackage = this.environment.createPackage(this.currentPackageName)) == null) { >- problemReporter().packageCollidesWithType(this.referenceContext); >+ if (this.referenceContext.currentPackage != null) >+ problemReporter().packageCollidesWithType(this.referenceContext); // only report when the unit has a package statement > return; > } else if (this.referenceContext.isPackageInfo()) { > // resolve package annotations now if this is "package-info.java". >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/PackageTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java,v >retrieving revision 1.15 >diff -u -r1.15 PackageTests.java >--- src/org/eclipse/jdt/core/tests/builder/PackageTests.java 27 Jun 2008 16:02:02 -0000 1.15 >+++ src/org/eclipse/jdt/core/tests/builder/PackageTests.java 20 Nov 2008 20:24:29 -0000 >@@ -15,10 +15,12 @@ > import junit.framework.*; > > import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IMarker; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.core.tests.util.Util; > > public class PackageTests extends BuilderTests { >@@ -83,6 +85,32 @@ > expectingNoProblems(); > } > >+ /** >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=251690 >+ */ >+ public void testNoPackageProblem() throws JavaModelException { >+ IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ >+ env.addExternalJars(projectPath, Util.getJavaClassLibs()); >+ env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ >+ IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ >+ env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ >+ >+ IPath aPath = env.addClass(src, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ >+ "package p;\n"+ //$NON-NLS-1$ >+ "public class A {}" //$NON-NLS-1$ >+ ); >+ >+ IPath bPath = env.addClass(src, "p.A", "B", //$NON-NLS-1$ //$NON-NLS-2$ >+ "public class B {}" //$NON-NLS-1$ >+ ); >+ >+ fullBuild(); >+ expectingOnlySpecificProblemFor(aPath, >+ new Problem("", "The type A collides with a package", aPath, 24, 25, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ >+ expectingOnlySpecificProblemFor(bPath, >+ new Problem("", "The declared package \"\" does not match the expected package \"p.A\"", bPath, 0, 0, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=117092 > // simplistic linked subfolder used as package, external case (not in workspace) > public void test001() throws CoreException {
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 251690
: 118397