diff options
author | Paul Fullbright | 2012-08-02 18:44:29 +0000 |
---|---|---|
committer | Paul Fullbright | 2012-08-02 18:44:29 +0000 |
commit | 01a1013a67296fe4d5556a455f95fa56f1ee253d (patch) | |
tree | 67b644f1d3b6cf6a7e32a64ccf5b84c2f741e084 | |
parent | f0eedeec8d680bd4287ad6d5029a744d306bab80 (diff) | |
download | webtools.dali-01a1013a67296fe4d5556a455f95fa56f1ee253d.tar.gz webtools.dali-01a1013a67296fe4d5556a455f95fa56f1ee253d.tar.xz webtools.dali-01a1013a67296fe4d5556a455f95fa56f1ee253d.zip |
inherited attribute type
23 files changed, 689 insertions, 667 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java index f8646bea9b..7ff0bdb00a 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java @@ -11,15 +11,11 @@ package org.eclipse.jpt.common.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin; import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; import org.eclipse.jpt.common.core.internal.utility.jdt.JavaResourceTypeBinding; import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; @@ -27,8 +23,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum; import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; /** * binary persistent type @@ -44,22 +38,26 @@ abstract class BinaryAbstractType // ********** construction/initialization ********** - protected BinaryAbstractType(JavaResourceNode parent, IType type) { - super(parent, new TypeAdapter(type)); - this.typeBinding = buildTypeBinding(createJdtTypeBinding(type)); - this.declaringTypeName = this.buildDeclaringTypeName(type); + protected BinaryAbstractType(JavaResourceNode parent, TypeAdapter adapter) { + super(parent, adapter); + this.typeBinding = buildTypeBinding(adapter.getTypeBinding()); + this.declaringTypeName = buildDeclaringTypeName(); } - - + + // ********** overrides ********** - + @Override - protected void update(IMember member) { - super.update(member); - - // TODO - update type binding? + protected IType getElement() { + return (IType) super.getElement(); + } + + @Override + public void update() { + super.update(); - this.setDeclaringTypeName(this.buildDeclaringTypeName((IType) member)); + updateTypeBinding(); + updateDeclaringTypeName(); } @Override @@ -80,15 +78,14 @@ abstract class BinaryAbstractType return this.typeBinding; } - protected ITypeBinding createJdtTypeBinding(IType jdtType) { - IBinding jdtBinding = ASTTools.createBinding(jdtType); - return (ITypeBinding) jdtBinding; - } - protected JavaResourceTypeBinding buildTypeBinding(ITypeBinding jdtTypeBinding) { return new JavaResourceTypeBinding(jdtTypeBinding); } + protected void updateTypeBinding() { + throw new UnsupportedOperationException(); + } + // ***** package public boolean isIn(IPackageFragment packageFragment) { return StringTools.stringsAreEqual(packageFragment.getElementName(), this.typeBinding.getPackageName()); @@ -100,7 +97,7 @@ abstract class BinaryAbstractType } private IPackageFragmentRoot getSourceFolder() { - return (IPackageFragmentRoot) this.getMember().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); + return (IPackageFragmentRoot) getElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); } // ***** declaring type name @@ -108,25 +105,18 @@ abstract class BinaryAbstractType return this.declaringTypeName; } - private void setDeclaringTypeName(String declaringTypeName) { - String old = this.declaringTypeName; - this.declaringTypeName = declaringTypeName; - this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName); + private String buildDeclaringTypeName() { + IType declaringType = getElement().getDeclaringType(); + return (declaringType == null) ? null : declaringType.getFullyQualifiedName('.'); // no parameters are included here } - private String buildDeclaringTypeName(IType type) { - IType declaringType = type.getDeclaringType(); - return (declaringType == null) ? null : declaringType.getFullyQualifiedName('.'); // no parameters are included here + protected void updateDeclaringTypeName() { + throw new UnsupportedOperationException(); } // ********** misc ********** - - @Override - public IType getMember() { - return (IType) super.getMember(); - } - + public Iterable<JavaResourceType> getTypes() { throw new UnsupportedOperationException(); } @@ -134,7 +124,7 @@ abstract class BinaryAbstractType public Iterable<JavaResourceEnum> getEnums() { throw new UnsupportedOperationException(); } - + public Iterable<JavaResourceType> getAllTypes() { throw new UnsupportedOperationException(); } @@ -142,31 +132,35 @@ abstract class BinaryAbstractType public Iterable<JavaResourceEnum> getAllEnums() { throw new UnsupportedOperationException(); } - + + // ********** IType adapter ********** - + static class TypeAdapter - implements Adapter { + implements MemberAdapter { private final IType type; + /* cached, but only during initialization */ + private final ITypeBinding typeBinding; + TypeAdapter(IType type) { super(); this.type = type; + this.typeBinding = createTypeBinding(type); + } + + + protected ITypeBinding createTypeBinding(IType type) { + return (ITypeBinding) ASTTools.createBinding(type); } public IType getElement() { return this.type; } - public Iterable<ITypeParameter> getTypeParameters() { - try { - return new ArrayIterable<ITypeParameter>(this.type.getTypeParameters()); - } - catch (JavaModelException jme) { - JptCommonCorePlugin.instance().logError(jme); - } - return EmptyIterable.instance(); + public ITypeBinding getTypeBinding() { + return this.typeBinding; } public IAnnotation[] getAnnotations() throws JavaModelException { diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java index 2439c1640e..6688e1426c 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java @@ -37,45 +37,57 @@ import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; * Java binary annotated element */ abstract class BinaryAnnotatedElement - extends BinaryNode - implements JavaResourceAnnotatedElement -{ - /** JDT annotated element adapter */ - final Adapter adapter; - + extends BinaryNode + implements JavaResourceAnnotatedElement { + + private final IJavaElement javaElement; + /** * Annotations keyed by annotation name; * no duplicates (the Java compiler does not allow duplicate annotations). */ private final Hashtable<String, Annotation> annotations = new Hashtable<String, Annotation>(); - + /** * Annotation containers keyed by <em>nestable</em> annotation name. * This is used to store annotations that can be both standalone and nested * and are moved back and forth between the two. */ private final Hashtable<String, AnnotationContainer> annotationContainers = new Hashtable<String, AnnotationContainer>(); - + /** * These are built as needed. */ private final Hashtable<String, Annotation> nullAnnotationsCache = new Hashtable<String, Annotation>(); - - + + // ********** construction/initialization ********** - + BinaryAnnotatedElement(JavaResourceNode parent, Adapter adapter) { super(parent); - this.adapter = adapter; - this.initializeAnnotations(); + this.javaElement = adapter.getElement(); + initializeAnnotations(adapter); } - - private void initializeAnnotations() { - for (IAnnotation annotation : this.getJdtAnnotations()) { + + + private void initializeAnnotations(Adapter adapter) { + for (IAnnotation annotation : this.getJdtAnnotations(adapter)) { this.addAnnotation(annotation); } } - + + private IAnnotation[] getJdtAnnotations(Adapter adapter) { + try { + return adapter.getAnnotations(); + } + catch (JavaModelException ex) { + JptCommonCorePlugin.instance().logError(ex); + return EMPTY_JDT_ANNOTATION_ARRAY; + } + } + + private static final IAnnotation[] EMPTY_JDT_ANNOTATION_ARRAY = new IAnnotation[0]; + private void addAnnotation(IAnnotation jdtAnnotation) { String jdtAnnotationName = jdtAnnotation.getElementName(); // check whether the annotation is a valid container annotation first @@ -100,58 +112,58 @@ abstract class BinaryAnnotatedElement } } } - + private boolean annotationIsValid(String annotationName) { return CollectionTools.contains(this.getAnnotationProvider().getAnnotationNames(), annotationName); } - + private boolean annotationIsValidContainer(String annotationName) { return CollectionTools.contains(this.getAnnotationProvider().getContainerAnnotationNames(), annotationName); } - + private boolean annotationIsValidNestable(String annotationName) { return CollectionTools.contains(this.getAnnotationProvider().getNestableAnnotationNames(), annotationName); } - - + + // ********** updating ********** - + @Override public void update() { super.update(); this.updateAnnotations(); } - + // TODO private void updateAnnotations() { throw new UnsupportedOperationException(); } - - + + // ********** annotations ********** - + public Iterable<Annotation> getAnnotations() { return new LiveCloneIterable<Annotation>(this.annotations.values()); } - + public int getAnnotationsSize() { return this.annotations.size(); } - + public Annotation getAnnotation(String annotationName) { return this.annotations.get(annotationName); } - + public Annotation getContainerAnnotation(String containerAnnotationName) { AnnotationContainer container = this.annotationContainers.get(this.getAnnotationProvider().getNestableAnnotationName(containerAnnotationName)); return (container == null) ? null : container.getContainerAnnotation(); } - + public Annotation getNonNullAnnotation(String annotationName) { Annotation annotation = this.getAnnotation(annotationName); return (annotation != null) ? annotation : this.getNullAnnotation(annotationName); } - + private Annotation getNullAnnotation(String annotationName) { synchronized (this.nullAnnotationsCache) { Annotation annotation = this.nullAnnotationsCache.get(annotationName); @@ -162,78 +174,78 @@ abstract class BinaryAnnotatedElement return annotation; } } - + private Annotation buildNullAnnotation(String annotationName) { return this.getAnnotationProvider().buildNullAnnotation(this, annotationName); } - + /* CU private */ Annotation buildAnnotation(IAnnotation jdtAnnotation) { return this.getAnnotationProvider().buildAnnotation(this, jdtAnnotation); } - - + + // ********** combination annotations ********** - + private Iterable<NestableAnnotation> getNestableAnnotations() { return new CompositeIterable<NestableAnnotation>(this.getNestableAnnotationLists()); } - + private Iterable<Iterable<NestableAnnotation>> getNestableAnnotationLists() { return new TransformationIterable<AnnotationContainer, Iterable<NestableAnnotation>>(this.getAnnotationContainers(), ANNOTATION_CONTAINER_NESTED_ANNOTATIONS_TRANSFORMER); } - + private static final Transformer<AnnotationContainer, Iterable<NestableAnnotation>> ANNOTATION_CONTAINER_NESTED_ANNOTATIONS_TRANSFORMER = new AnnotationContainerNestedAnnotationsTransformer(); + static final class AnnotationContainerNestedAnnotationsTransformer - extends TransformerAdapter<AnnotationContainer, Iterable<NestableAnnotation>> - { + extends TransformerAdapter<AnnotationContainer, Iterable<NestableAnnotation>> { @Override public Iterable<NestableAnnotation> transform(AnnotationContainer container) { return container.getNestedAnnotations(); } } - + private Iterable<AnnotationContainer> getAnnotationContainers() { return new LiveCloneIterable<AnnotationContainer>(this.annotationContainers.values()); } - + public ListIterable<NestableAnnotation> getAnnotations(String nestableAnnotationName) { AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); return (container != null) ? container.getNestedAnnotations() : EmptyListIterable.<NestableAnnotation> instance(); } - - + + public int getAnnotationsSize(String nestableAnnotationName) { AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); return (container == null) ? 0 : container.getNestedAnnotationsSize(); } - + public NestableAnnotation getAnnotation(int index, String nestableAnnotationName) { AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); return (container == null) ? null : container.getNestedAnnotation(index); } - + private Iterable<Annotation> getContainerOrStandaloneNestableAnnotations() { return new TransformationIterable<AnnotationContainer, Annotation>(this.getAnnotationContainers(), TOP_LEVEL_ANNOTATION_CONTAINER_TRANSFORMER); } - + private static final Transformer<AnnotationContainer, Annotation> TOP_LEVEL_ANNOTATION_CONTAINER_TRANSFORMER = new TopLevelAnnotationContainerTransformer(); + /* CU private */ static final class TopLevelAnnotationContainerTransformer - extends TransformerAdapter<AnnotationContainer, Annotation> - { + extends TransformerAdapter<AnnotationContainer, Annotation> { @Override public Annotation transform(AnnotationContainer container) { Annotation containerAnnotation = container.getContainerAnnotation(); return (containerAnnotation != null) ? containerAnnotation : container.getNestedAnnotation(0); } } - + /* CU private */ NestableAnnotation buildAnnotation(IAnnotation jdtAnnotation, int index) { return this.getAnnotationProvider().buildAnnotation(this, jdtAnnotation, index); } - - + + // ***** all annotations ***** - + @SuppressWarnings("unchecked") public Iterable<Annotation> getTopLevelAnnotations() { return new CompositeIterable<Annotation>( @@ -241,15 +253,15 @@ abstract class BinaryAnnotatedElement this.getContainerOrStandaloneNestableAnnotations() ); } - + public boolean isAnnotated() { return ! this.isUnannotated(); } - + private boolean isUnannotated() { return this.annotations.isEmpty() && this.annotationContainers.isEmpty(); } - + public boolean isAnnotatedWithAnyOf(Iterable<String> annotationNames) { for (Annotation annotation : this.getSignificantAnnotations()) { if (CollectionTools.contains(annotationNames, annotation.getAnnotationName())) { @@ -258,7 +270,7 @@ abstract class BinaryAnnotatedElement } return false; } - + /** * Return the "significant" annotations; * i.e. ignore the container annotations (they have no semantics). @@ -270,91 +282,70 @@ abstract class BinaryAnnotatedElement this.getNestableAnnotations() ); } - - + + // ********** misc ********** - + + protected IJavaElement getElement() { + return this.javaElement; + } + @Override protected AnnotationProvider getAnnotationProvider() { return super.getAnnotationProvider(); } - - private IAnnotation[] getJdtAnnotations() { - try { - return this.adapter.getAnnotations(); - } catch (JavaModelException ex) { - JptCommonCorePlugin.instance().logError(ex); - return EMPTY_JDT_ANNOTATION_ARRAY; - } - } - private static final IAnnotation[] EMPTY_JDT_ANNOTATION_ARRAY = new IAnnotation[0]; - - - // ********** IJavaElement adapter ********** - - interface Adapter { - /** - * Return the adapter's JDT element (IPackageFragment, IType, IField, IMethod). - */ - IJavaElement getElement(); - - /** - * Return the adapter's element's JDT annotations. - */ - IAnnotation[] getAnnotations() throws JavaModelException; - } - - + + // ********** unsupported JavaResourcePersistentMember implementation ********** - + public Annotation addAnnotation(String annotationName) { throw new UnsupportedOperationException(); } - + public NestableAnnotation addAnnotation(int index, String nestableAnnotationName) { throw new UnsupportedOperationException(); } - + public void moveAnnotation(int targetIndex, int sourceIndex, String nestableAnnotationName) { throw new UnsupportedOperationException(); } - + public void removeAnnotation(String annotationName) { throw new UnsupportedOperationException(); } - + public void removeAnnotation(int index, String nestableAnnotationName) { throw new UnsupportedOperationException(); } - + public TextRange getNameTextRange() { throw new UnsupportedOperationException(); } - + public TextRange getTextRange(String nestableAnnotationName, CompilationUnit astRoot) { throw new UnsupportedOperationException(); } - + /* CU private */ static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0]; - - + + // ********** annotation container ********** - + /* CU private */ class AnnotationContainer { - + private Annotation containerAnnotation; - + private final Vector<NestableAnnotation> nestedAnnotations = new Vector<NestableAnnotation>(); - + AnnotationContainer() { super(); } - + void initializeFromContainerAnnotation(IAnnotation jdtContainerAnnotation) { this.initializeNestedAnnotations(jdtContainerAnnotation); this.containerAnnotation = BinaryAnnotatedElement.this.buildAnnotation(jdtContainerAnnotation); } - + void initializeNestedAnnotations(IAnnotation jdtContainerAnnotation) { Object[] jdtNestedAnnotations = this.getJdtNestedAnnotations(jdtContainerAnnotation); int len = jdtNestedAnnotations.length; @@ -363,33 +354,49 @@ abstract class BinaryAnnotatedElement this.addAnnotation(jdtNestedAnnotation, i); } } - + private Object[] getJdtNestedAnnotations(IAnnotation jdtContainerAnnotation) { return BinaryAnnotatedElement.this.getJdtMemberValues(jdtContainerAnnotation, "value"); //$NON-NLS-1$ } - + void initializeFromStandaloneAnnotation(IAnnotation jdtNestableAnnotation) { this.addAnnotation(jdtNestableAnnotation, 0); } - + private void addAnnotation(IAnnotation jdtNestableAnnotation, int index) { this.nestedAnnotations.add(BinaryAnnotatedElement.this.buildAnnotation(jdtNestableAnnotation, index)); } - + Annotation getContainerAnnotation() { return this.containerAnnotation; } - + ListIterable<NestableAnnotation> getNestedAnnotations() { return new LiveCloneListIterable<NestableAnnotation>(this.nestedAnnotations); } - + int getNestedAnnotationsSize() { return this.nestedAnnotations.size(); } - + NestableAnnotation getNestedAnnotation(int index) { return this.nestedAnnotations.get(index); } } + + + // ********** IJavaElement adapter ********** + + interface Adapter { + + /** + * Return the adapter's JDT element (IPackageFragment, IType, IField, IMethod). + */ + IJavaElement getElement(); + + /** + * Return the adapter's element's JDT annotations. + */ + IAnnotation[] getAnnotations() throws JavaModelException; + } } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java index 2a611652bc..d0da96d454 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java @@ -9,12 +9,9 @@ ******************************************************************************/ package org.eclipse.jpt.common.core.internal.resource.java.binary; -import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; import org.eclipse.jpt.common.core.internal.utility.jdt.JavaResourceTypeBinding; import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; @@ -27,17 +24,18 @@ abstract class BinaryAttribute extends BinaryMember implements JavaResourceAttribute { + private String attributeName; + private int modifiers; private TypeBinding typeBinding; - protected BinaryAttribute(JavaResourceType parent, Adapter adapter) { + protected BinaryAttribute(JavaResourceType parent, AttributeAdapter adapter) { super(parent, adapter); - - IMember member = adapter.getElement(); - this.modifiers = buildModifiers(member); - this.typeBinding = buildTypeBinding(createJdtTypeBinding(member)); + this.attributeName = adapter.getAttributeName(); + this.modifiers = buildModifiers(); + this.typeBinding = buildTypeBinding(adapter.getTypeBinding()); } @@ -46,16 +44,9 @@ abstract class BinaryAttribute @Override public void update() { super.update(); - - // TODO - update type binding ? - } - - @Override - protected void update(IMember member) { - super.update(member); - this.setModifiers(this.buildModifiers(member)); - - // TODO - update type binding ? + updateAttributeName(); + updateModifiers(); + updateTypeBinding(); } @Override @@ -64,14 +55,7 @@ abstract class BinaryAttribute } - // ********** BinaryPersistentMember implementation ********** - - private Adapter getAdapter() { - return (Adapter) this.adapter; - } - - - // ********** JavaResourceAttribute implementation ********** + // ***** JavaResourceAttribute implementation ***** @Override public JavaResourceType getParent() { @@ -83,7 +67,18 @@ abstract class BinaryAttribute } public String getName() { - return this.getAdapter().getAttributeName(); + return getAttributeName(); + } + + + // ***** attribute name ***** + + public String getAttributeName() { + return this.attributeName; + } + + protected void updateAttributeName() { + throw new UnsupportedOperationException(); } @@ -93,24 +88,24 @@ abstract class BinaryAttribute return this.modifiers; } - private void setModifiers(int modifiers) { - int old = this.modifiers; - this.modifiers = modifiers; - this.firePropertyChanged(MODIFIERS_PROPERTY, old, modifiers); - } /** * zero seems like a reasonable default... */ - private int buildModifiers(IMember member) { + private int buildModifiers() { try { - return member.getFlags(); - } catch (JavaModelException ex) { + return getElement().getFlags(); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return 0; } } + protected void updateModifiers() { + throw new UnsupportedOperationException(); + } + // ***** type binding ***** @@ -118,25 +113,22 @@ abstract class BinaryAttribute return this.typeBinding; } - protected ITypeBinding createJdtTypeBinding(IMember member) { - IBinding jdtBinding = ASTTools.createBinding(member); - return getJdtTypeBinding(jdtBinding); - } - - protected abstract ITypeBinding getJdtTypeBinding(IBinding jdtBinding); - protected TypeBinding buildTypeBinding(ITypeBinding jdtTypeBinding) { return new JavaResourceTypeBinding(jdtTypeBinding); } + protected void updateTypeBinding() { + throw new UnsupportedOperationException(); + } + // ***** adapters ***** /** * Adapt an IField or IMethod. */ - interface Adapter - extends BinaryMember.Adapter { + interface AttributeAdapter + extends MemberAdapter { /** * Return the field or getter method's "attribute" name @@ -145,8 +137,8 @@ abstract class BinaryAttribute String getAttributeName(); /** - * Return the attribute's type signature. + * Return the attribute's type binding. */ - String getTypeSignature() throws JavaModelException; + ITypeBinding getTypeBinding(); } } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java index ef593f3abf..d432d067c2 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java @@ -22,6 +22,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; +import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; /** * binary enum @@ -30,29 +31,34 @@ final class BinaryEnum extends BinaryAbstractType implements JavaResourceEnum { - private final Vector<JavaResourceEnumConstant> enumConstants; + private final Vector<JavaResourceEnumConstant> enumConstants = new Vector<JavaResourceEnumConstant>(); // ********** construction/initialization ********** BinaryEnum(JavaResourceNode parent, IType type) { - super(parent, type); - this.enumConstants = this.buildEnumConstants(); + this(parent, new TypeAdapter(type)); + } + + private BinaryEnum(JavaResourceNode parent, TypeAdapter adapter) { + super(parent, adapter); + CollectionTools.addAll(this.enumConstants, buildEnumConstants()); } public Kind getKind() { return JavaResourceAnnotatedElement.Kind.ENUM; } - + public void synchronizeWith(EnumDeclaration enumDeclaration) { throw new UnsupportedOperationException(); } - + public void resolveTypes(EnumDeclaration enumDeclaration) { throw new UnsupportedOperationException(); } - + + // ********** overrides ********** @Override @@ -73,13 +79,13 @@ final class BinaryEnum return new LiveCloneIterable<JavaResourceEnumConstant>(this.enumConstants); } - private Vector<JavaResourceEnumConstant> buildEnumConstants() { - Iterable<IField> jdtEnumConstants = this.getEnumConstants(this.getMember()); - Vector<JavaResourceEnumConstant> result = new Vector<JavaResourceEnumConstant>(CollectionTools.size(jdtEnumConstants)); - for (IField jdtEnumConstant : jdtEnumConstants) { - result.add(this.buildEnumConstant(jdtEnumConstant)); - } - return result; + private Iterable<JavaResourceEnumConstant> buildEnumConstants() { + return new TransformationIterable<IField, JavaResourceEnumConstant>(getEnumConstants(getElement())) { + @Override + protected JavaResourceEnumConstant transform(IField field) { + return BinaryEnum.this.buildEnumConstant(field); + } + }; } private Iterable<IField> getEnumConstants(IType type) { @@ -94,7 +100,8 @@ final class BinaryEnum private IField[] getFields(IType type) { try { return type.getFields(); - } catch (JavaModelException ex) { + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return EMPTY_FIELD_ARRAY; } @@ -105,7 +112,8 @@ final class BinaryEnum private boolean isEnumConstant(IField field) { try { return field.isEnumConstant(); - } catch (JavaModelException ex) { + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java index 327212bb4b..6b14f51ec1 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java @@ -11,14 +11,10 @@ package org.eclipse.jpt.common.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin; import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum; import org.eclipse.jpt.common.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; /** * Java binary enum constant, IField that returns true to isEnumConstant @@ -27,17 +23,22 @@ final class BinaryEnumConstant extends BinaryMember implements JavaResourceEnumConstant { - - BinaryEnumConstant(JavaResourceEnum parent, IField enumConstant){ - super(parent, new EnumConstantAdapter(enumConstant)); + this(parent, new EnumConstantAdapter(enumConstant)); } - + + private BinaryEnumConstant(JavaResourceEnum parent, EnumConstantAdapter adapter) { + super(parent, adapter); + // put initialization here, if any becomes needed + } + + @Override - IField getMember() { - return (IField) super.getMember(); + protected IField getElement() { + return (IField) super.getElement(); } - + + // ******** JavaResourceAnnotatedElement implementation ******** public Kind getKind() { @@ -48,21 +49,22 @@ final class BinaryEnumConstant // ******** JavaResourceEnumConstant implementation ******** public String getName() { - return this.getMember().getElementName(); + return getElement().getElementName(); } - + public void synchronizeWith(EnumConstantDeclaration astEnumConstant) { throw new UnsupportedOperationException(); } - + public void resolveTypes(EnumConstantDeclaration astEnumConstant) { throw new UnsupportedOperationException(); } - + + // ********** IField adapter ********** - + static class EnumConstantAdapter - implements Adapter { + implements MemberAdapter { private final IField enumConstant; @@ -75,16 +77,6 @@ final class BinaryEnumConstant return this.enumConstant; } - public Iterable<ITypeParameter> getTypeParameters() { - try { - return new ArrayIterable<ITypeParameter>(this.enumConstant.getDeclaringType().getTypeParameters()); - } - catch (JavaModelException jme) { - JptCommonCorePlugin.instance().logError(jme); - } - return EmptyIterable.instance(); - } - public IAnnotation[] getAnnotations() throws JavaModelException { return this.enumConstant.getAnnotations(); } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java index 5d25eb7ec4..cb9f8d0301 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java @@ -11,18 +11,14 @@ package org.eclipse.jpt.common.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin; +import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; import org.eclipse.jpt.common.core.resource.java.JavaResourceField; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; /** * binary field @@ -32,7 +28,12 @@ final class BinaryField implements JavaResourceField { BinaryField(JavaResourceType parent, IField field) { - super(parent, new FieldAdapter(field)); + this(parent,new FieldAdapter(field)); + } + + private BinaryField(JavaResourceType parent, FieldAdapter adapter) { + super(parent, adapter); + // put initialization here, if any becomes needed } @@ -40,11 +41,6 @@ final class BinaryField return Kind.FIELD; } - @Override - protected ITypeBinding getJdtTypeBinding(IBinding jdtBinding) { - return ((IVariableBinding) jdtBinding).getType(); - } - public void synchronizeWith(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclaration) { throw new UnsupportedOperationException(); } @@ -59,27 +55,25 @@ final class BinaryField * IField adapter */ static class FieldAdapter - implements BinaryAttribute.Adapter { + implements AttributeAdapter { final IField field; + /* cached, but only during initialization */ + private final ITypeBinding typeBinding; + FieldAdapter(IField field) { super(); this.field = field; + this.typeBinding = createTypeBinding(field); } - public IField getElement() { - return this.field; + protected ITypeBinding createTypeBinding(IField field) { + return ((IVariableBinding) ASTTools.createBinding(field)).getType(); } - public Iterable<ITypeParameter> getTypeParameters() { - try { - return new ArrayIterable<ITypeParameter>(this.field.getDeclaringType().getTypeParameters()); - } - catch (JavaModelException jme) { - JptCommonCorePlugin.instance().logError(jme); - } - return EmptyIterable.instance(); + public IField getElement() { + return this.field; } public IAnnotation[] getAnnotations() throws JavaModelException { @@ -90,8 +84,8 @@ final class BinaryField return this.field.getElementName(); } - public String getTypeSignature() throws JavaModelException { - return this.field.getTypeSignature(); + public ITypeBinding getTypeBinding() { + return this.typeBinding; } } } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java index c2a078b92c..97f6846793 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java @@ -27,157 +27,147 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; * binary persistent member */ abstract class BinaryMember - extends BinaryAnnotatedElement - implements JavaResourceMember -{ - + extends BinaryAnnotatedElement + implements JavaResourceMember { + private boolean final_; // 'final' is a reserved word private boolean transient_; // 'transient' is a reserved word private boolean public_; // 'public' is a reserved word private boolean static_; // 'static' is a reserved word private boolean protected_; // 'protected' is a reserved word - - + + // ********** construction/initialization ********** - - public BinaryMember(JavaResourceNode parent, Adapter adapter) { + + public BinaryMember(JavaResourceNode parent, MemberAdapter adapter) { super(parent, adapter); - IMember member = adapter.getElement(); - this.final_ = this.buildFinal(member); - this.transient_ = this.buildTransient(member); - this.public_ = this.buildPublic(member); - this.static_ = this.buildStatic(member); - this.protected_ = this.buildProtected(member); + this.final_ = this.buildFinal(); + this.transient_ = this.buildTransient(); + this.public_ = this.buildPublic(); + this.static_ = this.buildStatic(); + this.protected_ = this.buildProtected(); } - + + // ********** updating ********** - + @Override public void update() { super.update(); - this.update(this.getMember()); - } - - protected void update(IMember member) { - this.setFinal(this.buildFinal(member)); - this.setTransient(this.buildTransient(member)); - this.setPublic(this.buildPublic(member)); - this.setStatic(this.buildStatic(member)); - this.setProtected(this.buildProtected(member)); + + updateFinal(); + updateTransient(); + updatePublic(); + updateStatic(); + updateProtected(); } - + + // ********** simple state ********** - + // ***** final public boolean isFinal() { return this.final_; } - - private void setFinal(boolean final_) { - boolean old = this.final_; - this.final_ = final_; - this.firePropertyChanged(FINAL_PROPERTY, old, final_); - } - - private boolean buildFinal(IMember member) { + + private boolean buildFinal() { try { - return Flags.isFinal(member.getFlags()); - } catch (JavaModelException ex) { + return Flags.isFinal(getElement().getFlags()); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } } - + + protected void updateFinal() { + throw new UnsupportedOperationException(); + } + // ***** transient public boolean isTransient() { return this.transient_; } - - private void setTransient(boolean transient_) { - boolean old = this.transient_; - this.transient_ = transient_; - this.firePropertyChanged(TRANSIENT_PROPERTY, old, transient_); - } - - private boolean buildTransient(IMember member) { + + private boolean buildTransient() { try { - return Flags.isTransient(member.getFlags()); - } catch (JavaModelException ex) { + return Flags.isTransient(getElement().getFlags()); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } } - + + protected void updateTransient() { + throw new UnsupportedOperationException(); + } + // ***** public public boolean isPublic() { return this.public_; } - - private void setPublic(boolean public_) { - boolean old = this.public_; - this.public_ = public_; - this.firePropertyChanged(PUBLIC_PROPERTY, old, public_); - } - - private boolean buildPublic(IMember member) { + + private boolean buildPublic() { try { - return Flags.isPublic(member.getFlags()); - } catch (JavaModelException ex) { + return Flags.isPublic(getElement().getFlags()); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } } - + + protected void updatePublic() { + throw new UnsupportedOperationException(); + } + // ***** static public boolean isStatic() { return this.static_; } - - private void setStatic(boolean static_) { - boolean old = this.static_; - this.static_ = static_; - this.firePropertyChanged(STATIC_PROPERTY, old, static_); - } - - private boolean buildStatic(IMember member) { + + private boolean buildStatic() { try { - return Flags.isStatic(member.getFlags()); - } catch (JavaModelException ex) { + return Flags.isStatic(getElement().getFlags()); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } } - + + protected void updateStatic() { + throw new UnsupportedOperationException(); + } + // ***** protected public boolean isProtected() { return this.protected_; } - - private void setProtected(boolean protected_) { - boolean old = this.protected_; - this.protected_ = protected_; - this.firePropertyChanged(PROTECTED_PROPERTY, old, protected_); - } - - private boolean buildProtected(IMember member) { + + private boolean buildProtected() { try { - return Flags.isProtected(member.getFlags()); - } catch (JavaModelException ex) { + return Flags.isProtected(getElement().getFlags()); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } } - - // ********** miscellaneous ********** - - IMember getMember() { - return this.getAdapter().getElement(); + + protected void updateProtected() { + throw new UnsupportedOperationException(); } - - private Adapter getAdapter() { - return (Adapter) this.adapter; + + + // ********** miscellaneous ********** + + @Override + protected IMember getElement() { + return (IMember) super.getElement(); } - + /** * Strip off the type signature's parameters if present. * Convert to a readable string. @@ -276,24 +266,24 @@ abstract class BinaryMember return this.isPublic() || this.isProtected(); } + // ********** IMember adapter ********** - - interface Adapter extends BinaryAnnotatedElement.Adapter { + + interface MemberAdapter extends BinaryAnnotatedElement.Adapter { + /** * Return the adapter's JDT member (IType, IField, IMethod). */ IMember getElement(); - - Iterable<ITypeParameter> getTypeParameters(); } - - + + // ********** unsupported JavaResourceMember implementation ********** - + public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) { throw new UnsupportedOperationException(); } - + public boolean isFor(String memberName, int occurrence) { throw new UnsupportedOperationException(); } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java index 54bcc7c335..d50b836cac 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java @@ -9,30 +9,27 @@ ******************************************************************************/ package org.eclipse.jpt.common.core.internal.resource.java.binary; -import java.util.ArrayList; -import java.util.List; import java.util.Vector; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.ILocalVariable; -import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin; +import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.utility.MethodSignature; +import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.NameTools; import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; +import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; /** * binary method @@ -47,105 +44,97 @@ final class BinaryMethod BinaryMethod(JavaResourceType parent, IMethod method) { - super(parent, new MethodAdapter(method)); + this(parent,new MethodAdapter(method)); } - public Kind getKind() { - return JavaResourceAnnotatedElement.Kind.METHOD; + private BinaryMethod(JavaResourceType parent, MethodAdapter adapter) { + super(parent, adapter); + this.constructor = buildConstructor(); + CollectionTools.addAll(this.parameterTypeNames, buildParameterTypeNames(adapter.getMethodBinding())); } - // ***** overrides ***** - - @Override - protected void update(IMember member) { - super.update(member); - this.setConstructor(this.buildConstructor((IMethod) member)); - this.setParameterTypeNames(this.buildParameterTypeNames((IMethod) member)); + public Kind getKind() { + return JavaResourceAnnotatedElement.Kind.METHOD; } public void synchronizeWith(MethodDeclaration methodDeclaration) { throw new UnsupportedOperationException(); } + + // ***** overrides ***** + @Override - IMethod getMember() { - return (IMethod) super.getMember(); + public void update() { + super.update(); + updateConstructor(); + updateParameterTypeNames(); } @Override - protected ITypeBinding getJdtTypeBinding(IBinding jdtBinding) { - // bug 381503 - if the binary method is a constructor, - // the jdtBinding will be a JavaResourceTypeBinding already - if (jdtBinding.getKind() == IBinding.TYPE) { - return (ITypeBinding) jdtBinding; - } - return ((IMethodBinding) jdtBinding).getReturnType(); + public IMethod getElement() { + return (IMethod) super.getElement(); } // ***** method name ***** public String getMethodName() { - return getMember().getElementName(); + return getElement().getElementName(); } - // ***** parameter type names ***** - - public ListIterable<String> getParameterTypeNames() { - return new LiveCloneListIterable<String>(this.parameterTypeNames); - } - - public String getParameterTypeName(int index) { - return this.parameterTypeNames.get(index); - } - - public int getParametersSize() { - return this.parameterTypeNames.size(); - } + // ***** constructor ***** - private List<String> buildParameterTypeNames(IMethod method) { - ArrayList<String> names = new ArrayList<String>(); - for (ILocalVariable parameter : this.getParameters(method)) { - names.add(parameter.getElementName());//TODO is this right? - } - return names; + public boolean isConstructor() { + return this.constructor; } - private ILocalVariable[] getParameters(IMethod jdtMethod) { + private boolean buildConstructor() { try { - return jdtMethod.getParameters(); - } catch (JavaModelException ex) { + return getElement().isConstructor(); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); - return null; + return false; } } - private void setParameterTypeNames(List<String> parameterTypeNames) { - this.synchronizeList(parameterTypeNames, this.parameterTypeNames, PARAMETER_TYPE_NAMES_LIST); + protected void updateConstructor() { + throw new UnsupportedOperationException(); } - // ***** constructor ***** + // ***** parameter type names ***** - public boolean isConstructor() { - return this.constructor; + public ListIterable<String> getParameterTypeNames() { + return new LiveCloneListIterable<String>(this.parameterTypeNames); } - private void setConstructor(boolean isConstructor) { - boolean old = this.constructor; - this.constructor = isConstructor; - this.firePropertyChanged(CONSTRUCTOR_PROPERTY, old, isConstructor); + public String getParameterTypeName(int index) { + return this.parameterTypeNames.get(index); } - private boolean buildConstructor(IMethod method) { - try { - return method.isConstructor(); - } catch (JavaModelException ex) { - JptCommonCorePlugin.instance().logError(ex); - return false; + public int getParametersSize() { + return this.parameterTypeNames.size(); + } + + private Iterable<String> buildParameterTypeNames(IMethodBinding binding) { + if (binding == null) { + return EmptyIterable.instance(); } + return new TransformationIterable<ITypeBinding, String>( + new ArrayIterable<ITypeBinding>(binding.getParameterTypes())) { + @Override + protected String transform(ITypeBinding parameterType) { + return parameterType.getTypeDeclaration().getQualifiedName(); + } + }; + } + + private void updateParameterTypeNames() { + throw new UnsupportedOperationException(); } @@ -162,30 +151,28 @@ final class BinaryMethod * IMethod adapter */ static class MethodAdapter - implements BinaryAttribute.Adapter { + implements AttributeAdapter { final IMethod method; + static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0]; + /* cached, but only during initialization */ + private final IBinding binding; + + MethodAdapter(IMethod method) { super(); this.method = method; + this.binding = createBinding(method); } - public IMethod getElement() { - return this.method; + protected IBinding createBinding(IMethod method) { + return ASTTools.createBinding(method); } - public Iterable<ITypeParameter> getTypeParameters() { - try { - return new CompositeIterable<ITypeParameter>( - new ArrayIterable<ITypeParameter>(this.method.getTypeParameters()), - new ArrayIterable<ITypeParameter>(this.method.getDeclaringType().getTypeParameters())); - } - catch (JavaModelException jme) { - JptCommonCorePlugin.instance().logError(jme); - } - return EmptyIterable.instance(); + public IMethod getElement() { + return this.method; } public IAnnotation[] getAnnotations() throws JavaModelException { @@ -196,8 +183,23 @@ final class BinaryMethod return NameTools.convertGetterSetterMethodNameToPropertyName(this.method.getElementName()); } - public String getTypeSignature() throws JavaModelException { - return this.method.getReturnType(); + /* NB - may return null */ + public IMethodBinding getMethodBinding() { + // bug 381503 - if the binary method is a constructor, + // the jdtBinding will be a JavaResourceTypeBinding already + if (this.binding.getKind() == IBinding.TYPE) { + return null; + } + return (IMethodBinding) binding; + } + + public ITypeBinding getTypeBinding() { + // bug 381503 - if the binary method is a constructor, + // the jdtBinding will be a JavaResourceTypeBinding already + if (this.binding.getKind() == IBinding.TYPE) { + return (ITypeBinding) binding; + } + return ((IMethodBinding) binding).getReturnType(); } } } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java index 579a2d2ac7..a5652f2127 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java @@ -9,12 +9,12 @@ ******************************************************************************/ package org.eclipse.jpt.common.core.internal.resource.java.binary; +import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import java.util.Vector; import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; @@ -25,7 +25,6 @@ import org.eclipse.jdt.core.dom.Modifier; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin; import org.eclipse.jpt.common.core.internal.resource.java.InheritedAttributeKey; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; import org.eclipse.jpt.common.core.internal.utility.jdt.JavaResourceTypeBinding; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; @@ -36,8 +35,10 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; +import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; /** * binary type @@ -54,29 +55,33 @@ final class BinaryType private boolean hasPrivateNoArgConstructor; - private final Vector<JavaResourceField> fields; + private final Vector<JavaResourceField> fields = new Vector<JavaResourceField>(); - private final Vector<JavaResourceMethod> methods; + private final Vector<JavaResourceMethod> methods = new Vector<JavaResourceMethod>(); - private final Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedFieldTypes; + private final Hashtable<InheritedAttributeKey, JavaResourceTypeBinding> inheritedFieldTypes + = new Hashtable<InheritedAttributeKey, JavaResourceTypeBinding>(); - private final Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedMethodTypes; + private final Hashtable<InheritedAttributeKey, JavaResourceTypeBinding> inheritedMethodTypes + = new Hashtable<InheritedAttributeKey, JavaResourceTypeBinding>(); // ***** construction/initialization ***** BinaryType(JavaResourceNode parent, IType type) { - super(parent, type); - this.superclassQualifiedName = buildSuperclassQualifiedName(type); - this.abstract_ = buildAbstract(type); - this.hasNoArgConstructor = buildHasNoArgConstructor(type); - this.hasPrivateNoArgConstructor = buildHasPrivateNoArgConstructor(type); - this.fields = buildFields(type); - this.methods = buildMethods(type); - - ITypeBinding typeBinding = (ITypeBinding) ASTTools.createBinding(type); - this.inheritedFieldTypes = buildInheritedFieldTypes(typeBinding); - this.inheritedMethodTypes = buildInheritedMethodTypes(typeBinding); + this(parent, new TypeAdapter(type)); + } + + private BinaryType(JavaResourceNode parent, TypeAdapter adapter) { + super(parent, adapter); + this.superclassQualifiedName = buildSuperclassQualifiedName(); + this.abstract_ = buildAbstract(); + this.hasNoArgConstructor = buildHasNoArgConstructor(); + this.hasPrivateNoArgConstructor = buildHasPrivateNoArgConstructor(); + CollectionTools.addAll(this.fields, buildFields()); + CollectionTools.addAll(this.methods, buildMethods()); + this.inheritedFieldTypes.putAll(buildInheritedFieldTypes(adapter.getTypeBinding())); + this.inheritedMethodTypes.putAll(buildInheritedMethodTypes(adapter.getTypeBinding())); } @@ -88,94 +93,84 @@ final class BinaryType // ***** overrides ***** @Override - protected void update(IMember member) { - super.update(member); - this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName((IType) member)); - this.setAbstract(this.buildAbstract((IType) member)); - this.setHasNoArgConstructor(this.buildHasNoArgConstructor((IType) member)); - this.setHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor((IType) member)); - this.updateFields((IType) member); - this.updateMethods((IType) member); - } - - // TODO - private void updateFields(IType type) { - throw new UnsupportedOperationException(); - } - - // TODO - private void updateMethods(IType type) { - throw new UnsupportedOperationException(); + public void update() { + super.update(); + updateSuperclassQualifiedName(); + updateAbstract(); + updateHasNoArgConstructor(); + updateHasPrivateNoArgConstructor(); + updateFields(); + updateMethods(); + updateInheritedFieldTypes(); + updateInheritedMethodTypes(); } // ********** JavaResourceType implementation ********** - + public void synchronizeWith(TypeDeclaration typeDeclaration) { throw new UnsupportedOperationException(); } - + public void resolveTypes(TypeDeclaration typeDeclaration) { throw new UnsupportedOperationException(); } - - // ***** superclass qualified name + + + // ***** superclass qualified name ***** + public String getSuperclassQualifiedName() { return this.superclassQualifiedName; } - private void setSuperclassQualifiedName(String superclassQualifiedName) { - String old = this.superclassQualifiedName; - this.superclassQualifiedName = superclassQualifiedName; - this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName); - } - - private String buildSuperclassQualifiedName(IType type) { - return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature(type)); + private String buildSuperclassQualifiedName() { + return convertTypeSignatureToTypeName(getSuperclassTypeSignature(getElement())); } private String getSuperclassTypeSignature(IType type) { try { return type.getSuperclassTypeSignature(); - } catch (JavaModelException ex) { + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return null; } } - // ***** abstract - public boolean isAbstract() { - return this.abstract_; + protected void updateSuperclassQualifiedName() { + throw new UnsupportedOperationException(); } - private void setAbstract(boolean abstract_) { - boolean old = this.abstract_; - this.abstract_ = abstract_; - this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_); + + // ***** abstract ***** + + public boolean isAbstract() { + return this.abstract_; } - private boolean buildAbstract(IType type) { + private boolean buildAbstract() { try { - return Flags.isAbstract(type.getFlags()); - } catch (JavaModelException ex) { + return Flags.isAbstract(getElement().getFlags()); + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return false; } } - // ***** no-arg constructor - public boolean hasNoArgConstructor() { - return this.hasNoArgConstructor; + protected void updateAbstract() { + throw new UnsupportedOperationException(); } - private void setHasNoArgConstructor(boolean hasNoArgConstructor) { - boolean old = this.hasNoArgConstructor; - this.hasNoArgConstructor = hasNoArgConstructor; - this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor); + + // ***** no-arg constructor ***** + + public boolean hasNoArgConstructor() { + return this.hasNoArgConstructor; } - private boolean buildHasNoArgConstructor(IType type) { - return this.findNoArgConstructor(type) != null; + private boolean buildHasNoArgConstructor() { + return this.findNoArgConstructor(getElement()) != null; } private IMethod findNoArgConstructor(IType type) { @@ -192,19 +187,19 @@ final class BinaryType return null; } - // ***** private no-arg constructor - public boolean hasPrivateNoArgConstructor() { - return this.hasPrivateNoArgConstructor; + protected void updateHasNoArgConstructor() { + throw new UnsupportedOperationException(); } - private void setHasPrivateNoArgConstructor(boolean hasPrivateNoArgConstructor) { - boolean old = this.hasPrivateNoArgConstructor; - this.hasPrivateNoArgConstructor = hasPrivateNoArgConstructor; - this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, hasPrivateNoArgConstructor); + + // ***** private no-arg constructor ***** + + public boolean hasPrivateNoArgConstructor() { + return this.hasPrivateNoArgConstructor; } - private boolean buildHasPrivateNoArgConstructor(IType type) { - IMethod method = this.findNoArgConstructor(type); + private boolean buildHasPrivateNoArgConstructor() { + IMethod method = this.findNoArgConstructor(getElement()); try { return method != null && Flags.isPrivate(method.getFlags()); } @@ -214,6 +209,10 @@ final class BinaryType } } + protected void updateHasPrivateNoArgConstructor() { + throw new UnsupportedOperationException(); + } + // ***** public/protected no-arg constructor ***** @@ -254,89 +253,27 @@ final class BinaryType } - // ***** misc ***** - - public boolean hasAnyAnnotatedFields() { - for (JavaResourceField field : this.getFields()) { - if (field.isAnnotated()) { - return true; - } - } - return false; - } - - public boolean hasAnyAnnotatedMethods() { - for (JavaResourceMethod method : this.getMethods()) { - if (method.isAnnotated()) { - return true; - } - } - return false; - } - - @Override - public IType getMember() { - return super.getMember(); - } - - // Two more requirements for a valid equals() method: - // 1. It should be public - // 2. The return type should be boolean - // Both requirements are validated by the compiler so they are excluded here - public boolean hasEqualsMethod() { - for (JavaResourceMethod method : this.getMethods()) { - if (StringTools.stringsAreEqual(method.getMethodName(), "equals") //$NON-NLS-1$ - && method.getParametersSize() == 1 - && StringTools.stringsAreEqual(method.getParameterTypeName(0), Object.class.getName())) { - return true; - } - } - return false; - } - - // Two more requirements for a valid hashCode() method: - // 1. It should be public - // 2. The return type should be int - // Both requirements are validated by the compiler so they are excluded here - public boolean hasHashCodeMethod() { - for (JavaResourceMethod method : this.getMethods()) { - if (StringTools.stringsAreEqual(method.getMethodName(), "hashCode") //$NON-NLS-1$ - && method.getParametersSize() == 0) { - return true; - } - } - return false; - } - - public JavaResourceMethod getMethod(String propertyName) { - for (JavaResourceMethod method : this.getMethods()) { - if (StringTools.stringsAreEqual(method.getMethodName(), propertyName)) { - return method; - } - } - return null; - } - - // ***** fields ***** public Iterable<JavaResourceField> getFields() { return new LiveCloneIterable<JavaResourceField>(this.fields); } - private Vector<JavaResourceField> buildFields(IType type) { - IField[] jdtFields = this.getFields(type); - Vector<JavaResourceField> result = new Vector<JavaResourceField>(jdtFields.length); - for (IField jdtField : jdtFields) { - result.add(this.buildField(jdtField)); - } - return result; + private Iterable<JavaResourceField> buildFields() { + return new TransformationIterable<IField, JavaResourceField>( + new ArrayIterable<IField>(getFields(getElement()))) { + @Override + protected JavaResourceField transform(IField field) { + return buildField(field); + } + }; } private IField[] getFields(IType type) { try { return type.getFields(); - } catch (JavaModelException ex) { + } + catch (JavaModelException ex) { JptCommonCorePlugin.instance().logError(ex); return EMPTY_FIELD_ARRAY; } @@ -348,6 +285,19 @@ final class BinaryType return new BinaryField(this, jdtField); } + protected void updateFields() { + throw new UnsupportedOperationException(); + } + + public JavaResourceField getField(String name) { + for (JavaResourceField field : getFields()) { + if (StringTools.stringsAreEqual(field.getName(), name)) { + return field; + } + } + return null; + } + // ***** methods ***** @@ -355,13 +305,14 @@ final class BinaryType return new LiveCloneIterable<JavaResourceMethod>(this.methods); } - private Vector<JavaResourceMethod> buildMethods(IType type) { - IMethod[] jdtMethods = this.getMethods(type); - Vector<JavaResourceMethod> result = new Vector<JavaResourceMethod>(jdtMethods.length); - for (IMethod jdtMethod : jdtMethods) { - result.add(this.buildMethod(jdtMethod)); - } - return result; + private Iterable<JavaResourceMethod> buildMethods() { + return new TransformationIterable<IMethod, JavaResourceMethod>( + new ArrayIterable<IMethod>(getMethods(getElement()))) { + @Override + protected JavaResourceMethod transform(IMethod method) { + return buildMethod(method); + } + }; } private IMethod[] getMethods(IType type) { @@ -379,13 +330,26 @@ final class BinaryType return new BinaryMethod(this, jdtMethod); } + protected void updateMethods() { + throw new UnsupportedOperationException(); + } + + public JavaResourceMethod getMethod(String propertyName) { + for (JavaResourceMethod method : this.getMethods()) { + if (StringTools.stringsAreEqual(method.getMethodName(), propertyName)) { + return method; + } + } + return null; + } + // ***** inherited field/method types ***** private Map<InheritedAttributeKey, JavaResourceTypeBinding> buildInheritedFieldTypes(ITypeBinding typeBinding) { - Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedFieldTypes = new Hashtable<InheritedAttributeKey, JavaResourceTypeBinding>(); + Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedFieldTypes = new HashMap<InheritedAttributeKey, JavaResourceTypeBinding>(); ITypeBinding scTypeBinding = typeBinding.getSuperclass(); - while (scTypeBinding != null && ! scTypeBinding.isParameterizedType()) { + while (scTypeBinding != null && scTypeBinding.isParameterizedType()) { // if the superclass is not parameterized, // then this class will have no increased type information for inherited fields buildInheritedFieldTypes_(inheritedFieldTypes, scTypeBinding); @@ -396,7 +360,7 @@ final class BinaryType private void buildInheritedFieldTypes_( Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedFieldTypes, ITypeBinding typeBinding) { - String typeName = typeBinding.getQualifiedName(); + String typeName = typeBinding.getTypeDeclaration().getQualifiedName(); IVariableBinding[] fields = typeBinding.getDeclaredFields(); for (IVariableBinding field : fields) { String fieldName = field.getName(); @@ -404,10 +368,14 @@ final class BinaryType } } + protected void updateInheritedFieldTypes() { + throw new UnsupportedOperationException(); + } + private Map<InheritedAttributeKey, JavaResourceTypeBinding> buildInheritedMethodTypes(ITypeBinding typeBinding) { - Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedMethodTypes = new Hashtable<InheritedAttributeKey, JavaResourceTypeBinding>(); + Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedMethodTypes = new HashMap<InheritedAttributeKey, JavaResourceTypeBinding>(); ITypeBinding scTypeBinding = typeBinding.getSuperclass(); - while (scTypeBinding != null && ! scTypeBinding.isParameterizedType()) { + while (scTypeBinding != null && scTypeBinding.isParameterizedType()) { // if the superclass is not parameterized, // then this class will have no increased type information for inherited fields buildInheritedMethodTypes_(inheritedMethodTypes, scTypeBinding); @@ -418,7 +386,7 @@ final class BinaryType private void buildInheritedMethodTypes_( Map<InheritedAttributeKey, JavaResourceTypeBinding> inheritedFieldTypes, ITypeBinding typeBinding) { - String typeName = typeBinding.getQualifiedName(); + String typeName = typeBinding.getTypeDeclaration().getQualifiedName(); IMethodBinding[] methods = typeBinding.getDeclaredMethods(); for (IMethodBinding method : methods) { String methodName = method.getName(); @@ -426,11 +394,15 @@ final class BinaryType } } - public TypeBinding getInheritedAttributeTypeBinding(JavaResourceAttribute attribute) { + protected void updateInheritedMethodTypes() { + throw new UnsupportedOperationException(); + } + + public TypeBinding getAttributeTypeBinding(JavaResourceAttribute attribute) { if (attribute.getParent() == this) { return attribute.getTypeBinding(); } - InheritedAttributeKey key = new InheritedAttributeKey(attribute.getParent().getName(), attribute.getName()); + InheritedAttributeKey key = new InheritedAttributeKey(attribute.getParent().getTypeBinding().getQualifiedName(), attribute.getName()); if (attribute.getKind() == JavaResourceAnnotatedElement.Kind.FIELD) { return this.inheritedFieldTypes.get(key); } @@ -438,4 +410,54 @@ final class BinaryType return this.inheritedMethodTypes.get(key); } } + + + // ***** misc ***** + + public boolean hasAnyAnnotatedFields() { + for (JavaResourceField field : this.getFields()) { + if (field.isAnnotated()) { + return true; + } + } + return false; + } + + public boolean hasAnyAnnotatedMethods() { + for (JavaResourceMethod method : this.getMethods()) { + if (method.isAnnotated()) { + return true; + } + } + return false; + } + + // Two more requirements for a valid equals() method: + // 1. It should be public + // 2. The return type should be boolean + // Both requirements are validated by the compiler so they are excluded here + public boolean hasEqualsMethod() { + for (JavaResourceMethod method : this.getMethods()) { + if (StringTools.stringsAreEqual(method.getMethodName(), "equals") //$NON-NLS-1$ + && method.getParametersSize() == 1 + && StringTools.stringsAreEqual(method.getParameterTypeName(0), Object.class.getName())) { + return true; + } + } + return false; + } + + // Two more requirements for a valid hashCode() method: + // 1. It should be public + // 2. The return type should be int + // Both requirements are validated by the compiler so they are excluded here + public boolean hasHashCodeMethod() { + for (JavaResourceMethod method : this.getMethods()) { + if (StringTools.stringsAreEqual(method.getMethodName(), "hashCode") //$NON-NLS-1$ + && method.getParametersSize() == 0) { + return true; + } + } + return false; + } } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java index b9db3dbaaf..f3d8958616 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java @@ -524,6 +524,15 @@ final class SourceType this, this.annotatedElement, fieldName, occurrence, getJavaResourceCompilationUnit(), fieldDeclaration, variableDeclaration); } + + public JavaResourceField getField(String name) { + for (JavaResourceField field : getFields()) { + if (StringTools.stringsAreEqual(field.getName(), name)) { + return field; + } + } + return null; + } // minimize scope of suppressed warnings @SuppressWarnings("unchecked") @@ -587,6 +596,15 @@ final class SourceType private JavaResourceMethod buildMethod(MethodSignature signature, int occurrence, MethodDeclaration methodDeclaration) { return SourceMethod.newInstance(this, this.annotatedElement, signature, occurrence, this.getJavaResourceCompilationUnit(), methodDeclaration); } + + public JavaResourceMethod getMethod(String propertyName) { + for (JavaResourceMethod method : this.getMethods()) { + if (StringTools.stringsAreEqual(method.getMethodName(), propertyName)) { + return method; + } + } + return null; + } public boolean hasAnyAnnotatedFields() { @@ -636,21 +654,12 @@ final class SourceType return false; } - public JavaResourceMethod getMethod(String propertyName) { - for (JavaResourceMethod method : this.getMethods()) { - if (StringTools.stringsAreEqual(method.getMethodName(), propertyName)) { - return method; - } - } - return null; - } - // ***** inherited field/method types ***** private void initInheritedFieldTypes(ITypeBinding typeBinding) { ITypeBinding scTypeBinding = typeBinding.getSuperclass(); - while (scTypeBinding != null && ! scTypeBinding.isParameterizedType()) { + while (scTypeBinding != null && scTypeBinding.isParameterizedType()) { // if the superclass is not parameterized, // then this class will have no increased type information for inherited fields initInheritedFieldTypes_(scTypeBinding); @@ -660,7 +669,7 @@ final class SourceType } private void initInheritedFieldTypes_(ITypeBinding typeBinding) { - String typeName = typeBinding.getQualifiedName(); + String typeName = typeBinding.getTypeDeclaration().getQualifiedName(); IVariableBinding[] fields = typeBinding.getDeclaredFields(); CounterMap counters = new CounterMap(fields.length); for (IVariableBinding field : fields) { @@ -676,7 +685,7 @@ final class SourceType ITypeBinding scTypeBinding = typeBinding.getSuperclass(); Map<InheritedAttributeKey, JavaResourceTypeBinding> removedTypes = new HashMap<InheritedAttributeKey, JavaResourceTypeBinding>(this.inheritedFieldTypes); - while (scTypeBinding != null && ! scTypeBinding.isParameterizedType()) { + while (scTypeBinding != null && scTypeBinding.isParameterizedType()) { // if the superclass is not parameterized, // then this class will have no increased type information for inherited fields syncInheritedFieldTypes_(scTypeBinding, removedTypes); @@ -688,7 +697,7 @@ final class SourceType } private void syncInheritedFieldTypes_(ITypeBinding typeBinding, Map<InheritedAttributeKey, JavaResourceTypeBinding> removedTypes) { - String typeName = typeBinding.getQualifiedName(); + String typeName = typeBinding.getTypeDeclaration().getQualifiedName(); IVariableBinding[] fields = typeBinding.getDeclaredFields(); CounterMap counters = new CounterMap(fields.length); for (IVariableBinding field : fields) { @@ -704,7 +713,7 @@ final class SourceType private void initInheritedMethodTypes(ITypeBinding typeBinding) { ITypeBinding scTypeBinding = typeBinding.getSuperclass(); - while (scTypeBinding != null && ! scTypeBinding.isParameterizedType()) { + while (scTypeBinding != null && scTypeBinding.isParameterizedType()) { // if the superclass is not parameterized, // then this class will have no increased type information for inherited fields initInheritedMethodTypes_(scTypeBinding); @@ -717,7 +726,7 @@ final class SourceType // as determining whether a method overrides another can be a bit tricky with generics, // and in general, we are only really interested in types of "get" methods, // which have no parameters - String typeName = typeBinding.getQualifiedName(); + String typeName = typeBinding.getTypeDeclaration().getQualifiedName(); IMethodBinding[] methods = typeBinding.getDeclaredMethods(); CounterMap counters = new CounterMap(methods.length); for (IMethodBinding method : methods) { @@ -735,7 +744,7 @@ final class SourceType ITypeBinding scTypeBinding = typeBinding.getSuperclass(); Map<InheritedAttributeKey, JavaResourceTypeBinding> removedTypes = new HashMap<InheritedAttributeKey, JavaResourceTypeBinding>(this.inheritedMethodTypes); - while (scTypeBinding != null && ! scTypeBinding.isParameterizedType()) { + while (scTypeBinding != null && scTypeBinding.isParameterizedType()) { // if the superclass is not parameterized, // then this class will have no increased type information for inherited fields syncInheritedMethodTypes_(scTypeBinding, removedTypes); @@ -751,7 +760,7 @@ final class SourceType // as determining whether a method overrides another can be a bit tricky with generics, // and in general, we are only really interested in types of "get" methods, // which have no parameters - String typeName = typeBinding.getQualifiedName(); + String typeName = typeBinding.getTypeDeclaration().getQualifiedName(); IMethodBinding[] methods = typeBinding.getDeclaredMethods(); CounterMap counters = new CounterMap(methods.length); for (IMethodBinding method : methods) { @@ -765,12 +774,12 @@ final class SourceType } } - public TypeBinding getInheritedAttributeTypeBinding(JavaResourceAttribute attribute) { + public TypeBinding getAttributeTypeBinding(JavaResourceAttribute attribute) { if (attribute.getParent() == this) { return attribute.getTypeBinding(); } InheritedAttributeKey key = - new InheritedAttributeKey(attribute.getParent().getName(), attribute.getName()); + new InheritedAttributeKey(attribute.getParent().getTypeBinding().getQualifiedName(), attribute.getName()); if (attribute.getKind() == JavaResourceAnnotatedElement.Kind.FIELD) { return this.inheritedFieldTypes.get(key); } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java index 1ef51eba1f..17a38b80dc 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceType.java @@ -107,6 +107,7 @@ public interface JavaResourceType Iterable<JavaResourceField> getFields(); String FIELDS_COLLECTION = "fields"; //$NON-NLS-1$ + JavaResourceField getField(String name); // ********** methods ********** @@ -124,7 +125,10 @@ public interface JavaResourceType /** * Return a {@link TypeBinding} for the given attribute, whether that attribute * is owned directly by this type or this type has specific inherited type information - * for it. (This type may constrain the generic type of the attribute from a superclass.) + * for it (i.e. this type has constrained the generic type of the attribute from a superclass.) + * NB: a return value of null does not mean that the attribute does not exist within the scope + * of this type. It simply means that this type has no more information than the superclass + * has, and the superclass should be checked for this information. */ - TypeBinding getInheritedAttributeTypeBinding(JavaResourceAttribute attribute); + TypeBinding getAttributeTypeBinding(JavaResourceAttribute attribute); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java index 49a84dd983..e9cc7016f6 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java @@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.core.context; import java.util.List; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; import org.eclipse.jpt.jpa.core.JpaStructureNode; import org.eclipse.wst.validation.internal.provisional.core.IMessage; @@ -111,7 +112,7 @@ public interface PersistentType /** * Return qualified type name of given attribute within the context of this type. */ - String getAttributeTypeName(ReadOnlyPersistentAttribute attribute); + TypeBinding getAttributeTypeBinding(ReadOnlyPersistentAttribute attribute); // ********** inheritance ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java index 2684868df6..b92a74923c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java @@ -25,8 +25,8 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; * @since ... a while? */ public interface ReadOnlyPersistentAttribute - extends JpaContextNode, JpaStructureNode, ReadOnlyAccessHolder -{ + extends JpaContextNode, JpaStructureNode, ReadOnlyAccessHolder { + // ********** name ********** String getName(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java index 334046478b..075af3cd83 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java @@ -19,6 +19,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceField; import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot; import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.Filter; import org.eclipse.jpt.common.utility.internal.ClassName; import org.eclipse.jpt.common.utility.internal.ReflectionTools; @@ -586,9 +587,9 @@ public abstract class AbstractJavaPersistentAttribute if (contextType == getParent()) { return getTypeName(); } - String typeName = contextType.getAttributeTypeName(this); - if (typeName != null) { - return typeName; + TypeBinding typeBinding = contextType.getAttributeTypeBinding(this); + if (typeBinding != null) { + return typeBinding.getQualifiedName(); } contextType = contextType.getSuperPersistentType(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java index 9fb69db125..e5ab9be8d6 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java @@ -895,9 +895,13 @@ public abstract class AbstractJavaPersistentType @Override protected JavaResourceType nextLink(JavaResourceType currentLink) { visitedResourceTypes.add(currentLink); + String superclassName = currentLink.getSuperclassQualifiedName(); + if (superclassName == null) { + return null; + } JavaResourceType nextLink = (JavaResourceType) AbstractJavaPersistentType.this.getJpaProject().getJavaResourceType( - currentLink.getSuperclassQualifiedName(), + superclassName, JavaResourceAbstractType.Kind.TYPE); if (nextLink == null || visitedResourceTypes.contains(nextLink)) { return null; @@ -907,16 +911,16 @@ public abstract class AbstractJavaPersistentType }; } - public String getAttributeTypeName(ReadOnlyPersistentAttribute attribute) { + public TypeBinding getAttributeTypeBinding(ReadOnlyPersistentAttribute attribute) { JavaResourceAttribute resourceAttribute = attribute.getJavaPersistentAttribute().getResourceAttribute(); if (resourceAttribute == null) { return null; } for (JavaResourceType resourceType : getResourceInheritanceHierarchy()) { - TypeBinding attributeType = resourceType.getInheritedAttributeTypeBinding(resourceAttribute); + TypeBinding attributeType = resourceType.getAttributeTypeBinding(resourceAttribute); if (attributeType != null) { - return attributeType.getQualifiedName(); + return attributeType; } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java index 8ad13d9f53..0ca2b5295d 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java @@ -185,7 +185,7 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping> protected String buildDefaultAttributeType() { return (this.getJavaPersistentAttribute() == null) ? null : - this.getJavaPersistentAttribute().getTypeName(); + this.getJavaPersistentAttribute().getTypeName(getTypeMapping().getPersistentType()); } protected PersistentType getResolvedAttributeType() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java index e4e0a55e9c..47dc36ef6c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java @@ -18,6 +18,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceField; import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.Filter; import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; import org.eclipse.jpt.jpa.core.JpaStructureNode; @@ -580,9 +581,9 @@ public abstract class SpecifiedOrmPersistentAttribute if (contextType == getParent()) { return getTypeName(); } - String typeName = contextType.getAttributeTypeName(this); - if (typeName != null) { - return typeName; + TypeBinding typeBinding = contextType.getAttributeTypeBinding(this); + if (typeBinding != null) { + return typeBinding.getQualifiedName(); } contextType = contextType.getSuperPersistentType(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java index 65b807836e..8031f77434 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java @@ -25,6 +25,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.core.utility.BodySourceWriter; import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.Filter; import org.eclipse.jpt.common.utility.internal.ClassName; import org.eclipse.jpt.common.utility.internal.CollectionTools; @@ -420,8 +421,8 @@ public abstract class SpecifiedOrmPersistentType }; } - public String getAttributeTypeName(ReadOnlyPersistentAttribute attribute) { - return (this.javaPersistentType == null) ? null : this.javaPersistentType.getAttributeTypeName(attribute); + public TypeBinding getAttributeTypeBinding(ReadOnlyPersistentAttribute attribute) { + return (this.javaPersistentType == null) ? null : this.javaPersistentType.getAttributeTypeBinding(attribute); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java index 90f592123a..060ceec39f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java @@ -14,6 +14,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.resource.java.JavaResourceField; import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; import org.eclipse.jpt.jpa.core.JpaStructureNode; @@ -378,9 +379,9 @@ public class VirtualOrmPersistentAttribute if (contextType == getParent()) { return getTypeName(); } - String typeName = contextType.getAttributeTypeName(this); - if (typeName != null) { - return typeName; + TypeBinding typeBinding = contextType.getAttributeTypeBinding(this); + if (typeBinding != null) { + return typeBinding.getQualifiedName(); } contextType = contextType.getSuperPersistentType(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java index 0d06c2fda6..7d9605e3b8 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java @@ -204,7 +204,7 @@ public abstract class AbstractPrimaryKeyValidator } // the matching attribute's type should agree - String idClassAttributeTypeName = idClassAttribute.getTypeName(); + String idClassAttributeTypeName = idClassAttribute.getTypeName(idClass); String attributeMappingTypeName = getTypeNameForIdClass(attributeMapping); if (attributeMappingTypeName != null // if it's null, there should be // another failing validation elsewhere @@ -448,11 +448,11 @@ public abstract class AbstractPrimaryKeyValidator } EmbeddedIdMapping embeddedId = getEmbeddedIdMapping(typeMapping); if (embeddedId != null) { - return embeddedId.getPersistentAttribute().getTypeName(); + return embeddedId.getPersistentAttribute().getTypeName(typeMapping.getPersistentType()); } IdMapping id = getIdMapping(typeMapping); if (id != null) { - return id.getPersistentAttribute().getTypeName(); + return id.getPersistentAttribute().getTypeName(typeMapping.getPersistentType()); } return null; } @@ -757,7 +757,7 @@ public abstract class AbstractPrimaryKeyValidator protected String getTypeNameForIdClass(AttributeMapping attributeMapping) { String mappingKey = attributeMapping.getKey(); if (CollectionTools.contains(this.getIdMappingKeys(), mappingKey)) { - return attributeMapping.getPersistentAttribute().getTypeName(); + return attributeMapping.getPersistentAttribute().getTypeName(typeMapping().getPersistentType()); } if (CollectionTools.contains(this.getSingleRelationshipMappingKeys(), mappingKey)) { SingleRelationshipMapping2_0 relationshipMapping = (SingleRelationshipMapping2_0) attributeMapping; diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java index 5b0ce1bb7a..3dda610481 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java @@ -11,8 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; import java.util.List; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaPlatform.Version; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; @@ -29,7 +28,6 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistent import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmTypeMapping; import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_1JpaPlatformFactory; import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion; -import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethodsHolder; @@ -174,12 +172,12 @@ public class EclipseLinkOrmPersistentTypeImpl } @Override - public String getAttributeTypeName(ReadOnlyPersistentAttribute attribute) { + public TypeBinding getAttributeTypeBinding(ReadOnlyPersistentAttribute attribute) { if (isDynamic()) { PersistentType superPersistentType = getSuperPersistentType(); - return (superPersistentType == null) ? null : superPersistentType.getAttributeTypeName(attribute); + return (superPersistentType == null) ? null : superPersistentType.getAttributeTypeBinding(attribute); } - return super.getAttributeTypeName(attribute); + return super.getAttributeTypeBinding(attribute); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java index 6162ce8504..2b687ad899 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java @@ -93,13 +93,13 @@ public class VirtualJavaPersistentAttribute } public String getTypeName() { - // virtual java attributes have no type - return null; + String typeName = this.xmlAttributeMapping.getAttributeType(); + return typeName == null ? null : this.getEntityMappings().getFullyQualifiedName(typeName); } public String getTypeName(PersistentType contextType) { - // virtual java attributes have no type - return null; + // only ever has its specified type name + return getTypeName(); } public boolean typeIsBasic() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java index 12d76ee6f1..dceae9c072 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java @@ -21,6 +21,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.core.utility.BodySourceWriter; import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.core.utility.jdt.TypeBinding; import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable; @@ -231,7 +232,7 @@ public class VirtualJavaPersistentType return null; } - public String getAttributeTypeName(ReadOnlyPersistentAttribute attribute) { + public TypeBinding getAttributeTypeBinding(ReadOnlyPersistentAttribute attribute) { return null; } |