return new File(root, str.substring(0, index));
}
+ /** Returns the packagename - if its the default package we return an empty string
+ */
public String getPackageName() {
if (packageName!=null) return packageName;
String str = getInternalClassName();
- int index= str.lastIndexOf("/");
- if (index==-1) return str;
+ int index = str.indexOf("<");
+ if (index!=-1) str = str.substring(0,index); // strip off the generics guff
+ index= str.lastIndexOf("/");
+ if (index==-1) return "";
return str.substring(0,index).replace('/','.');
}
return myGen.getFields();
}
+ public Field getField(String name) {
+ Field[] allFields = myGen.getFields();
+ if (allFields==null) return null;
+ for (int i = 0; i < allFields.length; i++) {
+ Field field = allFields[i];
+ if (field.getName().equals(name)) return field;
+ }
+ return null;
+ }
+
// FIXME asc How do the ones on the underlying class surface if this just returns new ones added?
// FIXME asc ...although no one calls this right now !
public List getAnnotations() {
warnOnAddedInterface(typeX.getName(),sourceLocation);
}
- public void setSuperClass(UnresolvedType typeX) {
+ public void setSuperClass(ResolvedType typeX) {
regenerateGenericSignatureAttribute = true;
- myGen.setSuperclassName(typeX.getName());
+ myType.addParent(typeX); // used for the attribute
+ if (typeX.getGenericType()!=null) typeX = typeX.getGenericType();
+ myGen.setSuperclassName(typeX.getName()); // used in the real class data
}
public String getSuperClassname() {
return myGen.getSuperclassName();
}
+
+ // FIXME asc not great that some of these ask the gen and some ask the type ! (see the related setters too)
+ public ResolvedType getSuperClass() {
+ return myType.getSuperclass();
+ }
public String[] getInterfaceNames() {
return myGen.getInterfaceNames();
return null;
}
+
public void forcePublic() {
myGen.setAccessFlags(Utility.makePublic(myGen.getAccessFlags()));
}
return false;
}
+
}