Package com.dua3.cabe.processor
Klasse ClassPatcher
java.lang.Object
com.dua3.cabe.processor.ClassPatcher
The ClassPatcher class is responsible for patching class files by adding assertions for nullability checks
on method parameters. It collects information about the class file, including package information and
parameter annotations, and modifies the class file by injecting the necessary code.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungClassPatcher(Collection<Path> classpath) This class represents a ClassPatcher object that manipulates class files in a given classpath. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic String[]getParameterTypes(javassist.CtBehavior method) Retrieves the parameter types of a given method.voidinstrumentClassFile(Path classFile) Instruments a class file by adding null-check assertions for method parameters.voidprocessFolder(Path inputFolder, Path outputFolder) Process a folder containing class files.
-
Konstruktordetails
-
ClassPatcher
This class represents a ClassPatcher object that manipulates class files in a given classpath.- Parameter:
classpath- the compile classpath
-
-
Methodendetails
-
processFolder
public void processFolder(Path inputFolder, Path outputFolder) throws IOException, ClassFileProcessingFailedException Process a folder containing class files.- Parameter:
inputFolder- the folder to process- Löst aus:
IOException- if an I/O error occursClassFileProcessingFailedException- if processing of a class file fails
-
instrumentClassFile
public void instrumentClassFile(Path classFile) throws ClassFileProcessingFailedException, IOException Instruments a class file by adding null-check assertions for method parameters.- Parameter:
classFile- the path to the class file to be instrumented- Löst aus:
ClassFileProcessingFailedException- if processing of the class file failsIOException- if an I/O error occurs
-
getParameterTypes
Retrieves the parameter types of a given method.- Parameter:
method- the method to retrieve parameter types for- Gibt zurück:
- an array of Strings representing the parameter types of the method
- Löst aus:
IllegalStateException- if the parameter descriptor is malformed
-