Class JavacUtils
- java.lang.Object
-
- ch.usi.si.codelounge.jsicko.plugin.utils.JavacUtils
-
public final class JavacUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description JavacUtils(com.sun.tools.javac.api.BasicJavacTask task)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.sun.tools.javac.code.TypebooleanType()com.sun.tools.javac.code.TypebotType()com.sun.tools.javac.code.TypederiveMostGeneralExceptionTypeThrown(com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> throwsList)Given a list of exception types from a method throws declarations, derives the most general exception type thrown that can be safely rethrown according to Java's improved type checking analysis of rethrown exceptions.com.sun.tools.javac.tree.JCTree.JCExpressionErroneous()com.sun.tools.javac.code.TypeexceptionType()com.sun.tools.javac.tree.JCTree.JCExpressionExpression(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String classQualifiedName)com.sun.tools.javac.tree.JCTree.JCExpressionExpression(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String classQualifiedName, String methodName)com.sun.tools.javac.tree.JCTree.JCExpressionfalseLiteral()com.sun.tools.javac.util.List<com.sun.tools.javac.code.Symbol.MethodSymbol>findInvariants(com.sun.tools.javac.tree.JCTree.JCClassDecl classDecl)com.sun.tools.javac.util.List<com.sun.tools.javac.code.Symbol>findOverriddenMethods(com.sun.tools.javac.tree.JCTree.JCClassDecl classDecl, com.sun.tools.javac.tree.JCTree.JCMethodDecl methodDecl)com.sun.tools.javac.code.Type.TypeVarfreshObjectTypeVar(com.sun.tools.javac.code.Symbol owner)com.sun.tools.javac.tree.TreeMakergetFactory()com.sun.tools.javac.code.SymbolgetJavaUtilCollectionIteratorMethodSymbol()booleanhasVoidReturnType(com.sun.tools.javac.tree.JCTree.JCMethodDecl methodDecl)booleanisSuperOrThisConstructorCall(com.sun.tools.javac.tree.JCTree.JCStatement head)booleanisTypeAssignable(com.sun.tools.javac.code.Symbol.VarSymbol a, com.sun.tools.javac.code.Symbol.VarSymbol b)booleanisTypeAssignable(com.sun.tools.javac.code.Type t, com.sun.tools.javac.code.Type s)com.sun.tools.javac.code.Symbol.ModuleSymboljavaBaseModule()voidlogError(JavaFileObject fileObject, com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos, JSickoDiagnostic.JSickoError jsickoError)voidlogNote(JavaFileObject fileObject, com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos, JSickoDiagnostic.JSickoNote note)voidlogWarning(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos, JSickoDiagnostic.JSickoWarning warning)com.sun.tools.javac.tree.JCTree.JCStatementMethodCall(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName)com.sun.tools.javac.tree.JCTree.JCStatementMethodCall(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> args)com.sun.tools.javac.tree.JCTree.JCMethodInvocationMethodInvocation(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName)com.sun.tools.javac.tree.JCTree.JCMethodInvocationMethodInvocation(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> args)com.sun.tools.javac.util.NameName(String name)com.sun.tools.javac.tree.JCTree.JCLiteralnullLiteral()com.sun.tools.javac.code.TypeobjectType()com.sun.tools.javac.code.TypeoldValuesTableClassType()com.sun.tools.javac.tree.JCTree.JCExpressionoldValuesTableTypeExpression()com.sun.tools.javac.code.TypepreconditionCheckerType()com.sun.tools.javac.code.SymbolretrieveConstructor(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName)com.sun.tools.javac.code.SymbolretrieveConstructor(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName, com.sun.tools.javac.code.Type... argTypes)com.sun.tools.javac.code.SymbolretrieveEmptyConstructor(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName)Optional<com.sun.tools.javac.code.Symbol>retrieveMemberFromClassByName(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String qualifiedClassName, String methodName)com.sun.tools.javac.code.TyperetrieveType(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName)com.sun.tools.javac.code.TyperuntimeExceptionType()voidsetOperator(com.sun.tools.javac.tree.JCTree.JCBinary binary)voidsetOperator(com.sun.tools.javac.tree.JCTree.JCUnary unaryOp)com.sun.tools.javac.code.TypestringType()com.sun.tools.javac.code.TypethrowableType()com.sun.tools.javac.tree.JCTree.JCExpressionType(com.sun.tools.javac.code.Type tpe)com.sun.tools.javac.util.List<com.sun.tools.javac.code.Type>typeClosure(com.sun.tools.javac.code.Type t)com.sun.tools.javac.code.TypetypeErasure(com.sun.tools.javac.code.Type t)com.sun.tools.javac.code.Symbol.ModuleSymbolunnamedModule()voidvisitLambda(com.sun.tools.javac.tree.JCTree.JCLambda lambda)com.sun.tools.javac.code.TypevoidType()com.sun.tools.javac.code.TypezeroType(com.sun.tools.javac.code.Type t)com.sun.tools.javac.tree.JCTree.JCLiteralzeroValue(com.sun.tools.javac.code.Type t)
-
-
-
Method Detail
-
getFactory
public com.sun.tools.javac.tree.TreeMaker getFactory()
-
Expression
public com.sun.tools.javac.tree.JCTree.JCExpression Expression(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String classQualifiedName)
-
Expression
public com.sun.tools.javac.tree.JCTree.JCExpression Expression(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String classQualifiedName, String methodName)
-
Erroneous
public com.sun.tools.javac.tree.JCTree.JCExpression Erroneous()
-
typeClosure
public com.sun.tools.javac.util.List<com.sun.tools.javac.code.Type> typeClosure(com.sun.tools.javac.code.Type t)
-
typeErasure
public com.sun.tools.javac.code.Type typeErasure(com.sun.tools.javac.code.Type t)
-
Name
public com.sun.tools.javac.util.Name Name(String name)
-
unnamedModule
public com.sun.tools.javac.code.Symbol.ModuleSymbol unnamedModule()
-
javaBaseModule
public com.sun.tools.javac.code.Symbol.ModuleSymbol javaBaseModule()
-
MethodCall
public com.sun.tools.javac.tree.JCTree.JCStatement MethodCall(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> args)
-
MethodCall
public com.sun.tools.javac.tree.JCTree.JCStatement MethodCall(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName)
-
MethodInvocation
public com.sun.tools.javac.tree.JCTree.JCMethodInvocation MethodInvocation(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName, com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> args)
-
MethodInvocation
public com.sun.tools.javac.tree.JCTree.JCMethodInvocation MethodInvocation(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, com.sun.tools.javac.tree.JCTree.JCExpression baseExpression, com.sun.tools.javac.util.Name methodName)
-
isTypeAssignable
public boolean isTypeAssignable(com.sun.tools.javac.code.Type t, com.sun.tools.javac.code.Type s)
-
findOverriddenMethods
public com.sun.tools.javac.util.List<com.sun.tools.javac.code.Symbol> findOverriddenMethods(com.sun.tools.javac.tree.JCTree.JCClassDecl classDecl, com.sun.tools.javac.tree.JCTree.JCMethodDecl methodDecl)
-
hasVoidReturnType
public boolean hasVoidReturnType(com.sun.tools.javac.tree.JCTree.JCMethodDecl methodDecl)
-
zeroValue
public com.sun.tools.javac.tree.JCTree.JCLiteral zeroValue(com.sun.tools.javac.code.Type t)
-
nullLiteral
public com.sun.tools.javac.tree.JCTree.JCLiteral nullLiteral()
-
findInvariants
public com.sun.tools.javac.util.List<com.sun.tools.javac.code.Symbol.MethodSymbol> findInvariants(com.sun.tools.javac.tree.JCTree.JCClassDecl classDecl)
-
isSuperOrThisConstructorCall
public boolean isSuperOrThisConstructorCall(com.sun.tools.javac.tree.JCTree.JCStatement head)
-
oldValuesTableClassType
public com.sun.tools.javac.code.Type oldValuesTableClassType()
-
preconditionCheckerType
public com.sun.tools.javac.code.Type preconditionCheckerType()
-
freshObjectTypeVar
public com.sun.tools.javac.code.Type.TypeVar freshObjectTypeVar(com.sun.tools.javac.code.Symbol owner)
-
oldValuesTableTypeExpression
public com.sun.tools.javac.tree.JCTree.JCExpression oldValuesTableTypeExpression()
-
Type
public com.sun.tools.javac.tree.JCTree.JCExpression Type(com.sun.tools.javac.code.Type tpe)
-
stringType
public com.sun.tools.javac.code.Type stringType()
-
throwableType
public com.sun.tools.javac.code.Type throwableType()
-
exceptionType
public com.sun.tools.javac.code.Type exceptionType()
-
objectType
public com.sun.tools.javac.code.Type objectType()
-
runtimeExceptionType
public com.sun.tools.javac.code.Type runtimeExceptionType()
-
logError
public void logError(JavaFileObject fileObject, com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos, JSickoDiagnostic.JSickoError jsickoError)
-
logWarning
public void logWarning(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos, JSickoDiagnostic.JSickoWarning warning)
-
logNote
public void logNote(JavaFileObject fileObject, com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos, JSickoDiagnostic.JSickoNote note)
-
retrieveMemberFromClassByName
public Optional<com.sun.tools.javac.code.Symbol> retrieveMemberFromClassByName(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String qualifiedClassName, String methodName)
-
getJavaUtilCollectionIteratorMethodSymbol
public com.sun.tools.javac.code.Symbol getJavaUtilCollectionIteratorMethodSymbol()
-
deriveMostGeneralExceptionTypeThrown
public com.sun.tools.javac.code.Type deriveMostGeneralExceptionTypeThrown(com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCExpression> throwsList)
Given a list of exception types from a method throws declarations, derives the most general exception type thrown that can be safely rethrown according to Java's improved type checking analysis of rethrown exceptions.- Parameters:
throwsList- a list of expressions corresponding to a throws clause in a method declaration.- Returns:
- one type among
Throwable,Exception, andRuntimeException. - See Also:
- Official Oracle documentation.
-
retrieveType
public com.sun.tools.javac.code.Type retrieveType(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName)
-
retrieveConstructor
public com.sun.tools.javac.code.Symbol retrieveConstructor(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName)
-
retrieveConstructor
public com.sun.tools.javac.code.Symbol retrieveConstructor(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName, com.sun.tools.javac.code.Type... argTypes)
-
retrieveEmptyConstructor
public com.sun.tools.javac.code.Symbol retrieveEmptyConstructor(com.sun.tools.javac.code.Symbol.ModuleSymbol moduleSymbol, String canonicalName)
-
setOperator
public void setOperator(com.sun.tools.javac.tree.JCTree.JCUnary unaryOp)
-
booleanType
public com.sun.tools.javac.code.Type booleanType()
-
voidType
public com.sun.tools.javac.code.Type voidType()
-
botType
public com.sun.tools.javac.code.Type botType()
-
setOperator
public void setOperator(com.sun.tools.javac.tree.JCTree.JCBinary binary)
-
visitLambda
public void visitLambda(com.sun.tools.javac.tree.JCTree.JCLambda lambda)
-
zeroType
public com.sun.tools.javac.code.Type zeroType(com.sun.tools.javac.code.Type t)
-
falseLiteral
public com.sun.tools.javac.tree.JCTree.JCExpression falseLiteral()
-
isTypeAssignable
public boolean isTypeAssignable(com.sun.tools.javac.code.Symbol.VarSymbol a, com.sun.tools.javac.code.Symbol.VarSymbol b)
-
-