17
17
import java .net .URL ;
18
18
import java .net .URLClassLoader ;
19
19
import java .util .ArrayList ;
20
+ import java .util .Arrays ;
20
21
import java .util .Collections ;
21
22
import java .util .List ;
22
- import javax .persistence .Embedded ;
23
- import javax .persistence .Entity ;
23
+
24
24
import javassist .ClassPool ;
25
25
import javassist .CtClass ;
26
26
import javassist .CtField ;
@@ -82,7 +82,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
82
82
File root = new File ( this .dir );
83
83
walkDir ( root );
84
84
85
- final ClassLoader classLoader = toClassLoader ( sourceSet );
85
+ final ClassLoader classLoader = toClassLoader ( Arrays . asList ( root ) );
86
86
87
87
EnhancementContext enhancementContext = new DefaultEnhancementContext () {
88
88
@ Override
@@ -107,7 +107,7 @@ public boolean hasLazyLoadableAttributes(CtClass classDescriptor) {
107
107
108
108
@ Override
109
109
public boolean isLazyLoadable (CtField field ) {
110
- return true ;
110
+ return enableLazyInitialization ;
111
111
}
112
112
};
113
113
@@ -120,13 +120,15 @@ public boolean isLazyLoadable(CtField field) {
120
120
continue ;
121
121
}
122
122
123
- if ( !ctClass . hasAnnotation ( Entity . class ) && !ctClass . hasAnnotation ( Embedded . class ) ) {
124
- getLog ().debug ( "Skipping class file [" + file .getAbsolutePath () + "], not an entity nor embedded " );
123
+ if ( !enhancementContext . isEntityClass ( ctClass ) && !enhancementContext . isCompositeClass ( ctClass ) ) {
124
+ getLog ().info ( "Skipping class file [" + file .getAbsolutePath () + "], not an entity nor embeddable " );
125
125
continue ;
126
126
}
127
127
128
128
final byte [] enhancedBytecode = doEnhancement ( ctClass , enhancer );
129
129
writeOutEnhancedClass ( enhancedBytecode , ctClass , file );
130
+
131
+ getLog ().info ( "Successfully enhanced class [" + ctClass .getName () + "]" );
130
132
}
131
133
}
132
134
@@ -135,6 +137,7 @@ private ClassLoader toClassLoader(List<File> runtimeClasspath) throws MojoExecut
135
137
for ( File file : runtimeClasspath ) {
136
138
try {
137
139
urls .add ( file .toURI ().toURL () );
140
+ getLog ().debug ( "Adding root " + file .getAbsolutePath () + " to classpath " );
138
141
}
139
142
catch (MalformedURLException e ) {
140
143
String msg = "Unable to resolve classpath entry to URL: " + file .getAbsolutePath ();
0 commit comments