зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1049105: Make annotation processor compile with Xlint:all r=kats
This commit is contained in:
Родитель
40a0c89526
Коммит
d9eab8b56d
|
@ -209,7 +209,7 @@ public class CodeGenerator {
|
||||||
|
|
||||||
public void generateConstructor(AnnotatableEntity aCtorTuple) {
|
public void generateConstructor(AnnotatableEntity aCtorTuple) {
|
||||||
// Unpack the tuple and extract some useful fields from the Method..
|
// Unpack the tuple and extract some useful fields from the Method..
|
||||||
Constructor theCtor = aCtorTuple.getConstructor();
|
Constructor<?> theCtor = aCtorTuple.getConstructor();
|
||||||
String CMethodName = mCClassName;
|
String CMethodName = mCClassName;
|
||||||
|
|
||||||
generateMemberCommon(theCtor, mCClassName, mClassToWrap);
|
generateMemberCommon(theCtor, mCClassName, mClassToWrap);
|
||||||
|
@ -295,7 +295,7 @@ public class CodeGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
Method m;
|
Method m;
|
||||||
Constructor c;
|
Constructor<?> c;
|
||||||
|
|
||||||
Class<?> returnType;
|
Class<?> returnType;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ public class CodeGenerator {
|
||||||
returnType = m.getReturnType();
|
returnType = m.getReturnType();
|
||||||
localReferencesNeeded = Utils.enumerateReferenceArguments(m.getParameterTypes());
|
localReferencesNeeded = Utils.enumerateReferenceArguments(m.getParameterTypes());
|
||||||
} else {
|
} else {
|
||||||
c = (Constructor) aMethod;
|
c = (Constructor<?>) aMethod;
|
||||||
returnType = Void.class;
|
returnType = Void.class;
|
||||||
localReferencesNeeded = Utils.enumerateReferenceArguments(c.getParameterTypes());
|
localReferencesNeeded = Utils.enumerateReferenceArguments(c.getParameterTypes());
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ public class CodeGenerator {
|
||||||
return argumentContent;
|
return argumentContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeCtorBody(String implementationSignature, Constructor theCtor,
|
private void writeCtorBody(String implementationSignature, Constructor<?> theCtor,
|
||||||
boolean aIsThreaded, boolean aNoThrow) {
|
boolean aIsThreaded, boolean aNoThrow) {
|
||||||
Class<?>[] argumentTypes = theCtor.getParameterTypes();
|
Class<?>[] argumentTypes = theCtor.getParameterTypes();
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,10 @@ public class AnnotatableEntity {
|
||||||
}
|
}
|
||||||
return (Field) mMember;
|
return (Field) mMember;
|
||||||
}
|
}
|
||||||
public Constructor getConstructor() {
|
public Constructor<?> getConstructor() {
|
||||||
if (mEntityType != ENTITY_TYPE.CONSTRUCTOR) {
|
if (mEntityType != ENTITY_TYPE.CONSTRUCTOR) {
|
||||||
throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
|
throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
|
||||||
}
|
}
|
||||||
return (Constructor) mMember;
|
return (Constructor<?>) mMember;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class AlphabeticAnnotatableEntityComparator<T extends Member> implements
|
||||||
return lName.compareTo(rName);
|
return lName.compareTo(rName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int compare(Constructor aLhs, Constructor aRhs) {
|
private static int compare(Constructor<?> aLhs, Constructor<?> aRhs) {
|
||||||
// The names will be the same, so we need to compare signatures to find their uniqueness..
|
// The names will be the same, so we need to compare signatures to find their uniqueness..
|
||||||
String lName = Utils.getTypeSignatureString(aLhs);
|
String lName = Utils.getTypeSignatureString(aLhs);
|
||||||
String rName = Utils.getTypeSignatureString(aRhs);
|
String rName = Utils.getTypeSignatureString(aRhs);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
|
||||||
System.arraycopy(aCtors, 0, objs, offset, aCtors.length);
|
System.arraycopy(aCtors, 0, objs, offset, aCtors.length);
|
||||||
|
|
||||||
// Sort the elements to ensure determinism.
|
// Sort the elements to ensure determinism.
|
||||||
Arrays.sort(objs, new AlphabeticAnnotatableEntityComparator());
|
Arrays.sort(objs, new AlphabeticAnnotatableEntityComparator<Member>());
|
||||||
mObjects = objs;
|
mObjects = objs;
|
||||||
|
|
||||||
// Check for "Wrap ALL the things" flag.
|
// Check for "Wrap ALL the things" flag.
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class Utils {
|
||||||
* @param aConstructor The Constructor to generate a signature for.
|
* @param aConstructor The Constructor to generate a signature for.
|
||||||
* @return The canonical JNI type signature for this method.
|
* @return The canonical JNI type signature for this method.
|
||||||
*/
|
*/
|
||||||
protected static String getTypeSignatureStringForConstructor(Constructor aConstructor) {
|
protected static String getTypeSignatureStringForConstructor(Constructor<?> aConstructor) {
|
||||||
Class<?>[] arguments = aConstructor.getParameterTypes();
|
Class<?>[] arguments = aConstructor.getParameterTypes();
|
||||||
return getTypeSignatureInternal(arguments, Void.class);
|
return getTypeSignatureInternal(arguments, Void.class);
|
||||||
}
|
}
|
||||||
|
@ -314,11 +314,11 @@ public class Utils {
|
||||||
} else if (aMember instanceof Field) {
|
} else if (aMember instanceof Field) {
|
||||||
return getTypeSignatureStringForField((Field) aMember);
|
return getTypeSignatureStringForField((Field) aMember);
|
||||||
} else {
|
} else {
|
||||||
return getTypeSignatureStringForConstructor((Constructor) aMember);
|
return getTypeSignatureStringForConstructor((Constructor<?>) aMember);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTypeSignatureString(Constructor aConstructor) {
|
public static String getTypeSignatureString(Constructor<?> aConstructor) {
|
||||||
Class<?>[] arguments = aConstructor.getParameterTypes();
|
Class<?>[] arguments = aConstructor.getParameterTypes();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append('(');
|
sb.append('(');
|
||||||
|
|
Загрузка…
Ссылка в новой задаче