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 104673 Details for
Bug 95480
[model] Missing INVALID_SIBLING exception when creating a type in an enum type that contains constants
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
95480.txt (text/plain), 2.52 KB, created by
Jerome Lanneluc
on 2008-06-12 09:37:25 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-06-12 09:37:25 EDT
Size:
2.52 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java,v >retrieving revision 1.16 >diff -u -r1.16 CreateMembersTests.java >--- src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java 8 Jun 2006 13:09:32 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java 12 Jun 2008 13:36:50 -0000 >@@ -151,4 +151,19 @@ > "}"; > assertSourceEquals("Unexpected source", expectedSource, type.getSource()); > } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95480 >+ public void test007() throws Exception { >+ JavaModelException expected = null; >+ try { >+ IType type = getCompilationUnit("CreateMembers/src/E.java").getType("E"); >+ type.createType("class Member {}", type.getField("E1"), false/*don't force*/, null/*no progress*/); >+ } catch (JavaModelException e) { >+ expected = e; >+ } >+ assertExceptionEquals( >+ "Unexpected exception", >+ "Invalid sibling: E1 [in E [in E.java [in <default> [in src [in CreateMembers]]]]]", >+ expected); >+ } > } >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/CreateTypeOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeOperation.java,v >retrieving revision 1.31 >diff -u -r1.31 CreateTypeOperation.java >--- model/org/eclipse/jdt/internal/core/CreateTypeOperation.java 27 May 2008 23:40:18 -0000 1.31 >+++ model/org/eclipse/jdt/internal/core/CreateTypeOperation.java 12 Jun 2008 13:36:51 -0000 >@@ -102,6 +102,20 @@ > } > return JavaModelStatus.VERIFIED_OK; > } >+public IJavaModelStatus verify() { >+ IJavaModelStatus status = super.verify(); >+ if (!status.isOK()) >+ return status; >+ try { >+ IJavaElement parent = getParentElement(); >+ if (this.anchorElement != null && this.anchorElement.getElementType() == IJavaElement.FIELD >+ && parent.getElementType() == IJavaElement.TYPE && ((IType)parent).isEnum()) >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_SIBLING, this.anchorElement); >+ } catch (JavaModelException e) { >+ return e.getJavaModelStatus(); >+ } >+ return JavaModelStatus.VERIFIED_OK; >+} > private String getASTNodeName() { > return ((AbstractTypeDeclaration) this.createdNode).getName().getIdentifier(); > }
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 95480
: 104673