1 5 package com.tc.object.tools; 6 7 import org.apache.commons.cli.CommandLine; 8 import org.apache.commons.cli.HelpFormatter; 9 import org.apache.commons.cli.Option; 10 import org.apache.commons.cli.Options; 11 import org.apache.commons.cli.ParseException; 12 import org.apache.commons.cli.PosixParser; 13 14 import com.tc.asm.ClassReader; 15 import com.tc.asm.ClassVisitor; 16 import com.tc.asm.ClassWriter; 17 import com.tc.asm.MethodVisitor; 18 import com.tc.asm.commons.SerialVersionUIDAdder; 19 import com.tc.asm.tree.ClassNode; 20 import com.tc.asm.tree.InnerClassNode; 21 import com.tc.asm.tree.MethodNode; 22 import com.tc.aspectwerkz.reflect.ClassInfo; 23 import com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo; 24 import com.tc.aspectwerkz.reflect.impl.java.JavaClassInfo; 25 import com.tc.cluster.ClusterEventListener; 26 import com.tc.config.Directories; 27 import com.tc.config.schema.setup.FatalIllegalConfigurationChangeHandler; 28 import com.tc.config.schema.setup.L1TVSConfigurationSetupManager; 29 import com.tc.config.schema.setup.StandardTVSConfigurationSetupManagerFactory; 30 import com.tc.exception.ExceptionWrapper; 31 import com.tc.exception.ExceptionWrapperImpl; 32 import com.tc.exception.TCNotSupportedMethodException; 33 import com.tc.exception.TCRuntimeException; 34 import com.tc.geronimo.GeronimoLoaderNaming; 35 import com.tc.jboss.JBossLoaderNaming; 36 import com.tc.logging.CustomerLogging; 37 import com.tc.logging.NullTCLogger; 38 import com.tc.logging.TCLogger; 39 import com.tc.management.TerracottaMBean; 40 import com.tc.management.beans.sessions.SessionMonitorMBean; 41 import com.tc.net.NIOWorkarounds; 42 import com.tc.object.ObjectID; 43 import com.tc.object.Portability; 44 import com.tc.object.PortabilityImpl; 45 import com.tc.object.SerializationUtil; 46 import com.tc.object.TCClass; 47 import com.tc.object.TCObject; 48 import com.tc.object.bytecode.AbstractStringBuilderAdapter; 49 import com.tc.object.bytecode.BufferedWriterAdapter; 50 import com.tc.object.bytecode.ChangeClassNameHierarchyAdapter; 51 import com.tc.object.bytecode.ChangeClassNameRootAdapter; 52 import com.tc.object.bytecode.ChangePackageClassAdapter; 53 import com.tc.object.bytecode.Clearable; 54 import com.tc.object.bytecode.DataOutputStreamAdapter; 55 import com.tc.object.bytecode.DuplicateMethodAdapter; 56 import com.tc.object.bytecode.HashtableClassAdapter; 57 import com.tc.object.bytecode.JavaLangReflectProxyClassAdapter; 58 import com.tc.object.bytecode.JavaLangStringAdapter; 59 import com.tc.object.bytecode.JavaUtilConcurrentCyclicBarrierDebugClassAdapter; 60 import com.tc.object.bytecode.JavaUtilConcurrentHashMapAdapter; 61 import com.tc.object.bytecode.JavaUtilConcurrentHashMapSegmentAdapter; 62 import com.tc.object.bytecode.JavaUtilConcurrentLinkedBlockingQueueAdapter; 63 import com.tc.object.bytecode.JavaUtilConcurrentLinkedBlockingQueueClassAdapter; 64 import com.tc.object.bytecode.JavaUtilConcurrentLinkedBlockingQueueIteratorClassAdapter; 65 import com.tc.object.bytecode.JavaUtilConcurrentLinkedBlockingQueueNodeClassAdapter; 66 import com.tc.object.bytecode.JavaUtilTreeMapAdapter; 67 import com.tc.object.bytecode.JavaUtilWeakHashMapAdapter; 68 import com.tc.object.bytecode.LinkedListAdapter; 69 import com.tc.object.bytecode.LogicalClassSerializationAdapter; 70 import com.tc.object.bytecode.Manageable; 71 import com.tc.object.bytecode.Manager; 72 import com.tc.object.bytecode.ManagerUtil; 73 import com.tc.object.bytecode.MergeTCToJavaClassAdapter; 74 import com.tc.object.bytecode.NullManager; 75 import com.tc.object.bytecode.NullTCObject; 76 import com.tc.object.bytecode.StringBufferAdapter; 77 import com.tc.object.bytecode.StringGetCharsAdapter; 78 import com.tc.object.bytecode.TCMap; 79 import com.tc.object.bytecode.TransparencyClassAdapter; 80 import com.tc.object.bytecode.TransparentAccess; 81 import com.tc.object.bytecode.VectorAdapter; 82 import com.tc.object.bytecode.hook.ClassLoaderPreProcessorImpl; 83 import com.tc.object.bytecode.hook.ClassPostProcessor; 84 import com.tc.object.bytecode.hook.ClassPreProcessor; 85 import com.tc.object.bytecode.hook.ClassProcessor; 86 import com.tc.object.bytecode.hook.DSOContext; 87 import com.tc.object.bytecode.hook.impl.ClassProcessorHelper; 88 import com.tc.object.bytecode.hook.impl.ClassProcessorHelperJDK15; 89 import com.tc.object.bytecode.hook.impl.JavaLangArrayHelpers; 90 import com.tc.object.bytecode.hook.impl.SessionsHelper; 91 import com.tc.object.bytecode.hook.impl.Util; 92 import com.tc.object.cache.Cacheable; 93 import com.tc.object.config.DSOClientConfigHelper; 94 import com.tc.object.config.DSOSpringConfigHelper; 95 import com.tc.object.config.StandardDSOClientConfigHelper; 96 import com.tc.object.config.TransparencyClassSpec; 97 import com.tc.object.dna.impl.ProxyInstance; 98 import com.tc.object.field.TCField; 99 import com.tc.object.loaders.BytecodeProvider; 100 import com.tc.object.loaders.ClassProvider; 101 import com.tc.object.loaders.NamedClassLoader; 102 import com.tc.object.loaders.NamedLoaderAdapter; 103 import com.tc.object.loaders.Namespace; 104 import com.tc.object.loaders.StandardClassLoaderAdapter; 105 import com.tc.object.loaders.StandardClassProvider; 106 import com.tc.object.logging.InstrumentationLogger; 107 import com.tc.object.logging.InstrumentationLoggerImpl; 108 import com.tc.plugins.ModulesLoader; 109 import com.tc.properties.TCProperties; 110 import com.tc.session.SessionSupport; 111 import com.tc.text.Banner; 112 import com.tc.util.AbstractIdentifier; 113 import com.tc.util.Assert; 114 import com.tc.util.DebugUtil; 115 import com.tc.util.EnumerationWrapper; 116 import com.tc.util.FieldUtils; 117 import com.tc.util.HashtableKeySetWrapper; 118 import com.tc.util.HashtableValuesWrapper; 119 import com.tc.util.ListIteratorWrapper; 120 import com.tc.util.SetIteratorWrapper; 121 import com.tc.util.THashMapCollectionWrapper; 122 import com.tc.util.UnsafeUtil; 123 import com.tc.util.runtime.Os; 124 import com.tc.util.runtime.Vm; 125 import com.tcclient.util.HashtableEntrySetWrapper; 126 import com.tcclient.util.MapEntrySetWrapper; 127 128 import gnu.trove.TLinkable; 129 130 import java.io.BufferedWriter ; 131 import java.io.ByteArrayOutputStream ; 132 import java.io.DataOutputStream ; 133 import java.io.File ; 134 import java.io.FileNotFoundException ; 135 import java.io.IOException ; 136 import java.io.InputStream ; 137 import java.io.PrintWriter ; 138 import java.io.StringWriter ; 139 import java.util.Collections ; 140 import java.util.HashMap ; 141 import java.util.HashSet ; 142 import java.util.Iterator ; 143 import java.util.List ; 144 import java.util.Map ; 145 import java.util.Set ; 146 147 150 public class BootJarTool { 151 private final static String OUTPUT_FILE_OPTION = "o"; 152 private final static boolean WRITE_OUT_TEMP_FILE = true; 153 154 private static final String DEFAULT_CONFIG_PATH = "default-config.xml"; 155 private static final String DEFAULT_CONFIG_SPEC = "tc-config.xml"; 156 157 private final ClassLoader tcLoader; 158 private final ClassLoader systemLoader; 159 private final DSOClientConfigHelper config; 160 private final File outputFile; 161 private final Portability portability; 162 163 private final Set notBootstrapClasses = new HashSet (); 165 private final Set notAdaptableClasses = new HashSet (); 166 private final Set logicalSubclasses = new HashSet (); 167 private final Set autoIncludedBootstrapClasses = new HashSet (); 168 private final Set nonExistingClasses = new HashSet (); 169 170 private InstrumentationLogger instrumentationLogger; 171 private BootJar bootJar; 172 private BootJarHandler bootJarHandler; 173 private boolean quiet; 174 175 public BootJarTool(DSOClientConfigHelper configuration, File outputFile, ClassLoader systemProvider, boolean quiet) { 176 this.config = configuration; 177 this.outputFile = outputFile; 178 this.systemLoader = systemProvider; 179 this.tcLoader = getClass().getClassLoader(); 180 this.bootJarHandler = new BootJarHandler(WRITE_OUT_TEMP_FILE, this.outputFile); 181 this.quiet = quiet; 182 this.portability = new PortabilityImpl(this.config); 183 ModulesLoader.initModules(this.config, null, true); 184 } 185 186 public BootJarTool(DSOClientConfigHelper configuration, File outputFile, ClassLoader systemProvider) { 187 this(configuration, outputFile, systemProvider, false); 188 } 189 190 private boolean isAtLeastJDK15() { 191 try { 192 getBytesForClass("java.lang.StringBuilder", systemLoader); 193 return true; 194 } catch (ClassNotFoundException e) { 195 return false; 196 } 197 } 198 199 private void addJdk15SpecificPreInstrumentedClasses() { 200 if (isAtLeastJDK15()) { 201 TransparencyClassSpec spec = config.getOrCreateSpec("java.math.MathContext"); 202 spec.markPreInstrumented(); 203 204 addInstrumentedJavaUtilConcurrentLocksReentrantLock(); 205 addInstrumentedJavaUtilConcurrentLinkedBlockingQueue(); 206 addInstrumentedJavaUtilConcurrentHashMap(); 207 addInstrumentedJavaUtilConcurrentCyclicBarrier(); 208 addInstrumentedJavaUtilConcurrentFutureTask(); 209 } 210 } 211 212 public void generateJar() { 213 instrumentationLogger = new InstrumentationLoggerImpl(config.getInstrumentationLoggingOptions()); 214 try { 215 bootJarHandler.validateDirectoryExists(); 216 } catch (BootJarHandlerException e) { 217 exit(e.getMessage(), e.getCause()); 218 } 219 220 if (!quiet) { 221 bootJarHandler.announceCreationStart(); 222 } 223 224 try { 225 226 bootJar = bootJarHandler.getBootJar(); 227 228 addInstrumentedHashMap(); 229 addInstrumentedHashtable(); 230 addInstrumentedJavaUtilCollection(); 231 232 addJdk15SpecificPreInstrumentedClasses(); 233 234 addInstrumentedWeakHashMap(); 235 236 loadTerracottaClass(DebugUtil.class.getName()); 237 loadTerracottaClass(SessionSupport.class.getName()); 238 loadTerracottaClass(TCMap.class.getName()); 239 loadTerracottaClass(com.tc.util.Stack.class.getName()); 240 241 loadTerracottaClass(THashMapCollectionWrapper.class.getName()); 242 loadTerracottaClass(THashMapCollectionWrapper.class.getName() + "$IteratorWrapper"); 243 loadTerracottaClass(ListIteratorWrapper.class.getName()); 244 loadTerracottaClass(MapEntrySetWrapper.class.getName()); 245 loadTerracottaClass(MapEntrySetWrapper.class.getName() + "$IteratorWrapper"); 246 loadTerracottaClass(HashtableEntrySetWrapper.class.getName()); 247 loadTerracottaClass(HashtableEntrySetWrapper.class.getName() + "$HashtableIteratorWrapper"); 248 loadTerracottaClass(HashtableKeySetWrapper.class.getName()); 249 loadTerracottaClass(HashtableKeySetWrapper.class.getName() + "$IteratorWrapper"); 250 loadTerracottaClass(HashtableValuesWrapper.class.getName()); 251 loadTerracottaClass(HashtableValuesWrapper.class.getName() + "$IteratorWrapper"); 252 loadTerracottaClass(SetIteratorWrapper.class.getName()); 253 loadTerracottaClass(EnumerationWrapper.class.getName()); 254 loadTerracottaClass(NamedClassLoader.class.getName()); 255 loadTerracottaClass(TransparentAccess.class.getName()); 256 loadTerracottaClass(BytecodeProvider.class.getName()); 257 258 loadTerracottaClass(Manageable.class.getName()); 259 loadTerracottaClass(Clearable.class.getName()); 260 loadTerracottaClass(Manager.class.getName()); 261 loadTerracottaClass(NullManager.class.getName()); 262 loadTerracottaClass(ManagerUtil.class.getName()); 263 loadTerracottaClass(ManagerUtil.class.getName() + "$GlobalManagerHolder"); 264 loadTerracottaClass(TCObject.class.getName()); 265 loadTerracottaClass(TCClass.class.getName()); 266 loadTerracottaClass(TCField.class.getName()); 267 loadTerracottaClass(NullTCObject.class.getName()); 268 loadTerracottaClass(Cacheable.class.getName()); 269 loadTerracottaClass(ObjectID.class.getName()); 270 loadTerracottaClass(AbstractIdentifier.class.getName()); 271 loadTerracottaClass(TLinkable.class.getName()); 272 loadTerracottaClass(SessionsHelper.class.getName()); 273 loadTerracottaClass(GeronimoLoaderNaming.class.getName()); 274 loadTerracottaClass(JBossLoaderNaming.class.getName()); 275 loadTerracottaClass(TCLogger.class.getName()); 276 loadTerracottaClass(Banner.class.getName()); 277 loadTerracottaClass(StandardClassProvider.class.getName()); 278 loadTerracottaClass(Namespace.class.getName()); 279 loadTerracottaClass(ClassProcessorHelper.class.getName()); 280 loadTerracottaClass(ClassProcessorHelperJDK15.class.getName()); 281 loadTerracottaClass(ClassProcessorHelper.State.class.getName()); 282 loadTerracottaClass(ClassProcessorHelper.JarFilter.class.getName()); 283 loadTerracottaClass(ClassProcessor.class.getName()); 284 loadTerracottaClass(ClassPreProcessor.class.getName()); 285 loadTerracottaClass(ClassPostProcessor.class.getName()); 286 loadTerracottaClass(DSOSpringConfigHelper.class.getName()); 287 loadTerracottaClass(DSOContext.class.getName()); 288 loadTerracottaClass(ClassProvider.class.getName()); 289 loadTerracottaClass(TCRuntimeException.class.getName()); 290 loadTerracottaClass(FieldUtils.class.getName()); 291 loadTerracottaClass(UnsafeUtil.class.getName()); 292 loadTerracottaClass(TCNotSupportedMethodException.class.getName()); 293 loadTerracottaClass(ExceptionWrapper.class.getName()); 294 loadTerracottaClass(ExceptionWrapperImpl.class.getName()); 295 loadTerracottaClass(Os.class.getName()); 296 loadTerracottaClass(Util.class.getName()); 297 loadTerracottaClass(NIOWorkarounds.class.getName()); 298 loadTerracottaClass(TCProperties.class.getName()); 299 loadTerracottaClass(ClusterEventListener.class.getName()); 300 301 loadTerracottaClass("com.tc.object.util.IdentityWeakHashMap"); 305 loadTerracottaClass("com.tc.object.util.IdentityWeakHashMap$TestKey"); 306 loadTerracottaClass("com.tc.object.bytecode.hook.impl.ArrayManager"); 307 308 loadTerracottaClass("com.tc.object.bytecode.NonDistributableObjectRegistry"); 309 310 loadTerracottaClass(JavaLangArrayHelpers.class.getName()); 311 312 loadTerracottaClass(ProxyInstance.class.getName()); 313 314 addManagementClasses(); 315 316 addSpringClasses(); 317 318 addSunStandardLoaders(); 319 addInstrumentedJavaLangThrowable(); 320 addInstrumentedJavaLangStringBuffer(); 321 addInstrumentedClassLoader(); 322 addInstrumentedJavaLangString(); 323 addInstrumentedProxy(); 324 addTreeMap(); 325 326 Map internalSpecs = getTCSpecs(); 327 loadBootJarClasses(removeAlreadyLoaded(massageSpecs(internalSpecs, true))); 328 329 Map userSpecs = massageSpecs(getUserDefinedSpecs(internalSpecs), false); 330 issueWarningsAndErrors(); 331 332 loadBootJarClasses(removeAlreadyLoaded(userSpecs)); 334 335 adaptClassIfNotAlreadyIncluded(BufferedWriter .class.getName(), BufferedWriterAdapter.class); 336 adaptClassIfNotAlreadyIncluded(DataOutputStream .class.getName(), DataOutputStreamAdapter.class); 337 338 } catch (Exception e) { 339 exit(bootJarHandler.getCreationErrorMessage(), e); 340 } 341 342 try { 343 bootJar.close(); 344 bootJarHandler.announceCreationEnd(); 345 } catch (IOException e) { 346 exit(bootJarHandler.getCloseErrorMessage(), e); 347 } catch (BootJarHandlerException e) { 348 exit(e.getMessage(), e.getCause()); 349 } 350 351 } 352 353 private void addManagementClasses() { 354 loadTerracottaClass(SessionMonitorMBean.class.getName()); 355 loadTerracottaClass(SessionMonitorMBean.class.getName() + "$SessionsComptroller"); 356 loadTerracottaClass(TerracottaMBean.class.getName()); 357 } 358 359 private boolean shouldIncludeStringBufferAndFriends() { 360 Map userSpecs = getUserDefinedSpecs(getTCSpecs()); 361 return userSpecs.containsKey("java.lang.StringBuffer") || userSpecs.containsKey("java.lang.AbstractStringBuilder") 362 || userSpecs.containsKey("java.lang.StringBuilder"); 363 364 } 365 366 private void addSpringClasses() { 367 374 375 loadTerracottaClass("com.tc.aspectwerkz.AspectContext"); 377 loadTerracottaClass("com.tc.aspectwerkz.DeploymentModel$PointcutControlledDeploymentModel"); 378 loadTerracottaClass("com.tc.aspectwerkz.DeploymentModel"); 379 loadTerracottaClass("com.tc.aspectwerkz.WeavedTestCase$WeaverTestRunner"); 380 loadTerracottaClass("com.tc.aspectwerkz.WeavedTestCase"); 381 loadTerracottaClass("com.tc.aspectwerkz.annotation.After"); 382 loadTerracottaClass("com.tc.aspectwerkz.annotation.AfterFinally"); 383 loadTerracottaClass("com.tc.aspectwerkz.annotation.AfterReturning"); 384 loadTerracottaClass("com.tc.aspectwerkz.annotation.AfterThrowing"); 385 loadTerracottaClass("com.tc.aspectwerkz.annotation.AnnotationConstants"); 386 loadTerracottaClass("com.tc.aspectwerkz.annotation.AnnotationInfo"); 387 loadTerracottaClass("com.tc.aspectwerkz.annotation.Around"); 388 loadTerracottaClass("com.tc.aspectwerkz.annotation.AsmAnnotations"); 389 loadTerracottaClass("com.tc.aspectwerkz.annotation.Aspect"); 390 loadTerracottaClass("com.tc.aspectwerkz.annotation.AspectAnnotationParser"); 391 loadTerracottaClass("com.tc.aspectwerkz.annotation.Before"); 392 loadTerracottaClass("com.tc.aspectwerkz.annotation.Expression"); 393 loadTerracottaClass("com.tc.aspectwerkz.annotation.Introduce"); 394 loadTerracottaClass("com.tc.aspectwerkz.annotation.Mixin"); 395 loadTerracottaClass("com.tc.aspectwerkz.annotation.MixinAnnotationParser"); 396 loadTerracottaClass("com.tc.aspectwerkz.aspect.AbstractAspectContainer"); 397 loadTerracottaClass("com.tc.aspectwerkz.aspect.AbstractMixinFactory"); 398 loadTerracottaClass("com.tc.aspectwerkz.aspect.AdviceInfo"); 399 loadTerracottaClass("com.tc.aspectwerkz.aspect.AdviceType"); 400 loadTerracottaClass("com.tc.aspectwerkz.aspect.Aspect"); 401 loadTerracottaClass("com.tc.aspectwerkz.aspect.AspectContainer"); 402 loadTerracottaClass("com.tc.aspectwerkz.aspect.DefaultAspectContainerStrategy"); 403 loadTerracottaClass("com.tc.aspectwerkz.aspect.DefaultMixinFactory"); 404 loadTerracottaClass("com.tc.aspectwerkz.aspect.MixinFactory"); 405 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.AbstractAspectFactoryCompiler"); 406 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.Artifact"); 407 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.AspectFactoryManager"); 408 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.LazyPerXFactoryCompiler$PerClassAspectFactoryCompiler"); 409 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.LazyPerXFactoryCompiler$PerThreadAspectFactoryCompiler"); 410 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.LazyPerXFactoryCompiler"); 411 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.PerCflowXAspectFactoryCompiler"); 412 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.PerJVMAspectFactoryCompiler"); 413 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.PerObjectFactoryCompiler$PerInstanceFactoryCompiler"); 414 loadTerracottaClass("com.tc.aspectwerkz.aspect.container.PerObjectFactoryCompiler"); 415 loadTerracottaClass("com.tc.aspectwerkz.aspect.management.Aspects"); 416 loadTerracottaClass("com.tc.aspectwerkz.aspect.management.HasInstanceLevelAspect"); 417 loadTerracottaClass("com.tc.aspectwerkz.aspect.management.Mixins"); 418 loadTerracottaClass("com.tc.aspectwerkz.aspect.management.NoAspectBoundException"); 419 loadTerracottaClass("com.tc.aspectwerkz.cflow.AbstractCflowSystemAspect$1"); 420 loadTerracottaClass("com.tc.aspectwerkz.cflow.AbstractCflowSystemAspect$Cflow_sample"); 421 loadTerracottaClass("com.tc.aspectwerkz.cflow.AbstractCflowSystemAspect"); 422 loadTerracottaClass("com.tc.aspectwerkz.cflow.CflowAspectExpressionVisitor"); 423 loadTerracottaClass("com.tc.aspectwerkz.cflow.CflowBinding"); 424 loadTerracottaClass("com.tc.aspectwerkz.cflow.CflowCompiler$CompiledCflowAspect"); 425 loadTerracottaClass("com.tc.aspectwerkz.cflow.CflowCompiler"); 426 loadTerracottaClass("com.tc.aspectwerkz.compiler.AspectWerkzC"); 427 loadTerracottaClass("com.tc.aspectwerkz.compiler.AspectWerkzCTask"); 428 loadTerracottaClass("com.tc.aspectwerkz.compiler.CompileException"); 429 loadTerracottaClass("com.tc.aspectwerkz.compiler.Utility"); 430 loadTerracottaClass("com.tc.aspectwerkz.compiler.VerifierClassLoader"); 431 loadTerracottaClass("com.tc.aspectwerkz.connectivity.Command"); 432 loadTerracottaClass("com.tc.aspectwerkz.connectivity.Invoker"); 433 loadTerracottaClass("com.tc.aspectwerkz.connectivity.RemoteProxy"); 434 loadTerracottaClass("com.tc.aspectwerkz.connectivity.RemoteProxyServer"); 435 loadTerracottaClass("com.tc.aspectwerkz.connectivity.RemoteProxyServerManager$1"); 436 loadTerracottaClass("com.tc.aspectwerkz.connectivity.RemoteProxyServerManager"); 437 loadTerracottaClass("com.tc.aspectwerkz.connectivity.RemoteProxyServerThread"); 438 loadTerracottaClass("com.tc.aspectwerkz.definition.AdviceDefinition"); 439 loadTerracottaClass("com.tc.aspectwerkz.definition.AspectDefinition"); 440 loadTerracottaClass("com.tc.aspectwerkz.definition.DefinitionParserHelper"); 441 loadTerracottaClass("com.tc.aspectwerkz.definition.DeploymentScope"); 442 loadTerracottaClass("com.tc.aspectwerkz.definition.DescriptorUtil"); 443 loadTerracottaClass("com.tc.aspectwerkz.definition.DocumentParser$PointcutInfo"); 444 loadTerracottaClass("com.tc.aspectwerkz.definition.DocumentParser"); 445 loadTerracottaClass("com.tc.aspectwerkz.definition.InterfaceIntroductionDefinition"); 446 loadTerracottaClass("com.tc.aspectwerkz.definition.MixinDefinition"); 447 loadTerracottaClass("com.tc.aspectwerkz.definition.Pointcut"); 448 loadTerracottaClass("com.tc.aspectwerkz.definition.PointcutDefinition"); 449 loadTerracottaClass("com.tc.aspectwerkz.definition.SystemDefinition"); 450 loadTerracottaClass("com.tc.aspectwerkz.definition.SystemDefinitionContainer"); 451 loadTerracottaClass("com.tc.aspectwerkz.definition.Virtual"); 452 loadTerracottaClass("com.tc.aspectwerkz.definition.XmlParser$1"); 453 loadTerracottaClass("com.tc.aspectwerkz.definition.XmlParser"); 454 loadTerracottaClass("com.tc.aspectwerkz.definition.aspectj5.Definition$ConcreteAspect"); 455 loadTerracottaClass("com.tc.aspectwerkz.definition.aspectj5.Definition$Pointcut"); 456 loadTerracottaClass("com.tc.aspectwerkz.definition.aspectj5.Definition"); 457 loadTerracottaClass("com.tc.aspectwerkz.definition.aspectj5.DocumentParser"); 458 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.AdviceDefinitionBuilder"); 459 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.AspectDefinitionBuilder"); 460 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.AspectModule"); 461 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.AspectModuleDeployer"); 462 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.DefinitionBuilder"); 463 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.MixinDefinitionBuilder"); 464 loadTerracottaClass("com.tc.aspectwerkz.definition.deployer.PointcutDefinitionBuilder"); 465 loadTerracottaClass("com.tc.aspectwerkz.env.EnvironmentDetector"); 466 loadTerracottaClass("com.tc.aspectwerkz.exception.DefinitionException"); 467 loadTerracottaClass("com.tc.aspectwerkz.exception.DefinitionNotFoundException"); 468 loadTerracottaClass("com.tc.aspectwerkz.exception.ExpressionException"); 469 loadTerracottaClass("com.tc.aspectwerkz.exception.WrappedRuntimeException"); 470 loadTerracottaClass("com.tc.aspectwerkz.expression.AdvisedClassFilterExpressionVisitor"); 471 loadTerracottaClass("com.tc.aspectwerkz.expression.ArgsIndexVisitor"); 472 loadTerracottaClass("com.tc.aspectwerkz.expression.DumpVisitor"); 473 loadTerracottaClass("com.tc.aspectwerkz.expression.ExpressionContext"); 474 loadTerracottaClass("com.tc.aspectwerkz.expression.ExpressionException"); 475 loadTerracottaClass("com.tc.aspectwerkz.expression.ExpressionInfo"); 476 loadTerracottaClass("com.tc.aspectwerkz.expression.ExpressionNamespace"); 477 loadTerracottaClass("com.tc.aspectwerkz.expression.ExpressionValidateVisitor"); 478 loadTerracottaClass("com.tc.aspectwerkz.expression.ExpressionVisitor"); 479 loadTerracottaClass("com.tc.aspectwerkz.expression.PointcutType"); 480 loadTerracottaClass("com.tc.aspectwerkz.expression.SubtypePatternType"); 481 loadTerracottaClass("com.tc.aspectwerkz.expression.Undeterministic"); 482 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTAnd"); 483 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTArgParameter"); 484 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTArgs"); 485 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTAttribute"); 486 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTCall"); 487 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTCflow"); 488 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTCflowBelow"); 489 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTClassPattern"); 490 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTConstructorPattern"); 491 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTExecution"); 492 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTExpression"); 493 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTFieldPattern"); 494 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTGet"); 495 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTHandler"); 496 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTHasField"); 497 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTHasMethod"); 498 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTIf"); 499 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTMethodPattern"); 500 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTModifier"); 501 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTNot"); 502 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTOr"); 503 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTParameter"); 504 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTPointcutReference"); 505 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTRoot"); 506 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTSet"); 507 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTStaticInitialization"); 508 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTTarget"); 509 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTThis"); 510 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTWithin"); 511 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ASTWithinCode"); 512 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParser$JJCalls"); 513 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParser$LookaheadSuccess"); 514 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParser"); 515 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParserConstants"); 516 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParserTokenManager"); 517 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParserTreeConstants"); 518 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ExpressionParserVisitor"); 519 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.JJTExpressionParserState"); 520 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.Node"); 521 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.ParseException"); 522 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.SimpleCharStream"); 523 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.SimpleNode"); 524 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.Token"); 525 loadTerracottaClass("com.tc.aspectwerkz.expression.ast.TokenMgrError"); 526 loadTerracottaClass("com.tc.aspectwerkz.expression.regexp.NamePattern"); 527 loadTerracottaClass("com.tc.aspectwerkz.expression.regexp.Pattern"); 528 loadTerracottaClass("com.tc.aspectwerkz.expression.regexp.TypePattern"); 529 loadTerracottaClass("com.tc.aspectwerkz.hook.AbstractStarter"); 530 loadTerracottaClass("com.tc.aspectwerkz.hook.BootClasspathStarter"); 531 loadTerracottaClass("com.tc.aspectwerkz.hook.ClassLoaderPatcher"); 532 loadTerracottaClass("com.tc.aspectwerkz.hook.ClassLoaderPreProcessor"); 533 loadTerracottaClass("com.tc.aspectwerkz.hook.ClassPreProcessor"); 534 loadTerracottaClass("com.tc.aspectwerkz.hook.StreamRedirectThread"); 535 loadTerracottaClass("com.tc.aspectwerkz.hook.impl.ClassPreProcessorHelper"); 536 loadTerracottaClass("com.tc.aspectwerkz.hook.impl.StdoutPreProcessor"); 537 loadTerracottaClass("com.tc.aspectwerkz.hook.impl.WeavingClassLoader"); 538 loadTerracottaClass("com.tc.aspectwerkz.intercept.Advice"); 539 loadTerracottaClass("com.tc.aspectwerkz.intercept.Advisable"); 540 loadTerracottaClass("com.tc.aspectwerkz.intercept.AdvisableImpl"); 541 loadTerracottaClass("com.tc.aspectwerkz.intercept.AfterAdvice"); 542 loadTerracottaClass("com.tc.aspectwerkz.intercept.AfterReturningAdvice"); 543 loadTerracottaClass("com.tc.aspectwerkz.intercept.AfterThrowingAdvice"); 544 loadTerracottaClass("com.tc.aspectwerkz.intercept.AroundAdvice"); 545 loadTerracottaClass("com.tc.aspectwerkz.intercept.BeforeAdvice"); 546 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.CatchClauseRtti"); 547 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.CatchClauseSignature"); 548 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.CodeRtti"); 549 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.CodeSignature"); 550 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.ConstructorRtti"); 551 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.ConstructorSignature"); 552 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.EnclosingStaticJoinPoint"); 553 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.FieldRtti"); 554 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.FieldSignature"); 555 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.JoinPoint"); 556 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.MemberRtti"); 557 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.MemberSignature"); 558 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.MethodRtti"); 559 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.MethodSignature"); 560 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.Rtti"); 561 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.Signature"); 562 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.StaticJoinPoint"); 563 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.CatchClauseRttiImpl"); 564 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.CatchClauseSignatureImpl"); 565 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.ConstructorRttiImpl"); 566 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.ConstructorSignatureImpl"); 567 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.EnclosingStaticJoinPointImpl"); 568 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.FieldRttiImpl"); 569 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.FieldSignatureImpl"); 570 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.MethodRttiImpl"); 571 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.MethodSignatureImpl"); 572 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.MethodTuple"); 573 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.StaticInitializationRttiImpl"); 574 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.impl.StaticInitializerSignatureImpl"); 575 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.management.AdviceInfoContainer"); 576 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.management.JoinPointManager$CompiledJoinPoint"); 577 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.management.JoinPointManager"); 578 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.management.JoinPointType"); 579 loadTerracottaClass("com.tc.aspectwerkz.joinpoint.management.SignatureFactory"); 580 loadTerracottaClass("com.tc.aspectwerkz.perx.PerObjectAspect"); 581 loadTerracottaClass("com.tc.aspectwerkz.proxy.ClassBytecodeRepository"); 582 loadTerracottaClass("com.tc.aspectwerkz.proxy.Proxy"); 583 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxyCompilerHelper$1"); 584 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxyCompilerHelper"); 585 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxyDelegationCompiler$ProxyCompilerClassVisitor"); 586 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxyDelegationCompiler"); 587 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxyDelegationStrategy$CompositeClassKey"); 588 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxyDelegationStrategy"); 589 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxySubclassingCompiler$ProxyCompilerClassVisitor"); 590 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxySubclassingCompiler"); 591 loadTerracottaClass("com.tc.aspectwerkz.proxy.ProxySubclassingStrategy"); 592 loadTerracottaClass("com.tc.aspectwerkz.proxy.Uuid"); 593 loadTerracottaClass("com.tc.aspectwerkz.reflect.CflowMetaData"); 594 loadTerracottaClass("com.tc.aspectwerkz.reflect.ClassInfo$NullClassInfo"); 595 loadTerracottaClass("com.tc.aspectwerkz.reflect.ClassInfo"); 596 loadTerracottaClass("com.tc.aspectwerkz.reflect.ClassInfoHelper"); 597 loadTerracottaClass("com.tc.aspectwerkz.reflect.ClassInfoRepository"); 598 loadTerracottaClass("com.tc.aspectwerkz.reflect.ClassList"); 599 loadTerracottaClass("com.tc.aspectwerkz.reflect.ConstructorInfo"); 600 loadTerracottaClass("com.tc.aspectwerkz.reflect.FieldInfo"); 601 loadTerracottaClass("com.tc.aspectwerkz.reflect.MemberInfo"); 602 loadTerracottaClass("com.tc.aspectwerkz.reflect.MetaDataInspector"); 603 loadTerracottaClass("com.tc.aspectwerkz.reflect.MethodComparator"); 604 loadTerracottaClass("com.tc.aspectwerkz.reflect.MethodInfo"); 605 loadTerracottaClass("com.tc.aspectwerkz.reflect.ReflectHelper"); 606 loadTerracottaClass("com.tc.aspectwerkz.reflect.ReflectionInfo"); 607 loadTerracottaClass("com.tc.aspectwerkz.reflect.StaticInitializationInfo"); 608 loadTerracottaClass("com.tc.aspectwerkz.reflect.StaticInitializationInfoImpl"); 609 loadTerracottaClass("com.tc.aspectwerkz.reflect.TypeConverter"); 610 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo$ClassInfoClassAdapter"); 611 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo$ClassNameRetrievalClassAdapter"); 612 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo$MethodParameterNamesCodeAdapter"); 613 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo"); 614 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfoRepository"); 615 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmConstructorInfo"); 616 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmFieldInfo"); 617 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmMemberInfo"); 618 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.AsmMethodInfo"); 619 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.FieldStruct"); 620 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.MemberStruct"); 621 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.asm.MethodStruct"); 622 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.java.JavaClassInfo"); 623 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.java.JavaClassInfoRepository"); 624 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.java.JavaConstructorInfo"); 625 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.java.JavaFieldInfo"); 626 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.java.JavaMemberInfo"); 627 loadTerracottaClass("com.tc.aspectwerkz.reflect.impl.java.JavaMethodInfo"); 628 loadTerracottaClass("com.tc.aspectwerkz.transform.AspectWerkzPreProcessor$Output"); 629 loadTerracottaClass("com.tc.aspectwerkz.transform.AspectWerkzPreProcessor"); 630 loadTerracottaClass("com.tc.aspectwerkz.transform.ByteArray"); 631 loadTerracottaClass("com.tc.aspectwerkz.transform.ClassCacheTuple"); 632 loadTerracottaClass("com.tc.aspectwerkz.transform.InstrumentationContext"); 633 loadTerracottaClass("com.tc.aspectwerkz.transform.JoinPointCompiler"); 634 loadTerracottaClass("com.tc.aspectwerkz.transform.Properties"); 635 loadTerracottaClass("com.tc.aspectwerkz.transform.TransformationConstants"); 636 loadTerracottaClass("com.tc.aspectwerkz.transform.TransformationUtil"); 637 loadTerracottaClass("com.tc.aspectwerkz.transform.WeavingStrategy"); 638 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AdviceMethodInfo"); 639 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmCopyAdapter$CopyAnnotationAdapter"); 640 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmCopyAdapter$CopyMethodAnnotationElseNullAdapter"); 641 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmCopyAdapter"); 642 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmHelper$1"); 643 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmHelper$2"); 644 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmHelper"); 645 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmNullAdapter$NullAnnotationVisitor"); 646 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmNullAdapter$NullClassAdapter"); 647 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmNullAdapter$NullFieldAdapter"); 648 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmNullAdapter$NullMethodAdapter"); 649 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AsmNullAdapter"); 650 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AspectInfo"); 651 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.AspectModelManager"); 652 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.EmittedJoinPoint"); 653 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.ProxyWeavingStrategy"); 654 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.AbstractJoinPointCompiler"); 655 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.CompilationInfo$Model"); 656 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.CompilationInfo"); 657 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.CompilerHelper"); 658 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.CompilerInput"); 659 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.ConstructorCallJoinPointCompiler"); 660 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.ConstructorCallJoinPointRedefiner"); 661 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.ConstructorExecutionJoinPointCompiler"); 662 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.ConstructorExecutionJoinPointRedefiner"); 663 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.FieldGetJoinPointCompiler"); 664 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.FieldGetJoinPointRedefiner"); 665 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.FieldSetJoinPointCompiler"); 666 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.FieldSetJoinPointRedefiner"); 667 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.HandlerJoinPointCompiler"); 668 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.HandlerJoinPointRedefiner"); 669 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.MatchingJoinPointInfo"); 670 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.MethodCallJoinPointCompiler"); 671 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.MethodCallJoinPointRedefiner"); 672 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.MethodExecutionJoinPointCompiler"); 673 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.MethodExecutionJoinPointRedefiner"); 674 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.RuntimeCheckVisitor"); 675 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.compiler.StaticInitializationJoinPointCompiler"); 676 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.ChangeSet$Element"); 677 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.ChangeSet"); 678 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.Deployer"); 679 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.DeploymentHandle$DefinitionChangeElement"); 680 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.DeploymentHandle"); 681 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.Redefiner"); 682 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.RedefinerFactory$Type"); 683 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.deployer.RedefinerFactory"); 684 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.model.AopAllianceAspectModel"); 685 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.model.AspectWerkzAspectModel$CustomProceedMethodStruct"); 686 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.model.AspectWerkzAspectModel"); 687 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.model.SpringAspectModel"); 688 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.spi.AspectModel$AroundClosureClassInfo$Type"); 689 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.spi.AspectModel$AroundClosureClassInfo"); 690 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.spi.AspectModel"); 691 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AddInterfaceVisitor"); 692 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AddMixinMethodsVisitor$AppendToInitMethodCodeAdapter"); 693 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AddMixinMethodsVisitor$MixinFieldInfo"); 694 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AddMixinMethodsVisitor$PrependToClinitMethodCodeAdapter"); 695 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AddMixinMethodsVisitor"); 696 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AddWrapperVisitor"); 697 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AfterObjectInitializationCodeAdapter"); 698 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AlreadyAddedMethodAdapter"); 699 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.AlreadyAddedMethodVisitor"); 700 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorBodyVisitor$DispatchCtorBodyCodeAdapter"); 701 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorBodyVisitor"); 702 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorCallVisitor$LookaheadNewDupInvokeSpecialInstructionClassAdapter"); 703 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorCallVisitor$LookaheadNewDupInvokeSpecialInstructionCodeAdapter"); 704 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorCallVisitor$NewInvocationStruct"); 705 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorCallVisitor$ReplaceNewInstructionCodeAdapter"); 706 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.ConstructorCallVisitor"); 707 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.FieldSetFieldGetVisitor$ReplacePutFieldAndGetFieldInstructionCodeAdapter"); 708 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.FieldSetFieldGetVisitor"); 709 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.HandlerVisitor$CatchClauseCodeAdapter"); 710 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.HandlerVisitor$CatchLabelStruct"); 711 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.HandlerVisitor$LookaheadCatchLabelsClassAdapter"); 712 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.HandlerVisitor$LookaheadCatchLabelsMethodAdapter"); 713 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.HandlerVisitor"); 714 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.InstanceLevelAspectVisitor$AppendToInitMethodCodeAdapter"); 715 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.InstanceLevelAspectVisitor"); 716 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.JoinPointInitVisitor$InsertBeforeClinitCodeAdapter"); 717 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.JoinPointInitVisitor$InsertBeforeInitJoinPointsCodeAdapter"); 718 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.JoinPointInitVisitor"); 719 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.LabelToLineNumberVisitor$1"); 720 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.LabelToLineNumberVisitor"); 721 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.MethodCallVisitor$ReplaceInvokeInstructionCodeAdapter"); 722 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.MethodCallVisitor"); 723 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.MethodExecutionVisitor$1"); 724 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.MethodExecutionVisitor"); 725 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor$Add"); 726 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor$FieldItem"); 727 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor$Item"); 728 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor$MethodItem"); 729 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor"); 730 loadTerracottaClass("com.tc.aspectwerkz.transform.inlining.weaver.StaticInitializationVisitor"); 731 loadTerracottaClass("com.tc.aspectwerkz.util.ContextClassLoader"); 732 loadTerracottaClass("com.tc.aspectwerkz.util.EnvironmentDetect"); 733 loadTerracottaClass("com.tc.aspectwerkz.util.SequencedHashMap$1"); 734 loadTerracottaClass("com.tc.aspectwerkz.util.SequencedHashMap$2"); 735 loadTerracottaClass("com.tc.aspectwerkz.util.SequencedHashMap$3"); 736 loadTerracottaClass("com.tc.aspectwerkz.util.SequencedHashMap$Entry"); 737 loadTerracottaClass("com.tc.aspectwerkz.util.SequencedHashMap$OrderedIterator"); 738 loadTerracottaClass("com.tc.aspectwerkz.util.SequencedHashMap"); 739 loadTerracottaClass("com.tc.aspectwerkz.util.SerializableThreadLocal"); 740 loadTerracottaClass("com.tc.aspectwerkz.util.Strings"); 741 loadTerracottaClass("com.tc.aspectwerkz.util.Util"); 742 loadTerracottaClass("com.tc.aspectwerkz.util.UuidGenerator"); 743 744 loadTerracottaClass("com.tc.asm.AnnotationVisitor"); 745 loadTerracottaClass("com.tc.asm.AnnotationWriter"); 746 loadTerracottaClass("com.tc.asm.Attribute"); 747 loadTerracottaClass("com.tc.asm.ByteVector"); 748 loadTerracottaClass("com.tc.asm.ClassAdapter"); 749 loadTerracottaClass("com.tc.asm.ClassReader"); 750 loadTerracottaClass("com.tc.asm.ClassVisitor"); 751 loadTerracottaClass("com.tc.asm.ClassWriter"); 752 loadTerracottaClass("com.tc.asm.Edge"); 753 loadTerracottaClass("com.tc.asm.FieldVisitor"); 754 loadTerracottaClass("com.tc.asm.FieldWriter"); 755 loadTerracottaClass("com.tc.asm.Handler"); 756 loadTerracottaClass("com.tc.asm.Item"); 757 loadTerracottaClass("com.tc.asm.Label"); 758 loadTerracottaClass("com.tc.asm.MethodAdapter"); 759 loadTerracottaClass("com.tc.asm.MethodVisitor"); 760 loadTerracottaClass("com.tc.asm.MethodWriter"); 761 loadTerracottaClass("com.tc.asm.Opcodes"); 762 loadTerracottaClass("com.tc.asm.Type"); 763 764 loadTerracottaClass("com.tc.asm.signature.SignatureReader"); 765 loadTerracottaClass("com.tc.asm.signature.SignatureVisitor"); 766 loadTerracottaClass("com.tc.asm.signature.SignatureWriter"); 767 768 loadTerracottaClass("com.tc.asm.commons.SerialVersionUIDAdder"); 769 loadTerracottaClass("com.tc.asm.commons.SerialVersionUIDAdder$Item"); 770 771 loadTerracottaClass("com.tc.backport175.Annotation"); 772 loadTerracottaClass("com.tc.backport175.Annotations"); 773 loadTerracottaClass("com.tc.backport175.ReaderException"); 774 775 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationDefaults"); 776 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationDefaults$AnnotationDefaultsClassVisitor"); 777 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationDefaults$AnnotationDefaultsMethodVisitor"); 778 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationDefaults$DefaultAnnotationBuilderVisitor"); 779 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement"); 780 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement$Annotation"); 781 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement$Array"); 782 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement$Enum"); 783 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement$NamedValue"); 784 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement$NestedAnnotationElement"); 785 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationElement$Type"); 786 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader"); 787 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$AnnotationBuilderVisitor"); 788 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$AnnotationRetrievingConstructorVisitor"); 789 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$AnnotationRetrievingFieldVisitor"); 790 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$AnnotationRetrievingMethodVisitor"); 791 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$AnnotationRetrievingVisitor"); 792 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$ClassKey"); 793 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$MemberKey"); 794 loadTerracottaClass("com.tc.backport175.bytecode.AnnotationReader$TraceAnnotationVisitor"); 795 loadTerracottaClass("com.tc.backport175.bytecode.DefaultBytecodeProvider"); 796 loadTerracottaClass("com.tc.backport175.bytecode.SignatureHelper"); 797 798 loadTerracottaClass("com.tc.backport175.bytecode.spi.BytecodeProvider"); 799 800 loadTerracottaClass("com.tc.backport175.proxy.JavaDocAnnotationInvocationHander"); 801 loadTerracottaClass("com.tc.backport175.proxy.ProxyFactory"); 802 loadTerracottaClass("com.tc.backport175.proxy.ResolveAnnotationException"); 803 804 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$IChangedListener"); 806 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$IState"); 807 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$IStateChangedListener"); 808 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$IStateVisitedListener"); 809 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$ITransitionVisitedListener"); 810 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$LinkedSet_State"); 811 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$State$Transition"); 812 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$State"); 813 loadTerracottaClass("com.tc.jrexx.automaton.Automaton$Wrapper_State"); 814 loadTerracottaClass("com.tc.jrexx.automaton.Automaton"); 815 loadTerracottaClass("com.tc.jrexx.automaton.IProperties"); 816 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$IPState"); 817 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$LinkedSet_PState"); 818 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$PProperties"); 819 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$PState"); 820 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat"); 821 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_GroupBegin"); 822 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_GroupEnd"); 823 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_LABEL"); 824 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_LITERAL"); 825 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_LITERALSET"); 826 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_RegExp"); 827 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern$TerminalFormat_REPETITION"); 828 loadTerracottaClass("com.tc.jrexx.regex.Automaton_Pattern"); 829 loadTerracottaClass("com.tc.jrexx.regex.InvalidExpression"); 830 loadTerracottaClass("com.tc.jrexx.regex.ParseException"); 831 loadTerracottaClass("com.tc.jrexx.regex.Pattern"); 832 loadTerracottaClass("com.tc.jrexx.regex.PatternPro"); 833 loadTerracottaClass("com.tc.jrexx.regex.PAutomaton$1"); 834 loadTerracottaClass("com.tc.jrexx.regex.PAutomaton$2"); 835 loadTerracottaClass("com.tc.jrexx.regex.PAutomaton"); 836 loadTerracottaClass("com.tc.jrexx.regex.PScanner"); 837 loadTerracottaClass("com.tc.jrexx.regex.Terminal_AndOp"); 838 loadTerracottaClass("com.tc.jrexx.regex.Terminal_EOF"); 839 loadTerracottaClass("com.tc.jrexx.regex.Terminal_GroupBegin"); 840 loadTerracottaClass("com.tc.jrexx.regex.Terminal_GroupEnd"); 841 loadTerracottaClass("com.tc.jrexx.regex.Terminal_NotOp"); 842 loadTerracottaClass("com.tc.jrexx.regex.Terminal_OrOp"); 843 loadTerracottaClass("com.tc.jrexx.regex.Terminal_RegExp"); 844 loadTerracottaClass("com.tc.jrexx.regex.Terminal_Repetition"); 845 846 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String"); 847 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$EClosureSet"); 848 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$Tupel"); 849 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$EClosure"); 850 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$Transition"); 851 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$ISState"); 852 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$ISStateChangedListener"); 853 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$LinkedSet_SState"); 854 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$SProperties"); 855 loadTerracottaClass("com.tc.jrexx.set.AutomatonSet_String$SState"); 856 loadTerracottaClass("com.tc.jrexx.set.CharSet"); 857 loadTerracottaClass("com.tc.jrexx.set.CharSet$IAbstract"); 858 loadTerracottaClass("com.tc.jrexx.set.CharSet$LongMap"); 859 loadTerracottaClass("com.tc.jrexx.set.CharSet$LongMapIterator"); 860 loadTerracottaClass("com.tc.jrexx.set.CharSet$Wrapper"); 861 loadTerracottaClass("com.tc.jrexx.set.DFASet"); 862 loadTerracottaClass("com.tc.jrexx.set.DFASet$State"); 863 loadTerracottaClass("com.tc.jrexx.set.DFASet$State$Transition"); 864 loadTerracottaClass("com.tc.jrexx.set.FSAData"); 865 loadTerracottaClass("com.tc.jrexx.set.FSAData$State"); 866 loadTerracottaClass("com.tc.jrexx.set.FSAData$State$Transition"); 867 loadTerracottaClass("com.tc.jrexx.set.ISet_char"); 868 loadTerracottaClass("com.tc.jrexx.set.ISet_char$Iterator"); 869 loadTerracottaClass("com.tc.jrexx.set.IState"); 870 loadTerracottaClass("com.tc.jrexx.set.IStatePro"); 871 loadTerracottaClass("com.tc.jrexx.set.IStatePro$IChangeListener"); 872 loadTerracottaClass("com.tc.jrexx.set.IStatePro$ITransition"); 873 loadTerracottaClass("com.tc.jrexx.set.IStatePro$IVisitListener"); 874 875 loadTerracottaClass("com.tc.jrexx.set.SAutomaton"); 876 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$IChangeListener"); 877 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$SAutomatonChangeListener"); 878 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$State"); 879 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$StatePro"); 880 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$StateProChangedListener"); 881 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$StateProVisitedListener"); 882 loadTerracottaClass("com.tc.jrexx.set.SAutomaton$Transition"); 883 884 loadTerracottaClass("com.tc.jrexx.set.SAutomatonData"); 885 loadTerracottaClass("com.tc.jrexx.set.SAutomatonData$State"); 886 loadTerracottaClass("com.tc.jrexx.set.SAutomatonData$State$Transition"); 887 loadTerracottaClass("com.tc.jrexx.set.StateProSet"); 888 loadTerracottaClass("com.tc.jrexx.set.StateProSet$Iterator"); 889 loadTerracottaClass("com.tc.jrexx.set.StateProSet$Wrapper_State"); 890 loadTerracottaClass("com.tc.jrexx.set.XML"); 891 } 892 893 private void addTreeMap() { 894 String className = "java.util.TreeMap"; 895 byte[] orig = getSystemBytes(className); 896 897 TransparencyClassSpec spec = config.getSpec(className); 898 899 byte[] transformed = doDSOTransform(className, orig); 900 901 ClassReader cr = new ClassReader(transformed); 902 ClassWriter cw = new ClassWriter(true); 903 904 ClassVisitor cv = new JavaUtilTreeMapAdapter(cw); 905 cr.accept(cv, false); 906 907 bootJar.loadClassIntoJar(className, cw.toByteArray(), spec.isPreInstrumented()); 908 } 909 910 private void issueWarningsAndErrors() { 911 issueErrors(nonExistingClasses, "could not be found", "remove or correct", 912 "Attempt to add classes that cannot be found: "); 913 issueErrors(notBootstrapClasses, 914 "are not loaded by the bootstap classloader and have not been included in the boot jar", "remove", 915 "Attempt to add classes that are not loaded by bootstrap classloader: "); 916 issueErrors(notAdaptableClasses, "are non-adaptable types and have not been included in the boot jar", "remove", 917 "Attempt to add non-adaptable classes: "); 918 issueErrors(logicalSubclasses, 919 "are subclasses of logically managed types and have not been included in the boot jar", "remove", 920 "Attempt to add subclasses of logically manages classes: "); 921 issueWarnings(autoIncludedBootstrapClasses, 922 "were automatically included in the boot jar since they are required super classes", "add"); 923 } 924 925 private void issueErrors(Set classes, String desc, String verb, String shortDesc) { 926 if (!classes.isEmpty()) { 927 Banner.errorBanner("Boot jar creation failed. The following set of classes " + desc + ". Please " + verb 928 + " them in the <additional-boot-jar-classes> section of the terracotta config: " + classes); 929 exit(shortDesc + classes, null); 930 } 931 } 932 933 private void issueWarnings(Set classes, String desc, String verb) { 934 if (!classes.isEmpty()) { 935 Banner.warnBanner("The following set of classes " + desc + ". Please " + verb 936 + " them in the <additional-boot-jar-classes> section of the terracotta config: " + classes); 937 } 938 } 939 940 private Map removeAlreadyLoaded(Map specs) { 941 Map rv = new HashMap (specs); 942 for (Iterator i = rv.keySet().iterator(); i.hasNext();) { 943 String className = (String ) i.next(); 944 if (bootJar.classLoaded(className)) { 945 i.remove(); 946 } 947 } 948 949 return Collections.unmodifiableMap(rv); 950 } 951 952 private Map massageSpecs(Map specs, boolean tcSpecs) { 953 Map rv = new HashMap (); 954 955 for (Iterator i = specs.values().iterator(); i.hasNext();) { 956 final TransparencyClassSpec spec = (TransparencyClassSpec) i.next(); 957 958 final Class topClass = getBootstrapClass(spec.getClassName()); 959 if (topClass == null) { 960 if (tcSpecs && !spec.isHonorJDKSubVersionSpecific()) { throw new AssertionError ("Class not found: " 961 + spec.getClassName()); } 962 if (!tcSpecs) { 963 nonExistingClasses.add(spec.getClassName()); 964 } 965 continue; 966 } else if (topClass.getClassLoader() != null) { 967 if (!tcSpecs) { 968 notBootstrapClasses.add(topClass.getName()); 969 continue; 970 } 971 } 972 973 Set supers = new HashSet (); 974 boolean add = true; 975 if (!config.isLogical(topClass.getName())) { 976 Class clazz = topClass; 977 while ((clazz != null) && (!portability.isInstrumentationNotNeeded(clazz.getName()))) { 978 if (config.isNeverAdaptable(JavaClassInfo.getClassInfo(clazz))) { 979 if (tcSpecs) { throw new AssertionError ("Not adaptable: " + clazz); } 980 981 add = false; 982 notAdaptableClasses.add(topClass.getName()); 983 break; 984 } 985 986 if ((clazz != topClass) && config.isLogical(clazz.getName())) { 987 if (tcSpecs) { throw new AssertionError (topClass + " is subclass of logical type " + clazz.getName()); } 988 989 add = false; 990 logicalSubclasses.add(topClass.getName()); 991 break; 992 } 993 994 if (!specs.containsKey(clazz.getName()) && !bootJar.classLoaded(clazz.getName())) { 995 if (tcSpecs) { 996 throw new AssertionError ("Missing super class " + clazz.getName() + " for type " + spec.getClassName()); 998 } 999 supers.add(clazz.getName()); 1000 } 1001 1002 clazz = clazz.getSuperclass(); 1003 } 1004 } 1005 1006 if (add) { 1007 rv.put(topClass.getName(), spec); 1009 1010 for (Iterator supes = supers.iterator(); supes.hasNext();) { 1012 String name = (String ) supes.next(); 1013 autoIncludedBootstrapClasses.add(name); 1014 TransparencyClassSpec superSpec = config.getOrCreateSpec(name); 1015 superSpec.markPreInstrumented(); 1016 rv.put(name, superSpec); 1017 } 1018 } 1019 } 1020 1021 return Collections.unmodifiableMap(rv); 1022 } 1023 1024 private static Class getBootstrapClass(String className) { 1025 try { 1026 return Class.forName(className, false, ClassLoader.getSystemClassLoader()); 1027 } catch (ClassNotFoundException e) { 1028 return null; 1029 } 1030 } 1031 1032 private void loadBootJarClasses(Map specs) { 1033 for (Iterator iter = specs.values().iterator(); iter.hasNext();) { 1034 TransparencyClassSpec spec = (TransparencyClassSpec) iter.next(); 1035 byte[] classBytes = doDSOTransform(spec.getClassName(), getSystemBytes(spec.getClassName())); 1036 announce("Adapting: " + spec.getClassName()); 1037 bootJar.loadClassIntoJar(spec.getClassName(), classBytes, spec.isPreInstrumented()); 1038 } 1039 } 1040 1041 private Map getTCSpecs() { 1042 Map map = new HashMap (); 1043 1044 TransparencyClassSpec[] allSpecs = config.getAllSpecs(); 1045 for (int i = 0; i < allSpecs.length; i++) { 1046 TransparencyClassSpec spec = allSpecs[i]; 1047 1048 if (!spec.isPreInstrumented()) { 1049 continue; 1050 } 1051 map.put(spec.getClassName(), spec); 1052 } 1053 1054 return Collections.unmodifiableMap(map); 1055 } 1056 1057 private Map getUserDefinedSpecs(Map internalSpecs) { 1058 Map rv = new HashMap (); 1059 1060 for (Iterator i = config.getAllUserDefinedBootSpecs(); i.hasNext();) { 1061 TransparencyClassSpec spec = (TransparencyClassSpec) i.next(); 1062 Assert.assertTrue(spec.isPreInstrumented()); 1063 1064 if (!portability.isInstrumentationNotNeeded(spec.getClassName())) { 1066 rv.put(spec.getClassName(), spec); 1067 } 1068 } 1069 1070 rv.keySet().removeAll(internalSpecs.keySet()); 1072 1073 return Collections.unmodifiableMap(rv); 1074 } 1075 1076 private void loadTerracottaClass(String className) { 1077 bootJar.loadClassIntoJar(className, getTerracottaBytes(className), false); 1078 } 1079 1080 private byte[] getTerracottaBytes(String className) { 1081 return getBytes(className, tcLoader); 1082 } 1083 1084 private byte[] getSystemBytes(String className) { 1085 return getBytes(className, systemLoader); 1086 } 1087 1088 private byte[] getBytes(String className, ClassLoader provider) { 1089 try { 1090 return getBytesForClass(className, provider); 1091 } catch (ClassNotFoundException e) { 1092 throw exit("Error sourcing bytes for class " + className, e); 1093 } 1094 } 1095 1096 public byte[] getBytesForClass(String className, ClassLoader loader) throws ClassNotFoundException { 1097 String resource = BootJar.classNameToFileName(className); 1098 1099 InputStream is = loader.getResourceAsStream(resource); 1100 if (is == null) { throw new ClassNotFoundException ("No resource found for class: " + className); } 1101 final int size = 4096; 1102 byte[] buffer = new byte[size]; 1103 ByteArrayOutputStream baos = new ByteArrayOutputStream (size); 1104 1105 int read; 1106 try { 1107 while ((read = is.read(buffer, 0, size)) > 0) { 1108 baos.write(buffer, 0, read); 1109 } 1110 } catch (IOException ioe) { 1111 throw new ClassNotFoundException ("Error reading bytes for " + resource, ioe); 1112 } finally { 1113 if (is != null) { 1114 try { 1115 is.close(); 1116 } catch (IOException ioe) { 1117 } 1119 } 1120 } 1121 1122 return baos.toByteArray(); 1123 } 1124 1125 private RuntimeException exit(String msg, Throwable t) { 1126 if (!WRITE_OUT_TEMP_FILE) { 1127 bootJar.setCreationErrorOccurred(true); 1128 } 1129 1130 if (bootJar != null) { 1131 try { 1132 bootJar.close(); 1133 } catch (Exception e) { 1134 e.printStackTrace(); 1135 } 1136 } 1137 1138 StringWriter sw = new StringWriter (); 1139 PrintWriter pw = new PrintWriter (sw); 1140 1141 if (t != null) { 1142 t.printStackTrace(pw); 1143 } 1144 1145 if (msg != null) { 1146 pw.println("\n*************** ERROR ***************\n* " + msg + "\n*************************************"); 1147 } 1148 1149 String output = sw.toString(); 1150 if (output.length() == 0) { 1151 new Throwable ("Unspecified error creating boot jar").printStackTrace(pw); 1152 output = sw.toString(); 1153 } 1154 1155 System.err.println(output); 1156 System.err.flush(); 1157 System.exit(1); 1158 1159 return new RuntimeException ("VM Should have exited"); 1160 } 1161 1162 private void addInstrumentedJavaLangStringBuffer() { 1163 boolean makePortable = shouldIncludeStringBufferAndFriends(); 1164 1165 if (makePortable) { 1166 addPortableStringBuffer(); 1167 } else { 1168 addNonPortableStringBuffer(); 1169 } 1170 } 1171 1172 private void addPortableStringBuffer() { 1173 boolean isJDK15 = isAtLeastJDK15(); 1174 if (isJDK15) { 1175 addAbstractStringBuilder(); 1176 } 1177 1178 byte[] bytes = getSystemBytes("java.lang.StringBuffer"); 1179 1180 ClassReader cr = new ClassReader(bytes); 1182 ClassWriter cw = new ClassWriter(true); 1183 ClassVisitor cv = new StringBufferAdapter(cw, Vm.VERSION); 1184 cr.accept(cv, false); 1185 bytes = cw.toByteArray(); 1186 1187 cr = new ClassReader(bytes); 1189 cw = new ClassWriter(true); 1190 cv = new DuplicateMethodAdapter(cw, Collections.singleton("getChars(II[CI)V")); 1191 cr.accept(cv, false); 1192 bytes = cw.toByteArray(); 1193 1194 TransparencyClassSpec spec = config.getOrCreateSpec("java.lang.StringBuffer"); 1196 spec.markPreInstrumented(); 1197 config.addWriteAutolock("* java.lang.StringBuffer.*(..)"); 1198 bytes = doDSOTransform(spec.getClassName(), bytes); 1199 1200 cr = new ClassReader(bytes); 1202 cw = new ClassWriter(true); 1203 cv = new StringGetCharsAdapter(cw, new String [] { "^" + DuplicateMethodAdapter.UNMANAGED_PREFIX + ".*" }); 1204 cr.accept(cv, false); 1205 bytes = cw.toByteArray(); 1206 1207 cr = new ClassReader(bytes); 1209 cw = new ClassWriter(true); 1210 cv = new StringBufferAdapter.FixUp(cw, Vm.VERSION); 1211 cr.accept(cv, false); 1212 bytes = cw.toByteArray(); 1213 1214 bootJar.loadClassIntoJar(spec.getClassName(), bytes, spec.isPreInstrumented()); 1215 } 1216 1217 private void addNonPortableStringBuffer() { 1218 1221 boolean isJDK15 = isAtLeastJDK15(); 1222 1223 String className = isJDK15 ? "java.lang.AbstractStringBuilder" : "java.lang.StringBuffer"; 1224 TransparencyClassSpec spec = config.getOrCreateSpec(className); 1225 spec.markPreInstrumented(); 1226 1227 byte[] bytes = getSystemBytes(className); 1228 1229 ClassReader cr = new ClassReader(bytes); 1230 ClassWriter cw = new ClassWriter(true); 1231 ClassVisitor cv = new StringGetCharsAdapter(cw, new String [] { ".*" }); 1232 cr.accept(cv, false); 1233 bytes = cw.toByteArray(); 1234 1235 bootJar.loadClassIntoJar(className, bytes, spec.isPreInstrumented()); 1236 } 1237 1238 private void addAbstractStringBuilder() { 1239 String className = "java.lang.AbstractStringBuilder"; 1240 1241 byte[] classBytes = getSystemBytes(className); 1242 1243 ClassReader cr = new ClassReader(classBytes); 1244 ClassWriter cw = new ClassWriter(true); 1245 ClassVisitor cv = new DuplicateMethodAdapter(cw, Collections.singleton("getChars(II[CI)V")); 1246 cr.accept(cv, false); 1247 classBytes = cw.toByteArray(); 1248 1249 TransparencyClassSpec spec = config.getOrCreateSpec(className); 1250 spec.markPreInstrumented(); 1251 1252 classBytes = doDSOTransform(className, classBytes); 1253 1254 cr = new ClassReader(classBytes); 1255 cw = new ClassWriter(true); 1256 cv = new AbstractStringBuilderAdapter(cw); 1257 cr.accept(cv, false); 1258 1259 cr = new ClassReader(cw.toByteArray()); 1260 cw = new ClassWriter(true); 1261 cv = new StringGetCharsAdapter(cw, new String [] { "^" + DuplicateMethodAdapter.UNMANAGED_PREFIX + ".*" }); 1262 cr.accept(cv, false); 1263 1264 bootJar.loadClassIntoJar(className, cw.toByteArray(), spec.isPreInstrumented()); 1265 } 1266 1267 private void addInstrumentedProxy() { 1268 String className = "java.lang.reflect.Proxy"; 1269 byte[] bytes = getSystemBytes(className); 1270 1271 ClassReader cr = new ClassReader(bytes); 1272 ClassWriter cw = new ClassWriter(true); 1273 1274 ClassVisitor cv = new JavaLangReflectProxyClassAdapter(cw); 1275 cr.accept(cv, false); 1276 1277 bytes = cw.toByteArray(); 1278 1279 TransparencyClassSpec spec = config.getOrCreateSpec(className); 1280 bytes = doDSOTransform(spec.getClassName(), bytes); 1281 bootJar.loadClassIntoJar(className, bytes, true); 1282 } 1283 1284 private void addInstrumentedJavaLangString() { 1285 byte[] orig = getSystemBytes("java.lang.String"); 1286 1287 ClassReader cr = new ClassReader(orig); 1288 ClassWriter cw = new ClassWriter(true); 1289 1290 ClassVisitor cv = new JavaLangStringAdapter(cw, Vm.VERSION, shouldIncludeStringBufferAndFriends()); 1291 cr.accept(cv, false); 1292 1293 bootJar.loadClassIntoJar("java.lang.String", cw.toByteArray(), false); 1294 } 1295 1296 private void addSunStandardLoaders() { 1297 byte[] orig = getSystemBytes("sun.misc.Launcher$AppClassLoader"); 1298 ClassReader cr = new ClassReader(orig); 1299 ClassWriter cw = new ClassWriter(true); 1300 ClassVisitor cv = new StandardClassLoaderAdapter(cw, Namespace.getStandardSystemLoaderName()); 1301 cr.accept(cv, false); 1302 bootJar.loadClassIntoJar("sun.misc.Launcher$AppClassLoader", cw.toByteArray(), false); 1303 1304 orig = getSystemBytes("sun.misc.Launcher$ExtClassLoader"); 1305 cr = new ClassReader(orig); 1306 cw = new ClassWriter(true); 1307 cv = new StandardClassLoaderAdapter(cw, Namespace.getStandardExtensionsLoaderName()); 1308 cr.accept(cv, false); 1309 bootJar.loadClassIntoJar("sun.misc.Launcher$ExtClassLoader", cw.toByteArray(), false); 1310 } 1311 1312 private void addInstrumentedJavaLangThrowable() { 1313 String className = "java.lang.Throwable"; 1314 byte[] orig = getSystemBytes(className); 1315 1316 TransparencyClassSpec spec = config.getOrCreateSpec(className); 1317 spec.markPreInstrumented(); 1318 spec.setHonorTransient(true); 1319 1320 byte[] instrumented = doDSOTransform(className, orig); 1321 1322 bootJar.loadClassIntoJar(className, instrumented, spec.isPreInstrumented()); 1323 } 1324 1325 1328 private void addInstrumentedJavaUtilConcurrentCyclicBarrier() { 1329 if (!isAtLeastJDK15()) { return; } 1330 1331 byte[] bytes = getSystemBytes("java.util.concurrent.CyclicBarrier"); 1332 1333 ClassReader cr = new ClassReader(bytes); 1334 ClassWriter cw = new ClassWriter(true); 1335 ClassVisitor cv = new JavaUtilConcurrentCyclicBarrierDebugClassAdapter(cw); 1336 1337 cr.accept(cv, false); 1338 1339 bytes = cw.toByteArray(); 1340 1341 TransparencyClassSpec spec = config.getOrCreateSpec("java.util.concurrent.CyclicBarrier"); 1342 bytes = doDSOTransform(spec.getClassName(), bytes); 1343 bootJar.loadClassIntoJar("java.util.concurrent.CyclicBarrier", bytes, true); 1344 } 1345 1346 private void addInstrumentedJavaUtilConcurrentHashMap() { 1347 if (!isAtLeastJDK15()) { return; } 1348 1349 loadTerracottaClass("com.tcclient.util.ConcurrentHashMapEntrySetWrapper"); 1350 loadTerracottaClass("com.tcclient.util.ConcurrentHashMapEntrySetWrapper$IteratorWrapper"); 1351 1352 byte[] bytes = getSystemBytes("java.util.concurrent.ConcurrentHashMap"); 1353 1354 ClassReader cr = new ClassReader(bytes); 1355 ClassWriter cw = new ClassWriter(true); 1356 ClassVisitor cv = new JavaUtilConcurrentHashMapAdapter(cw); 1357 1358 cr.accept(cv, false); 1359 1360 bytes = cw.toByteArray(); 1361 1362 TransparencyClassSpec spec = config.getOrCreateSpec("java.util.concurrent.ConcurrentHashMap", 1363 "com.tc.object.applicator.ConcurrentHashMapApplicator"); 1364 spec.setHonorTransient(true); 1365 spec.markPreInstrumented(); 1366 bytes = doDSOTransform(spec.getClassName(), bytes); 1367 bootJar.loadClassIntoJar("java.util.concurrent.ConcurrentHashMap", bytes, true); 1368 1369 bytes = getSystemBytes("java.util.concurrent.ConcurrentHashMap$Segment"); 1370 cr = new ClassReader(bytes); 1371 cw = new ClassWriter(true); 1372 cv = new JavaUtilConcurrentHashMapSegmentAdapter(cw); 1373 1374 cr.accept(cv, false); 1375 1376 bytes = cw.toByteArray(); 1377 1378 spec = config.getOrCreateSpec("java.util.concurrent.ConcurrentHashMap$Segment"); 1379 spec.setHonorTransient(true); 1380 spec.markPreInstrumented(); 1381 spec.setCallConstructorOnLoad(true); 1382 bytes = doDSOTransform(spec.getClassName(), bytes); 1383 bootJar.loadClassIntoJar("java.util.concurrent.ConcurrentHashMap$Segment", bytes, spec.isPreInstrumented()); 1384 1385 bytes = getTerracottaBytes("com.tcclient.util.ConcurrentHashMapEntrySetWrapper$EntryWrapper"); 1386 spec = config.getOrCreateSpec("com.tcclient.util.ConcurrentHashMapEntrySetWrapper$EntryWrapper"); 1387 spec.markPreInstrumented(); 1388 bytes = doDSOTransform(spec.getClassName(), bytes); 1389 bootJar.loadClassIntoJar("com.tcclient.util.ConcurrentHashMapEntrySetWrapper$EntryWrapper", bytes, spec 1390 .isPreInstrumented()); 1391 1392 bytes = getSystemBytes("java.util.concurrent.ConcurrentHashMap$Values"); 1393 spec = config.getOrCreateSpec("java.util.concurrent.ConcurrentHashMap$Values"); 1394 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1395 spec.markPreInstrumented(); 1396 bytes = doDSOTransform(spec.getClassName(), bytes); 1397 bootJar.loadClassIntoJar("java.util.concurrent.ConcurrentHashMap$Values", bytes, spec.isPreInstrumented()); 1398 1399 bytes = getSystemBytes("java.util.concurrent.ConcurrentHashMap$KeySet"); 1400 spec = config.getOrCreateSpec("java.util.concurrent.ConcurrentHashMap$KeySet"); 1401 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1402 spec.markPreInstrumented(); 1403 bytes = doDSOTransform(spec.getClassName(), bytes); 1404 bootJar.loadClassIntoJar("java.util.concurrent.ConcurrentHashMap$KeySet", bytes, spec.isPreInstrumented()); 1405 1406 bytes = getSystemBytes("java.util.concurrent.ConcurrentHashMap$HashIterator"); 1407 spec = config.getOrCreateSpec("java.util.concurrent.ConcurrentHashMap$HashIterator"); 1408 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1409 spec.markPreInstrumented(); 1410 bytes = doDSOTransform(spec.getClassName(), bytes); 1411 bootJar.loadClassIntoJar("java.util.concurrent.ConcurrentHashMap$HashIterator", bytes, spec.isPreInstrumented()); 1412 } 1413 1414 private void addInstrumentedJavaUtilConcurrentLinkedBlockingQueue() { 1415 if (!isAtLeastJDK15()) { return; } 1416 1417 byte[] bytes = getSystemBytes("java.util.concurrent.LinkedBlockingQueue$Itr"); 1419 1420 ClassReader cr = new ClassReader(bytes); 1421 ClassWriter cw = new ClassWriter(true); 1422 1423 ClassVisitor cv = new JavaUtilConcurrentLinkedBlockingQueueIteratorClassAdapter(cw); 1424 cr.accept(cv, false); 1425 1426 bytes = cw.toByteArray(); 1427 bootJar.loadClassIntoJar("java.util.concurrent.LinkedBlockingQueue$Itr", bytes, true); 1428 1429 bytes = getSystemBytes("java.util.concurrent.LinkedBlockingQueue$Node"); 1431 1432 cr = new ClassReader(bytes); 1433 cw = new ClassWriter(true); 1434 1435 cv = new JavaUtilConcurrentLinkedBlockingQueueNodeClassAdapter(cw); 1436 cr.accept(cv, false); 1437 1438 bytes = cw.toByteArray(); 1439 bootJar.loadClassIntoJar("java.util.concurrent.LinkedBlockingQueue$Node", bytes, true); 1440 1441 bytes = getSystemBytes("java.util.concurrent.LinkedBlockingQueue"); 1443 1444 cr = new ClassReader(bytes); 1445 cw = new ClassWriter(true); 1446 1447 cv = new JavaUtilConcurrentLinkedBlockingQueueClassAdapter(cw); 1448 cr.accept(cv, false); 1449 1450 bytes = cw.toByteArray(); 1451 1452 TransparencyClassSpec spec = config.getOrCreateSpec("java.util.concurrent.LinkedBlockingQueue", 1453 "com.tc.object.applicator.LinkedBlockingQueueApplicator"); 1454 spec.addMethodAdapter(SerializationUtil.TAKE_SIGNATURE, 1455 new JavaUtilConcurrentLinkedBlockingQueueAdapter.TakeAdapter()); 1456 spec.addMethodAdapter(SerializationUtil.POLL_TIMEOUT_SIGNATURE, 1457 new JavaUtilConcurrentLinkedBlockingQueueAdapter.TakeAdapter()); 1458 spec.addMethodAdapter(SerializationUtil.POLL_SIGNATURE, 1459 new JavaUtilConcurrentLinkedBlockingQueueAdapter.TakeAdapter()); 1460 spec.addMethodAdapter(SerializationUtil.CLEAR_SIGNATURE, 1461 new JavaUtilConcurrentLinkedBlockingQueueAdapter.ClearAdapter()); 1462 spec.addMethodAdapter(SerializationUtil.DRAIN_TO_SIGNATURE, 1463 new JavaUtilConcurrentLinkedBlockingQueueAdapter.ClearAdapter()); 1464 spec.addMethodAdapter(SerializationUtil.DRAIN_TO_N_SIGNATURE, 1465 new JavaUtilConcurrentLinkedBlockingQueueAdapter.RemoveFirstNAdapter()); 1466 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1467 spec.markPreInstrumented(); 1468 bytes = doDSOTransform(spec.getClassName(), bytes); 1469 bootJar.loadClassIntoJar("java.util.concurrent.LinkedBlockingQueue", bytes, spec.isPreInstrumented()); 1470 } 1471 1472 private void addInstrumentedJavaUtilConcurrentFutureTask() { 1473 1474 if (!isAtLeastJDK15()) { return; } 1475 Map instrumentedContext = new HashMap (); 1476 1477 TransparencyClassSpec spec = config.getOrCreateSpec("java.util.concurrent.FutureTask"); 1478 spec.setHonorTransient(true); 1479 spec.setCallConstructorOnLoad(true); 1480 spec.markPreInstrumented(); 1481 changeClassName("java.util.concurrent.FutureTaskTC", "java.util.concurrent.FutureTaskTC", 1482 "java.util.concurrent.FutureTask", instrumentedContext); 1483 1484 config.addWriteAutolock("* java.util.concurrent.FutureTask$Sync.*(..)"); 1485 1486 spec = config.getOrCreateSpec("java.util.concurrent.FutureTask$Sync"); 1487 spec.setHonorTransient(true); 1488 spec.markPreInstrumented(); 1489 spec.addDistributedMethodCall("managedInnerCancel", "()V", true); 1490 changeClassName("java.util.concurrent.FutureTaskTC$Sync", "java.util.concurrent.FutureTaskTC", 1491 "java.util.concurrent.FutureTask", instrumentedContext); 1492 } 1493 1494 private void addInstrumentedJavaUtilCollection() { 1495 TransparencyClassSpec spec = config.getOrCreateSpec("java.util.HashSet", 1496 "com.tc.object.applicator.HashSetApplicator"); 1497 spec.addIfTrueLogSpec(SerializationUtil.ADD_SIGNATURE); 1498 spec.addIfTrueLogSpec(SerializationUtil.REMOVE_SIGNATURE); 1499 spec.addAlwaysLogSpec(SerializationUtil.CLEAR_SIGNATURE); 1500 spec.addSetIteratorWrapperSpec(SerializationUtil.ITERATOR_SIGNATURE); 1501 addSerializationInstrumentedCode(spec); 1502 1503 spec = config.getOrCreateSpec("java.util.LinkedHashSet", "com.tc.object.applicator.HashSetApplicator"); 1504 addSerializationInstrumentedCode(spec); 1505 1506 spec = config.getOrCreateSpec("java.util.TreeSet", "com.tc.object.applicator.TreeSetApplicator"); 1507 spec.addIfTrueLogSpec(SerializationUtil.ADD_SIGNATURE); 1508 spec.addIfTrueLogSpec(SerializationUtil.REMOVE_SIGNATURE); 1509 spec.addAlwaysLogSpec(SerializationUtil.CLEAR_SIGNATURE); 1510 spec.addSetIteratorWrapperSpec(SerializationUtil.ITERATOR_SIGNATURE); 1511 spec.addViewSetWrapperSpec(SerializationUtil.SUBSET_SIGNATURE); 1512 spec.addViewSetWrapperSpec(SerializationUtil.HEADSET_SIGNATURE); 1513 spec.addViewSetWrapperSpec(SerializationUtil.TAILSET_SIGNATURE); 1514 addSerializationInstrumentedCode(spec); 1515 1516 spec = config.getOrCreateSpec("java.util.LinkedList", "com.tc.object.applicator.ListApplicator"); 1517 spec.addAlwaysLogSpec(SerializationUtil.ADD_AT_SIGNATURE); 1518 spec.addAlwaysLogSpec(SerializationUtil.ADD_SIGNATURE); 1519 spec.addAlwaysLogSpec(SerializationUtil.ADD_ALL_AT_SIGNATURE); 1520 spec.addAlwaysLogSpec(SerializationUtil.ADD_FIRST_SIGNATURE); 1521 spec.addAlwaysLogSpec(SerializationUtil.ADD_LAST_SIGNATURE); 1522 spec.addAlwaysLogSpec(SerializationUtil.SET_SIGNATURE); 1523 spec.addAlwaysLogSpec(SerializationUtil.CLEAR_SIGNATURE); 1524 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_FIRST_SIGNATURE); 1525 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_LAST_SIGNATURE); 1526 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_AT_SIGNATURE); 1527 spec.addIfTrueLogSpec(SerializationUtil.REMOVE_SIGNATURE); 1528 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_RANGE_SIGNATURE); 1529 spec.addMethodAdapter("listIterator(I)Ljava/util/ListIterator;", new LinkedListAdapter.ListIteratorAdapter()); 1530 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1531 addSerializationInstrumentedCode(spec); 1532 1533 spec = config.getOrCreateSpec("java.util.Vector", "com.tc.object.applicator.ListApplicator"); 1534 spec.addAlwaysLogSpec(SerializationUtil.INSERT_ELEMENT_AT_SIGNATURE); 1535 spec.addAlwaysLogSpec(SerializationUtil.ADD_SIGNATURE); 1536 spec.addAlwaysLogSpec(SerializationUtil.ADD_ALL_AT_SIGNATURE); 1537 spec.addAlwaysLogSpec(SerializationUtil.ADD_ALL_SIGNATURE); 1538 spec.addAlwaysLogSpec(SerializationUtil.ADD_ELEMENT_SIGNATURE); 1539 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_ALL_ELEMENTS_SIGNATURE); 1540 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_ELEMENT_AT_SIGNATURE); 1541 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_AT_SIGNATURE); 1542 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_RANGE_SIGNATURE); 1543 spec.addAlwaysLogSpec(SerializationUtil.SET_SIGNATURE); 1544 spec.addAlwaysLogSpec(SerializationUtil.SET_ELEMENT_SIGNATURE); 1545 spec.addAlwaysLogSpec(SerializationUtil.TRIM_TO_SIZE_SIGNATURE); 1546 spec.addAlwaysLogSpec(SerializationUtil.SET_SIZE_SIGNATURE); 1547 spec.addMethodAdapter(SerializationUtil.ELEMENTS_SIGNATURE, new VectorAdapter.ElementsAdapter()); 1548 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1549 spec.addArrayCopyMethodCodeSpec(SerializationUtil.COPY_INTO_SIGNATURE); 1550 addSerializationInstrumentedCode(spec); 1551 1552 spec = config.getOrCreateSpec("java.util.Stack", "com.tc.object.applicator.ListApplicator"); 1553 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1554 addSerializationInstrumentedCode(spec); 1555 1556 spec = config.getOrCreateSpec("java.util.ArrayList", "com.tc.object.applicator.ListApplicator"); 1557 spec.addAlwaysLogSpec(SerializationUtil.ADD_AT_SIGNATURE); 1558 spec.addAlwaysLogSpec(SerializationUtil.ADD_SIGNATURE); 1559 spec.addAlwaysLogSpec(SerializationUtil.ADD_ALL_AT_SIGNATURE); 1560 spec.addAlwaysLogSpec(SerializationUtil.ADD_ALL_SIGNATURE); 1561 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_AT_SIGNATURE); 1562 spec.addIfTrueLogSpec(SerializationUtil.REMOVE_SIGNATURE); 1563 spec.addAlwaysLogSpec(SerializationUtil.REMOVE_RANGE_SIGNATURE); 1564 spec.addAlwaysLogSpec(SerializationUtil.SET_SIGNATURE); 1565 spec.addAlwaysLogSpec(SerializationUtil.CLEAR_SIGNATURE); 1566 spec.addArrayCopyMethodCodeSpec(SerializationUtil.TO_ARRAY_SIGNATURE); 1567 addSerializationInstrumentedCode(spec); 1568 } 1569 1570 private void addSerializationInstrumentedCode(TransparencyClassSpec spec) { 1571 byte[] bytes = getSystemBytes(spec.getClassName()); 1572 spec.markPreInstrumented(); 1573 bytes = doDSOTransform(spec.getClassName(), bytes); 1574 1575 ClassReader cr = new ClassReader(bytes); 1576 ClassWriter cw = new ClassWriter(true); 1577 1578 ClassVisitor cv = new LogicalClassSerializationAdapter.LogicalClassSerializationClassAdapter(cw, spec 1579 .getClassName()); 1580 1581 cr.accept(cv, false); 1582 bytes = cw.toByteArray(); 1583 bootJar.loadClassIntoJar(spec.getClassName(), bytes, spec.isPreInstrumented()); 1584 1585 } 1586 1587 private void addInstrumentedHashtable() { 1588 String jMapClassNameDots = "java.util.Hashtable"; 1589 String tcMapClassNameDots = "java.util.HashtableTC"; 1590 Map instrumentedContext = new HashMap (); 1591 mergeClass(tcMapClassNameDots, jMapClassNameDots, instrumentedContext, HashtableClassAdapter.createMethod()); 1592 } 1593 1594 private void addInstrumentedLinkedHashMap(Map instrumentedContext) { 1595 String jMapClassNameDots = "java.util.LinkedHashMap"; 1596 String tcMapClassNameDots = "java.util.LinkedHashMapTC"; 1597 mergeClass(tcMapClassNameDots, jMapClassNameDots, instrumentedContext, null); 1598 } 1599 1600 private void addInstrumentedHashMap() { 1601 String jMapClassNameDots = "java.util.HashMap"; 1602 String tcMapClassNameDots = "java.util.HashMapTC"; 1603 Map instrumentedContext = new HashMap (); 1604 mergeClass(tcMapClassNameDots, jMapClassNameDots, instrumentedContext, null); 1605 1606 addInstrumentedLinkedHashMap(instrumentedContext); 1607 } 1608 1609 private void mergeClass(String tcClassNameDots, String jClassNameDots, Map instrumentedContext, 1610 final MethodNode replacedMethod) { 1611 byte[] tcData = getSystemBytes(tcClassNameDots); 1612 1613 ClassReader tcCR = new ClassReader(tcData); 1614 ClassNode tcCN = new ClassNode() { 1615 public MethodVisitor visitMethod(int maccess, String mname, String mdesc, String msignature, String [] mexceptions) { 1616 if (replacedMethod != null && mname.equals(replacedMethod.name) && mdesc.equals(replacedMethod.desc)) { 1617 methods.add(replacedMethod); 1618 return null; 1619 } 1620 return super.visitMethod(maccess, mname, mdesc, msignature, mexceptions); 1621 } 1622 }; 1623 tcCR.accept(tcCN, true); 1624 1625 byte[] jData = getSystemBytes(jClassNameDots); 1626 ClassReader jCR = new ClassReader(jData); 1627 ClassWriter cw = new ClassWriter(true); 1628 1629 ClassInfo jClassInfo = AsmClassInfo.getClassInfo(jClassNameDots, systemLoader); 1630 1631 TransparencyClassAdapter dsoAdapter = config.createDsoClassAdapterFor(cw, jClassInfo, instrumentationLogger, 1632 getClass().getClassLoader(), true); 1633 1634 ClassVisitor cv = new SerialVersionUIDAdder(new MergeTCToJavaClassAdapter(cw, dsoAdapter, jClassNameDots, 1635 tcClassNameDots, tcCN, 1636 instrumentedContext)); 1637 1638 jCR.accept(cv, false); 1639 jData = cw.toByteArray(); 1640 1641 bootJar.loadClassIntoJar(jClassNameDots, jData, true); 1642 1643 List innerClasses = tcCN.innerClasses; 1644 for (Iterator i = innerClasses.iterator(); i.hasNext();) { 1646 InnerClassNode innerClass = (InnerClassNode) i.next(); 1647 if (innerClass.outerName.equals(tcClassNameDots.replace(ChangeClassNameHierarchyAdapter.DOT_DELIMITER, 1648 ChangeClassNameHierarchyAdapter.SLASH_DELIMITER))) { 1649 changeClassNameAndGetBytes(innerClass.name, tcClassNameDots, jClassNameDots, instrumentedContext); 1650 } 1651 } 1652 for (Iterator i = innerClasses.iterator(); i.hasNext();) { 1654 InnerClassNode innerClass = (InnerClassNode) i.next(); 1655 if (innerClass.outerName.equals(tcClassNameDots.replace(ChangeClassNameHierarchyAdapter.DOT_DELIMITER, 1656 ChangeClassNameHierarchyAdapter.SLASH_DELIMITER))) { 1657 changeClassName(innerClass.name, tcClassNameDots, jClassNameDots, instrumentedContext); 1658 } 1659 } 1660 } 1661 1662 private void changeClassName(String fullClassNameDots, String classNameDotsToBeChanged, String classNameDotsReplaced, 1663 Map instrumentedContext) { 1664 byte[] data = changeClassNameAndGetBytes(fullClassNameDots, classNameDotsToBeChanged, classNameDotsReplaced, 1665 instrumentedContext); 1666 1667 String replacedClassName = ChangeClassNameRootAdapter.replaceClassName(fullClassNameDots, classNameDotsToBeChanged, 1668 classNameDotsReplaced); 1669 ClassInfo replacedClassInfo = AsmClassInfo.getClassInfo(replacedClassName, systemLoader); 1670 1671 ClassWriter cw = new ClassWriter(true); 1672 ClassReader cr = new ClassReader(data); 1673 ClassVisitor dsoAdapter = config.createDsoClassAdapterFor(cw, replacedClassInfo, instrumentationLogger, getClass().getClassLoader(), true); 1675 cr.accept(dsoAdapter, false); 1676 1677 bootJar.loadClassIntoJar(replacedClassName, cw.toByteArray(), true); 1678 } 1679 1680 private byte[] changeClassNameAndGetBytes(String fullClassNameDots, String classNameDotsToBeChanged, 1681 String classNameDotsReplaced, Map instrumentedContext) { 1682 ClassReader cr = new ClassReader(getSystemBytes(fullClassNameDots)); 1683 ClassWriter cw = new ClassWriter(true); 1684 ClassVisitor cv = new ChangeClassNameRootAdapter(cw, fullClassNameDots, classNameDotsToBeChanged, 1685 classNameDotsReplaced, instrumentedContext, null); 1686 cr.accept(cv, false); 1687 1688 byte[] data = cw.toByteArray(); 1689 1690 AsmClassInfo.getClassInfo(data, systemLoader); 1691 1692 return data; 1693 } 1694 1695 private byte[] changePackageAndGetBytes(String className, byte[] data, String targetClassName, 1696 String targetPackageName, String newPackageName) { 1697 ClassReader cr = new ClassReader(data); 1698 ClassWriter cw = new ClassWriter(true); 1699 1700 ClassInfo classInfo = AsmClassInfo.getClassInfo(className, systemLoader); 1701 1702 ClassVisitor cv = config.createClassAdapterFor(cw, classInfo, instrumentationLogger, getClass().getClassLoader(), 1703 true); 1704 cv = new ChangePackageClassAdapter(cv, targetClassName, targetPackageName, newPackageName, null); 1705 cr.accept(cv, false); 1706 1707 return cw.toByteArray(); 1708 } 1709 1710 private void addInstrumentedJavaUtilConcurrentLocksReentrantLock() { 1711 if (!isAtLeastJDK15()) { return; } 1712 1713 byte[] bytes = getSystemBytes("com.tc.util.concurrent.locks.ReentrantLock"); 1714 TransparencyClassSpec spec = config.getOrCreateSpec("com.tc.util.concurrent.locks.ReentrantLock"); 1715 spec.setHonorTransient(true); 1716 spec.setCallConstructorOnLoad(true); 1717 spec.markPreInstrumented(); 1718 bytes = changePackageAndGetBytes("com.tc.util.concurrent.locks.ReentrantLock", bytes, "ReentrantLock", 1719 "com.tc.util.concurrent.locks", "java.util.concurrent.locks"); 1720 bootJar.loadClassIntoJar("java.util.concurrent.locks.ReentrantLock", bytes, spec.isPreInstrumented()); 1721 1722 config.removeSpec("com.tc.util.concurrent.locks.ReentrantLock"); 1726 1727 bytes = getSystemBytes("com.tc.util.concurrent.locks.ReentrantLock$ConditionObject"); 1728 spec = config.getOrCreateSpec("com.tc.util.concurrent.locks.ReentrantLock$ConditionObject"); 1729 spec.disableWaitNotifyCodeSpec("signal()V"); 1730 spec.disableWaitNotifyCodeSpec("signalAll()V"); 1731 spec.setHonorTransient(true); 1732 spec.markPreInstrumented(); 1733 bytes = changePackageAndGetBytes("com.tc.util.concurrent.locks.ReentrantLock$ConditionObject", bytes, 1734 "ReentrantLock", "com.tc.util.concurrent.locks", "java.util.concurrent.locks"); 1735 bootJar.loadClassIntoJar("java.util.concurrent.locks.ReentrantLock$ConditionObject", bytes, spec 1736 .isPreInstrumented()); 1737 1738 config.removeSpec("com.tc.util.concurrent.locks.ReentrantLock$ConditionObject"); 1739 1740 bytes = getSystemBytes("com.tc.util.concurrent.locks.ReentrantLock$SyncCondition"); 1741 spec = config.getOrCreateSpec("com.tc.util.concurrent.locks.ReentrantLock$SyncCondition"); 1742 spec.markPreInstrumented(); 1743 bytes = changePackageAndGetBytes("com.tc.util.concurrent.locks.ReentrantLock$SyncCondition", bytes, 1744 "ReentrantLock", "com.tc.util.concurrent.locks", "java.util.concurrent.locks"); 1745 bootJar.loadClassIntoJar("java.util.concurrent.locks.ReentrantLock$SyncCondition", bytes, spec.isPreInstrumented()); 1746 1747 config.removeSpec("com.tc.util.concurrent.locks.ReentrantLock$SyncCondition"); 1748 1749 } 1750 1751 private void addInstrumentedWeakHashMap() { 1752 ClassReader reader = new ClassReader(getSystemBytes("java.util.WeakHashMap")); 1753 ClassWriter writer = new ClassWriter(true); 1754 1755 ClassVisitor cv = new JavaUtilWeakHashMapAdapter().create(writer, null); 1756 1757 reader.accept(cv, false); 1758 1759 bootJar.loadClassIntoJar("java.util.WeakHashMap", writer.toByteArray(), false); 1760 } 1761 1762 private void addInstrumentedClassLoader() { 1763 ClassLoaderPreProcessorImpl adapter = new ClassLoaderPreProcessorImpl(); 1765 byte[] patched = adapter.preProcess(getSystemBytes("java.lang.ClassLoader")); 1766 1767 ClassReader reader = new ClassReader(patched); 1768 ClassWriter writer = new ClassWriter(true); 1769 1770 ClassVisitor cv = new NamedLoaderAdapter().create(writer, null); 1771 1772 reader.accept(cv, false); 1773 1774 bootJar.loadClassIntoJar("java.lang.ClassLoader", writer.toByteArray(), false); 1775 } 1776 1777 protected byte[] doDSOTransform(String name, byte[] data) { 1778 ClassReader cr = new ClassReader(data); 1780 ClassWriter cw = new ClassWriter(true); 1781 1782 ClassInfo classInfo = AsmClassInfo.getClassInfo(data, tcLoader); 1783 ClassVisitor cv = config.createClassAdapterFor(cw, classInfo, instrumentationLogger, getClass().getClassLoader(), 1784 true); 1785 cr.accept(cv, false); 1786 1787 return cw.toByteArray(); 1788 } 1789 1790 private void adaptClassIfNotAlreadyIncluded(String className, Class adapter) { 1791 if (bootJar.classLoaded(className)) { return; } 1792 1793 byte[] orig = getSystemBytes(className); 1794 1795 ClassReader cr = new ClassReader(orig); 1796 ClassWriter cw = new ClassWriter(true); 1797 1798 ClassVisitor cv; 1799 try { 1800 cv = (ClassVisitor) adapter.getConstructor(new Class [] { ClassVisitor.class }).newInstance(new Object [] { cw }); 1801 } catch (Exception e) { 1802 throw exit("Can't instaniate class apapter using class " + adapter, e); 1803 } 1804 cr.accept(cv, false); 1805 1806 bootJar.loadClassIntoJar(className, cw.toByteArray(), false); 1807 } 1808 1809 protected void announce(String msg) { 1810 if (!quiet) System.out.println(msg); 1811 } 1812 1813 private static File getInstallationDir() { 1814 try { 1815 return Directories.getInstallationRoot(); 1816 } catch (FileNotFoundException fnfe) { 1817 return null; 1818 } 1819 } 1820 1821 public static void main(String [] args) throws Exception { 1822 File installDir = getInstallationDir(); 1823 String outputFileOptionMsg = "path to store boot JAR" 1824 + (installDir != null ? "\ndefault: [TC_INSTALL_DIR]/lib/dso-boot" : ""); 1825 Option targetFileOption = new Option(OUTPUT_FILE_OPTION, true, outputFileOptionMsg); 1826 targetFileOption.setArgName("file"); 1827 targetFileOption.setLongOpt("output-file"); 1828 targetFileOption.setArgs(1); 1829 targetFileOption.setRequired(installDir == null); 1830 targetFileOption.setType(String .class); 1831 1832 Option configFileOption = new Option("f", "config", true, "configuration file (optional)"); 1833 configFileOption.setArgName("file-or-URL"); 1834 configFileOption.setType(String .class); 1835 configFileOption.setRequired(false); 1836 1837 Option verboseOption = new Option("v", "verbose"); 1838 verboseOption.setType(String .class); 1839 verboseOption.setRequired(false); 1840 1841 Option helpOption = new Option("h", "help"); 1842 helpOption.setType(String .class); 1843 helpOption.setRequired(false); 1844 1845 Options options = new Options(); 1846 options.addOption(targetFileOption); 1847 options.addOption(configFileOption); 1848 options.addOption(verboseOption); 1849 options.addOption(helpOption); 1850 1851 CommandLine commandLine = null; 1852 1853 try { 1854 commandLine = new PosixParser().parse(options, args); 1855 } catch (ParseException pe) { 1856 new HelpFormatter().printHelp("java " + BootJarTool.class.getName(), options); 1857 System.exit(1); 1858 } 1859 1860 if (commandLine.hasOption("h")) { 1861 new HelpFormatter().printHelp("java " + BootJarTool.class.getName(), options); 1862 System.exit(1); 1863 } 1864 1865 if (!commandLine.hasOption("f")) { 1866 String cwd = System.getProperty("user.dir"); 1867 File localConfig = new File (cwd, DEFAULT_CONFIG_SPEC); 1868 String configSpec; 1869 1870 if (localConfig.exists()) { 1871 configSpec = localConfig.getAbsolutePath(); 1872 } else { 1873 String packageName = BootJarTool.class.getPackage().getName(); 1874 configSpec = "resource:///" + packageName.replace('.', '/') + "/" + DEFAULT_CONFIG_PATH; 1875 } 1876 1877 String [] newArgs = new String [args.length + 2]; 1878 System.arraycopy(args, 0, newArgs, 0, args.length); 1879 newArgs[newArgs.length - 2] = "-f"; 1880 newArgs[newArgs.length - 1] = configSpec; 1881 1882 commandLine = new PosixParser().parse(options, newArgs); 1883 } 1884 1885 StandardTVSConfigurationSetupManagerFactory factory; 1886 factory = new StandardTVSConfigurationSetupManagerFactory(commandLine, false, 1887 new FatalIllegalConfigurationChangeHandler()); 1888 boolean verbose = commandLine.hasOption("v"); 1889 TCLogger logger = verbose ? CustomerLogging.getConsoleLogger() : new NullTCLogger(); 1890 L1TVSConfigurationSetupManager config = factory.createL1TVSConfigurationSetupManager(logger); 1891 1892 File outputFile; 1893 1894 if (!commandLine.hasOption(OUTPUT_FILE_OPTION)) { 1895 File libDir = new File (installDir, "lib"); 1896 outputFile = new File (libDir, "dso-boot"); 1897 if (!outputFile.exists()) { 1898 outputFile.mkdirs(); 1899 } 1900 } else { 1901 outputFile = new File (commandLine.getOptionValue(OUTPUT_FILE_OPTION)).getAbsoluteFile(); 1902 } 1903 1904 if (outputFile.isDirectory()) { 1905 outputFile = new File (outputFile, BootJarSignature.getBootJarNameForThisVM()); 1906 } 1907 1908 1912 ClassLoader systemLoader = ClassLoader.getSystemClassLoader(); 1913 new BootJarTool(new StandardDSOClientConfigHelper(config, false), outputFile, systemLoader, !verbose).generateJar(); 1914 } 1915 1916} 1917 | Popular Tags |