Java Code Examples for com.strobel.assembler.metadata.TypeDefinition#isFinal()
The following examples show how to use
com.strobel.assembler.metadata.TypeDefinition#isFinal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SingleType.java From huntbugs with Apache License 2.0 | 6 votes |
static EType of(TypeReference tr, What what) { if (tr == null || tr.isPrimitive() || (what == What.SUBTYPE && Types.isObject(tr))) return UNKNOWN; TypeDefinition td = tr.resolve(); if (td == null) return UNKNOWN; if (td.isFinal() || td.isPrimitive()) { if (what == What.SUBTYPE) what = What.EXACT; if (what == What.NOT) what = What.NOT_SUBTYPE; } TypeReference newTr = td; while (tr.isArray()) { tr = tr.getElementType(); newTr = newTr.makeArrayType(); } boolean complete = Types.hasCompleteHierarchy(td); return new SingleType(newTr, what, complete); }
Example 2
Source File: EqualsContract.java From huntbugs with Apache License 2.0 | 5 votes |
private static int getPriority(TypeDefinition td) { int priority = 0; if (td.isNonPublic()) priority += 30; if (td.isFinal()) priority += 5; return priority; }
Example 3
Source File: Naming.java From huntbugs with Apache License 2.0 | 5 votes |
@MethodVisitor public void visitMethod(MethodDefinition md, TypeDefinition td, MethodContext mc) { if (badMethodName(md.getName())) { if (Types.isInstance(td, "org/eclipse/osgi/util/NLS")) return; // javacc generated methods if (td.getName().equals("SimpleCharStream") && (md.getName().equals("ReInit") || md.getName().equals("BeginToken") || md.getName().equals("Done") || md.getName().equals("GetSuffix") || md.getName().equals("GetImage"))) return; if (td.getName().endsWith("TokenManager") && md.getName().equals("ReInit")) return; int priority = 0; if (!td.isPublic()) priority += 20; else { if (td.isFinal()) priority += 3; if (md.isProtected()) priority += 3; else if (md.isPackagePrivate()) priority += 6; else if (md.isPrivate()) priority += 10; } mc.report("BadNameOfMethod", priority); } String javaVersion = getFutureKeywordVersion(md.getName()); if (javaVersion != null) { mc.report("BadNameOfMethodFutureKeyword", AccessLevel.of(md).select(0, 10, 20, 30), JAVA_VERSION.create(javaVersion)); } if (!md.isStatic() && md.isPublic()) { MemberInfo mi = getMistakeFix(md); if (mi != null) { mc.report("BadNameOfMethodMistake", md.isDeprecated() ? 20 : 0, Roles.REPLACEMENT_METHOD.create(mi)); } } }
Example 4
Source File: MethodStats.java From huntbugs with Apache License 2.0 | 5 votes |
@Override protected void visitType(TypeDefinition td) { for (MethodDefinition md : td.getDeclaredMethods()) { MethodData mdata = getMethodData(md); if (md.isFinal() || td.isFinal() || md.isStatic() || md.isPrivate()) { mdata.flags |= METHOD_FINAL; } visitMethod(mdata, md); for (MethodDefinition superMethod : Methods.findSuperMethods(md)) { getMethodData(superMethod).addSubMethod(mdata); } } }
Example 5
Source File: UnsafeGetResource.java From huntbugs with Apache License 2.0 | 4 votes |
@MethodVisitor public boolean checkMethod(MethodDefinition md, TypeDefinition td) { return td.isPublic() && !td.isFinal() && !md.isStatic(); }
Example 6
Source File: SyncGetClass.java From huntbugs with Apache License 2.0 | 4 votes |
@MethodVisitor public boolean checkMethod(MethodDefinition md, TypeDefinition td) { return !td.isFinal() && !md.isStatic(); }
Example 7
Source File: StartInConstructor.java From huntbugs with Apache License 2.0 | 4 votes |
@MethodVisitor public boolean checkMethod(MethodDefinition md, TypeDefinition td) { return td.isPublic() && !td.isFinal() && !md.isPrivate() && !md.isPackagePrivate(); }