├── .github └── workflows │ └── maven.yaml ├── .gitignore ├── .hgtags ├── .jcheck └── conf ├── LICENSE ├── README.html ├── README.md ├── build ├── build.properties ├── build.xml └── productinfo.properties ├── docs ├── Class00.jasm ├── Class00.java ├── Class00_1.jasm ├── UsingTools.html ├── UsingTools.md ├── jasm.html └── jasm.md ├── maven ├── mvngen.sh └── pom.xml.in ├── src └── org │ └── openjdk │ └── asmtools │ ├── Main.java │ ├── asmutils │ ├── FormatConsumer.java │ ├── HexUtils.java │ ├── Pair.java │ ├── Range.java │ ├── StringUtils.java │ └── Triplet.java │ ├── common │ ├── Compiler.java │ ├── CompilerConstants.java │ ├── CompilerLogger.java │ ├── Decoder.java │ ├── DecompilerLogger.java │ ├── EMessageKind.java │ ├── Environment.java │ ├── ErrorMessage.java │ ├── FormatError.java │ ├── ILogger.java │ ├── NotImplementedException.java │ ├── SyntaxError.java │ ├── Tool.java │ ├── ToolLogger.java │ ├── TriFunction.java │ ├── inputs │ │ ├── ByteInput.java │ │ ├── FileInput.java │ │ ├── StdinInput.java │ │ ├── StreamInput.java │ │ ├── StringInput.java │ │ ├── TextInput.java │ │ └── ToolInput.java │ ├── outputs │ │ ├── ByteOutput.java │ │ ├── EscapedPrintStreamOutput.java │ │ ├── FSOutput.java │ │ ├── NamedToolOutput.java │ │ ├── PrintWriterOutput.java │ │ ├── StdoutOutput.java │ │ ├── TextOutput.java │ │ ├── ToolOutput.java │ │ └── log │ │ │ ├── DualOutputStreamOutput.java │ │ │ ├── DualStreamToolOutput.java │ │ │ ├── NamedDualStreamToolOutput.java │ │ │ ├── SingleDualOutputStreamOutput.java │ │ │ ├── StderrLog.java │ │ │ └── StringLog.java │ ├── structure │ │ ├── CFVersion.java │ │ ├── ClassFileContext.java │ │ ├── EAttribute.java │ │ ├── ELocation.java │ │ ├── EModifier.java │ │ └── StackMap.java │ └── uEscWriter.java │ ├── i18n.properties │ ├── jasm │ ├── AnnotationData.java │ ├── ArrayAttr.java │ ├── AttrData.java │ ├── BootstrapMethodData.java │ ├── CPTagVisitor.java │ ├── CPVisitor.java │ ├── CPXAttr.java │ ├── CheckedDataOutputStream.java │ ├── Checker.java │ ├── ClassData.java │ ├── ClassFileConst.java │ ├── CodeAttr.java │ ├── ConstCell.java │ ├── ConstValue.java │ ├── ConstantPool.java │ ├── ConstantPoolDataVisitor.java │ ├── ConstantPoolIndexData.java │ ├── DataVector.java │ ├── DataVectorAttr.java │ ├── DataWriter.java │ ├── DefaultAnnotationAttr.java │ ├── EnclosingMethodAttr.java │ ├── ExceptionData.java │ ├── FieldData.java │ ├── FieldType.java │ ├── Indexer.java │ ├── InnerClassData.java │ ├── Instr.java │ ├── JasmEnvironment.java │ ├── JasmTokens.java │ ├── JasmTool.java │ ├── LineNumberData.java │ ├── LoadableDescriptorsAttr.java │ ├── LocalVariableData.java │ ├── Main.java │ ├── MemberData.java │ ├── MethodData.java │ ├── ModuleAttr.java │ ├── NameInfo.java │ ├── NestMembersAttr.java │ ├── OpcodeTables.java │ ├── ParseAnnotation.java │ ├── ParseAttribute.java │ ├── ParseBase.java │ ├── ParseConstPool.java │ ├── ParseInstruction.java │ ├── Parser.java │ ├── PermittedSubclassesAttr.java │ ├── RecordData.java │ ├── Scanner.java │ ├── SourceDebugExtensionAttr.java │ ├── SourceFileAttr.java │ ├── StackMapData.java │ ├── SwitchTable.java │ ├── TableFormatModel.java │ ├── TypeAnnotationData.java │ ├── TypeAnnotationTargetInfoData.java │ ├── TypeAnnotationTypePathData.java │ ├── TypeAnnotationTypes.java │ └── i18n.properties │ ├── jcoder │ ├── ByteBuffer.java │ ├── JcodTokens.java │ ├── Jcoder.java │ ├── JcoderEnvironment.java │ ├── JcoderTool.java │ ├── Main.java │ ├── Scanner.java │ └── i18n.properties │ ├── jdec │ ├── ClassData.java │ ├── JdecEnvironment.java │ ├── JdecTool.java │ ├── Main.java │ ├── NestedByteArrayInputStream.java │ └── i18n.properties │ ├── jdis │ ├── AnnotationData.java │ ├── AnnotationElement.java │ ├── AttrData.java │ ├── AttributeData.java │ ├── BootstrapMethodData.java │ ├── ClassArrayData.java │ ├── ClassData.java │ ├── CodeData.java │ ├── ConstantPool.java │ ├── Container.java │ ├── Element.java │ ├── EnclosingMethodData.java │ ├── ExceptionData.java │ ├── FieldData.java │ ├── Indenter.java │ ├── InnerClassData.java │ ├── InstructionAttr.java │ ├── JdisEnvironment.java │ ├── JdisTool.java │ ├── LineNumberData.java │ ├── LoadableDescriptorsData.java │ ├── LocalData.java │ ├── LocalVariableData.java │ ├── LocalVariableTypeData.java │ ├── Main.java │ ├── Measurable.java │ ├── MemberData.java │ ├── MethodData.java │ ├── ModuleContent.java │ ├── ModuleData.java │ ├── NestHostData.java │ ├── NestMembersData.java │ ├── Options.java │ ├── ParameterAnnotationData.java │ ├── PermittedSubclassesData.java │ ├── Printable.java │ ├── RecordData.java │ ├── SignatureData.java │ ├── SourceDebugExtensionData.java │ ├── SourceFileData.java │ ├── StackMapData.java │ ├── StackMapTable.java │ ├── TextLines.java │ ├── TrapData.java │ ├── TypeAnnotationData.java │ ├── Utf8ArrayData.java │ ├── Utils.java │ ├── i18n.properties │ └── notations │ │ ├── Descriptor.java │ │ ├── DescriptorException.java │ │ ├── Signature.java │ │ └── Type.java │ └── util │ ├── I18NResourceBundle.java │ ├── ProductInfo.java │ └── productinfo.properties └── test ├── java └── org │ └── openjdk │ └── asmtools │ ├── attribute │ ├── BootstrapMethods │ │ ├── BootstrapMethodsAttributeTests.java │ │ ├── Case7903791.java │ │ └── data │ │ │ ├── BootstrapExample01.java │ │ │ └── BootstrapExample02.java │ ├── ConstantValue │ │ └── ConstantValueAttributeTests.java │ ├── LoadableDescriptors │ │ └── LoadableDescriptorsTests.java │ ├── NestHost │ │ └── NestHostTests.java │ ├── NestMembers │ │ └── NestMembersTests.java │ ├── PermittedSubclasses │ │ └── PermittedSubclassesTests.java │ └── StackMapTable │ │ ├── StackMapTableTests.java │ │ └── data │ │ └── StackMapData.java │ ├── common │ ├── InputOutputTests.java │ ├── SequenceCallsTests.java │ └── data │ │ └── TestedHelloWorld.java │ ├── jasm │ ├── MultipleFilesInSingleJasmTest.java │ ├── case7902696 │ │ └── JasmTests.java │ ├── case7902820 │ │ └── JcodTests.java │ ├── case7903031 │ │ └── TransformationTest.java │ ├── case7903405 │ │ └── NegativeJasmTests.java │ ├── case7903558 │ │ └── Tests.java │ ├── case7903976 │ │ └── Tests.java │ ├── case7903987 │ │ └── Tests.java │ └── package-info.java │ ├── jcoder │ └── MultipleFilesInSingleJcoderTest.java │ ├── jdec │ ├── JdecJcod.java │ ├── JdecJcodTest.java │ └── MainTest.java │ ├── jdis │ ├── JdisJasm.java │ ├── JdisJasmTest.java │ └── MainTest.java │ ├── lib │ ├── action │ │ ├── Action.java │ │ ├── CompileActor.java │ │ ├── DebugHelper.java │ │ ├── DecodeActor.java │ │ ├── EAsmTool.java │ │ ├── EToolArguments.java │ │ ├── FSAction.java │ │ ├── Jasm.java │ │ ├── Jcoder.java │ │ ├── Jdec.java │ │ └── Jdis.java │ ├── attributes │ │ └── Attribute.java │ ├── ext │ │ ├── CaptureSystemOutput.java │ │ └── CaptureSystemOutputExtension.java │ ├── helper │ │ ├── BruteForceHelper.java │ │ ├── ClassPathClassWork.java │ │ └── ThreeStringWriters.java │ ├── log │ │ ├── LogAndBinResults.java │ │ ├── LogAndReturn.java │ │ └── LogAndTextResults.java │ ├── package-info.java │ ├── transform │ │ ├── ITestRunner.java │ │ ├── ResultChecker.java │ │ ├── TransformLoader.java │ │ └── pipeline │ │ │ ├── AsmtoolsType.java │ │ │ ├── ClassToJasmConverter.java │ │ │ ├── ClassToJcodConverter.java │ │ │ ├── Clazz.java │ │ │ ├── Converter.java │ │ │ ├── Jasm.java │ │ │ ├── JasmToClassConverter.java │ │ │ ├── Jcod.java │ │ │ ├── JcodToClassConverter.java │ │ │ ├── Pipeline.java │ │ │ └── TestPipeline.java │ └── utility │ │ ├── FileUtils.java │ │ └── StringUtils.java │ ├── structure │ └── ClassFile │ │ └── ClassFileTests.java │ └── transform │ ├── case7902820 │ ├── TestRunnerNegative.java │ ├── TestRunnerPositive.java │ └── data │ │ └── SourceDebugExtension_source.java │ ├── case7902820Tests.java │ ├── case7903259 │ └── BuildString.java │ ├── case7903259Tests.java │ ├── case7903454 │ ├── TestRunner.java │ └── data │ │ └── Utf8Code_source.java │ ├── case7903454Tests.java │ ├── case8302260 │ ├── TestRunner.java │ └── data │ │ ├── CTestClass.java │ │ ├── ITestInterfaceA.java │ │ └── pkg │ │ └── CTestSuperClass.java │ ├── case8302260Tests.java │ └── package-info.java └── resources ├── jcod-files ├── abc.txt ├── atrcod00101m1n.jcod ├── atrcod00101m1p.jcod ├── atrcvl00101m1.jcod ├── atrcvl00101m10p.jasm ├── atrcvl00101m10p.jcod ├── atrcvl00101m1t.jcod ├── atrcvl00101m1t0p.jcod ├── atrcvl00102m1.jcod ├── atrcvl00102m10p.jcod ├── atrcvl00102m1t.jcod ├── atrcvl00102m1t0p.jcod ├── atrcvl00301m1.jcod ├── atrcvl00301m1n.jcod ├── atrcvl00301m1p.jcod ├── atrcvl00401m1.jcod ├── atrcvl00401m1n.jcod ├── atrcvl00401m1p.jcod ├── atrcvl00402m1.jcod ├── atrcvl00402m1t.jcod ├── atrcvl00501m1.jcod ├── atrcvl00501m1n.jcod ├── atrcvl00501m1p.jcod ├── atrcvl00502m1.jcod ├── atrcvl00502m1n.jcod ├── atrcvl00502m1p.jcod ├── atrcvl00601m1.jcod ├── atrcvl00601m1n.jcod ├── atrcvl00601m1p.jcod ├── atrcvl00701m1.jcod ├── atrcvl00701m10p.jcod ├── atrcvl00701m11n.jcod ├── atrcvl00702m1.jcod ├── atrcvl00702m10p.jcod ├── atrcvl00702m11p.jcod ├── atrcvl00702m12n.jcod ├── atrcvl00801m1.jcod ├── atrcvl00801m1n.jcod ├── atrcvl00801m1p.jcod ├── atrcvl00802m1.jcod ├── atrcvl00802m1n.jcod ├── atrcvl00802m1p.jcod ├── atrcvl00901m1.jcod ├── atrcvl00901m1n.jcod ├── atrcvl00901m1p.jcod ├── atrcvl00902m1.jcod ├── atrcvl00902m1n.jcod ├── atrcvl00902m1p.jcod ├── atrcvl00903m1.jcod ├── atrcvl00903m1n.jcod ├── atrcvl00903m1p.jcod ├── atrcvl00904m1.jcod ├── atrcvl00904m1n.jcod ├── atrcvl00904m1p.jcod ├── atrcvl00905m1.jcod ├── atrcvl00905m1n.jcod ├── atrcvl00905m1p.jcod ├── atrcvl00906m1.jcod ├── atrcvl00906m1n.jcod ├── atrcvl00906m1p.jcod ├── atrcvl00907m1.jcod ├── atrcvl00907m1n.jcod ├── atrcvl00907m1p.jcod ├── atrcvl00908m1.jcod ├── atrcvl00908m1n.jcod ├── atrcvl00908m1p.jcod ├── atrcvl00909m1.jcod ├── atrcvl00909m1n.jcod ├── atrcvl00909m1p.jcod ├── atrcvl01001m1.jcod ├── atrcvl01001m1n.jcod ├── atrcvl01001m1p.jcod ├── atrcvl01002m1.jcod ├── atrcvl01002m10p.jcod ├── atrcvl01002m110p.jcod ├── atrcvl01002m111n.jcod ├── atrcvl01002m112n.jcod ├── atrcvl01002m113n.jcod ├── atrcvl01002m114n.jcod ├── atrcvl01002m115p.jcod ├── atrcvl01002m116n.jcod ├── atrcvl01002m117n.jcod ├── atrcvl01002m118n.jcod ├── atrcvl01002m119n.jcod ├── atrcvl01002m11n.jcod ├── atrcvl01002m120p.jcod ├── atrcvl01002m121n.jcod ├── atrcvl01002m122n.jcod ├── atrcvl01002m123n.jcod ├── atrcvl01002m124n.jcod ├── atrcvl01002m125n.jcod ├── atrcvl01002m126n.jcod ├── atrcvl01002m127n.jcod ├── atrcvl01002m128n.jcod ├── atrcvl01002m129n.jcod ├── atrcvl01002m12n.jcod ├── atrcvl01002m130p.jcod ├── atrcvl01002m131n.jcod ├── atrcvl01002m132n.jcod ├── atrcvl01002m133n.jcod ├── atrcvl01002m134n.jcod ├── atrcvl01002m135n.jcod ├── atrcvl01002m136n.jcod ├── atrcvl01002m137n.jcod ├── atrcvl01002m138n.jcod ├── atrcvl01002m139n.jcod ├── atrcvl01002m13n.jcod ├── atrcvl01002m140p.jcod ├── atrcvl01002m141n.jcod ├── atrcvl01002m142n.jcod ├── atrcvl01002m143n.jcod ├── atrcvl01002m144n.jcod ├── atrcvl01002m145n.jcod ├── atrcvl01002m146n.jcod ├── atrcvl01002m147n.jcod ├── atrcvl01002m148n.jcod ├── atrcvl01002m149n.jcod ├── atrcvl01002m14n.jcod ├── atrcvl01002m150p.jcod ├── atrcvl01002m151n.jcod ├── atrcvl01002m152n.jcod ├── atrcvl01002m153n.jcod ├── atrcvl01002m154n.jcod ├── atrcvl01002m155n.jcod ├── atrcvl01002m156n.jcod ├── atrcvl01002m157n.jcod ├── atrcvl01002m158n.jcod ├── atrcvl01002m159n.jcod ├── atrcvl01002m15p.jcod ├── atrcvl01002m160p.jcod ├── atrcvl01002m16n.jcod ├── atrcvl01002m17n.jcod ├── atrcvl01002m18n.jcod └── atrcvl01002m19n.jcod └── org └── openjdk └── asmtools ├── attribute ├── BootstrapMethods │ ├── BSMCase7903791.g.jasm │ ├── BSMCase7903791.g.jcod │ ├── BSMCase7903791.g.t.jasm │ └── BSMCase7903791.jasm ├── LoadableDescriptors │ ├── LoadableDescriptorsAttributeTest$X.g.jasm │ ├── LoadableDescriptorsAttributeTest$X.g.jcod │ ├── LoadableDescriptorsAttributeTest$X.g.t.jasm │ ├── LoadableDescriptorsAttributeTest$X.jasm │ ├── LoadableDescriptorsAttributeTest$X.jcod │ └── Test01.jasm ├── NestHost │ ├── Test01.g.jasm │ ├── Test01.jasm │ ├── Test01.jcod │ └── Test02.jasm ├── NestMembers │ ├── Test01.g.t.jasm │ ├── Test01.jasm │ ├── Test01.jcod │ └── Test02.jasm ├── PermittedSubclasses │ ├── Test01.g.t.jasm │ ├── Test01.jasm │ ├── Test01.jcod │ └── Test02.jasm └── StackMapTable │ ├── StackMapData.g.jasm │ ├── StackMapData.g.jcod │ ├── StackMapData.g.t.jasm │ ├── StackMapData.jasm │ ├── StackMapData.jcod │ ├── StackMapData.t.jasm │ ├── StackMapData01.g.jasm │ ├── StackMapData02.g.jasm │ └── StackMapData02.g.jcod ├── common └── sequence │ ├── ConstantPoolTestDummy.jasm │ ├── EnclMethTest.jcod │ ├── TestInterface01n01.jasm │ ├── atrcod00402m1n.jcod │ ├── module-info.jcod │ ├── nonvoidinit.jasm │ ├── stackmap00601m1n.jcod │ └── voidinit.jasm ├── jasm ├── case7902696 │ ├── CondyNestedResolution.g.jasm │ └── CondyNestedResolution.g.t.jasm ├── case7902820 │ └── InvalidSourceDebugExtension.jcod ├── case7903031 │ ├── module-info.class.g.jasm │ └── module-info.class.jasm ├── case7903405 │ └── ifge_overflow.jasm ├── case7903558 │ ├── JasmFile01.g.jasm │ ├── JasmFile01.jasm │ ├── JasmFile02.g.jasm │ ├── JasmFile02.jasm │ ├── JasmFile03.g.jasm │ ├── JasmFile03.jasm │ ├── JasmFile04.g.jasm │ └── JasmFile04.jasm ├── case7903976 │ ├── Test00.jasm │ ├── Test01.jasm │ ├── Test02.jasm │ ├── Test03.jasm │ ├── Test04.jasm │ ├── Test05.jasm │ ├── Test06.jasm │ ├── Test07.jasm │ ├── Test08.jasm │ ├── Test09.jasm │ └── Test10.jasm ├── case7903987 │ └── Test00.jasm ├── clfacc00610m10p.jasm └── spinum00101m10p.jasm ├── jcoder ├── 12.jcod └── bad.jcod ├── structure └── ClassFile │ ├── ClassField00.jasm │ ├── ClassField01.jasm │ ├── ClassField02.jasm │ ├── ClassField03.jasm │ ├── ClassField04.jasm │ ├── ClassFile00.jasm │ ├── ClassFile01.jasm │ ├── ClassFile02.jasm │ ├── ClassFile03.jasm │ ├── ClassFile04.jasm │ ├── ClassFile05.jasm │ ├── ClassFile06.jasm │ ├── ClassFile07.jasm │ ├── ClassFile08.jasm │ ├── ClassFile09.jasm │ ├── ClassFile10.jasm │ ├── ClassFile11.jasm │ ├── ClassFile12.jasm │ ├── ClassFile13.jasm │ ├── ClassFile14.jasm │ └── ClassFile15.jasm └── transform ├── case7902820 └── data │ ├── SourceDebugExtensionNegative01.class.jcod │ ├── SourceDebugExtensionNegative02.class.jcod │ ├── SourceDebugExtensionPositive01.class.jcod │ └── SourceDebugExtensionPositive02.class.jcod ├── case7903259 ├── jasm ├── jcoder ├── jdec.bin └── jdis.bin ├── case7903454 └── data │ ├── Utf8Code.class.jasm │ ├── Utf8Code.class.jcod │ ├── Utf8CodeBroken01.class.jasm │ └── Utf8CodeBroken01.class.jcod └── case8302260 ├── TestRunner.class.jasm ├── TestRunner.class.jcod └── data ├── CTestClass.class.jasm ├── CTestClass.class.jcod ├── ITestInterfaceA.class.jasm ├── ITestInterfaceA.class.jcod └── pkg ├── CTestSuperClass.class.jasm └── CTestSuperClass.class.jcod /.github/workflows/maven.yaml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ${{ matrix.os }} 15 | 16 | strategy: 17 | matrix: 18 | os: [ubuntu-latest] 19 | java-version: [ 21, 24 ] 20 | fail-fast: false 21 | 22 | name: ${{ matrix.os }} - Java ${{ matrix.java-version }} - Maven 23 | steps: 24 | - name: Checkout asmtools repo 25 | uses: actions/checkout@v2 26 | 27 | - name: Set up JDK ${{ matrix.java-version }} 28 | uses: actions/setup-java@v2 29 | with: 30 | java-version: ${{ matrix.java-version }} 31 | distribution: 'adopt' 32 | - name: Set up Maven 33 | uses: stCarolas/setup-maven@v4.4 34 | with: 35 | maven-version: 3.8.4 36 | 37 | - name: Build asmtools with Maven 38 | run: | 39 | set -x 40 | pwd 41 | ls 42 | cd maven ; 43 | bash mvngen.sh ; 44 | mvn "--batch-mode" "--update-snapshots" "clean" "install" 45 | mvn "--batch-mode" "--update-snapshots" "test" 46 | 47 | 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # Package Files 8 | *.jar 9 | *.zip 10 | *.tar.gz 11 | *.tar 12 | 13 | # virtual machine crash logs 14 | hs_err_pid* 15 | 16 | # Misc: Intellij Idea,Mac OS 17 | /.idea/ 18 | /maven/.idea/ 19 | *.iml 20 | .DS_Store 21 | 22 | maven/target 23 | maven/src 24 | maven/pom.xml 25 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 85d58e2683bfe2f70defd6ec10d377d84766ddd8 initial-openjdk 2 | f201bb903e32f09e054f5fafc180508b9db67d00 6.0 3 | c52c3f68bfba5ca97378e9e9df5fc1268ac9e481 7.0 4 | f788f629bb40b3f3dd6d2cd25f3c9072568792de 7.0-b02 5 | 2931522b78a4a4842396ad61300853911caf4169 7.0-b04 6 | b63cf0206a26c9cef5831aec217ed88a5ba09f5a 7.0-b05 7 | 5d0dc302199d510f0fb44763fbca8118d12f8ad8 7.0-b06 8 | -------------------------------------------------------------------------------- /.jcheck/conf: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. 3 | ; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | ; 5 | ; This code is free software; you can redistribute it and/or modify it 6 | ; under the terms of the GNU General Public License version 2 only, as 7 | ; published by the Free Software Foundation. 8 | ; 9 | ; This code is distributed in the hope that it will be useful, but WITHOUT 10 | ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | ; version 2 for more details (a copy is included in the LICENSE file that 13 | ; accompanied this code). 14 | ; 15 | ; You should have received a copy of the GNU General Public License version 16 | ; 2 along with this work; if not, write to the Free Software Foundation, 17 | ; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ; 19 | ; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | ; or visit www.oracle.com if you need additional information or have any 21 | ; questions. 22 | ; 23 | 24 | [general] 25 | project=code-tools 26 | repository=asmtools 27 | jbs=codetools 28 | 29 | [checks] 30 | error=author,committer,whitespace,executable,symlink 31 | 32 | [census] 33 | version=0 34 | domain=openjdk.org 35 | 36 | [checks "whitespace"] 37 | files=.*\.java$|.*\.c$|.*\.h$|.*\.cpp$|.*\.hpp$ 38 | -------------------------------------------------------------------------------- /build/build.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. 2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 | # 4 | # This code is free software; you can redistribute it and/or modify it 5 | # under the terms of the GNU General Public License version 2 only, as 6 | # published by the Free Software Foundation. Oracle designates this 7 | # particular file as subject to the "Classpath" exception as provided 8 | # by Oracle in the LICENSE file that accompanied this code. 9 | # 10 | # This code is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | # version 2 for more details (a copy is included in the LICENSE file that 14 | # accompanied this code). 15 | # 16 | # You should have received a copy of the GNU General Public License version 17 | # 2 along with this work; if not, write to the Free Software Foundation, 18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 | # 20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 | # or visit www.oracle.com if you need additional information or have any 22 | # questions. 23 | 24 | # Compile in verbose mode 25 | javac.verbose=false 26 | # Compile in debug mode 27 | javac.debug=true 28 | # Compile with deprecation flag 29 | javac.deprecation=false 30 | javac.release.version=21 31 | # path to output directory 32 | BUILD_DIR = ../../asmtools-${PRODUCT_VERSION}-build 33 | -------------------------------------------------------------------------------- /build/productinfo.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. 2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 | # 4 | # This code is free software; you can redistribute it and/or modify it 5 | # under the terms of the GNU General Public License version 2 only, as 6 | # published by the Free Software Foundation. Oracle designates this 7 | # particular file as subject to the "Classpath" exception as provided 8 | # by Oracle in the LICENSE file that accompanied this code. 9 | # 10 | # This code is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | # version 2 for more details (a copy is included in the LICENSE file that 14 | # accompanied this code). 15 | # 16 | # You should have received a copy of the GNU General Public License version 17 | # 2 along with this work; if not, write to the Free Software Foundation, 18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 | # 20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 | # or visit www.oracle.com if you need additional information or have any 22 | # questions. 23 | 24 | # Path to JDK will be used to compile sources 25 | # Product info 26 | PRODUCT_NAME =asmtools 27 | PRODUCT_JAR_NAME =asmtools.jar 28 | PRODUCT_VERSION =9.0 29 | PRODUCT_MILESTONE =ea 30 | PRODUCT_BUILDNUMBER =11 31 | PRODUCT_NAME_LONG =Java Assembler Tools 32 | -------------------------------------------------------------------------------- /docs/Class00.jasm: -------------------------------------------------------------------------------- 1 | package org/openjdk/asmtools/source00; 2 | 3 | public super class Class00 version 67:0 4 | { 5 | public Method "":"()V" 6 | stack 1 locals 1 7 | { 8 | aload_0; 9 | invokespecial Method java/lang/Object."":"()V"; 10 | return; 11 | } 12 | 13 | public static Method main:"([Ljava/lang/String;)V" 14 | stack 0 locals 1 15 | { 16 | return; 17 | } 18 | 19 | SourceFile "Class00.java"; 20 | } // end Class org/openjdk/asmtools/source00/Class00 compiled from "Class00.java" 21 | -------------------------------------------------------------------------------- /docs/Class00.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.source00; 2 | public class Class00 { 3 | public static void main(String argv[]) { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /docs/Class00_1.jasm: -------------------------------------------------------------------------------- 1 | file Cls01 2 | package org/openjdk/asmtools/source00; 3 | 4 | public super class Class00 version 67:0 5 | { 6 | public Method "":"()V" 7 | stack 1 locals 1 8 | { 9 | aload_0; 10 | invokespecial Method java/lang/Object."":"()V"; 11 | return; 12 | } 13 | 14 | public static Method main:"([Ljava/lang/String;)V" 15 | stack 0 locals 1 16 | { 17 | return; 18 | } 19 | 20 | SourceFile "Class00.java"; 21 | } // end Class org/openjdk/asmtools/source00/Class00 compiled from "Class00.java" 22 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/asmutils/FormatConsumer.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.asmutils; 2 | 3 | @FunctionalInterface 4 | public interface FormatConsumer { 5 | void format(F t, A... arg); 6 | } 7 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/asmutils/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.asmutils; 24 | 25 | // Helper class 26 | public class Pair { 27 | public F first; 28 | public S second; 29 | 30 | public Pair(F first, S second) { 31 | this.first = first; 32 | this.second = second; 33 | } 34 | 35 | @Override 36 | public boolean equals(Object obj) { 37 | if (this == obj) return true; 38 | if (obj == null || getClass() != obj.getClass()) return false; 39 | Pair pair = (Pair) obj; 40 | if (!first.equals(pair.first)) return false; 41 | return second.equals(pair.second); 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | int result = first != null ? first.hashCode() : 0; 47 | result = 31 * result + (second != null ? second.hashCode() : 0); 48 | return result; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "Pair{ " + first + ", " + second + " }"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/asmutils/Range.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.asmutils; 24 | 25 | // Helper class 26 | public record Range>(T from, T to) { 27 | /** 28 | * Verifies that a value is inside the range from the lower bound (from) to the upper bound (to) inclusively. 29 | * 30 | * @param value the value to verify its belonging to the range 31 | * @return true if the value is in the range inclusively. 32 | */ 33 | public boolean in(T value) { 34 | return (this.from.compareTo(value) <= 0) && (this.to.compareTo(value) >= 0); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/asmutils/Triplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.asmutils; 24 | 25 | // Helper class 26 | public class Triplet extends Pair { 27 | public final T third; 28 | 29 | public Triplet(F first, S second, T third) { 30 | super(first, second); 31 | this.third = third; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "Triplet{ " + first + ", " + second + ", " + third + " }"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/Compiler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | import org.openjdk.asmtools.common.outputs.ToolOutput; 26 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 27 | 28 | import static org.openjdk.asmtools.common.Environment.OK; 29 | 30 | public abstract class Compiler> extends Tool { 31 | protected Compiler(ToolOutput toolOutput, DualStreamToolOutput outerLog) { 32 | super(toolOutput, outerLog); 33 | } 34 | 35 | public synchronized boolean compile(String... argv) { 36 | parseArgs(argv); 37 | return this.compile() == OK; 38 | } 39 | 40 | // Run a compiler when args already parsed 41 | public abstract int compile(); 42 | } 43 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/CompilerConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | /** 26 | * This interface defines constant that are used throughout the compiler. It inherits from 27 | * RuntimeConstants, which is an autogenerated class that contains constants defined in 28 | * the interpreter. 29 | */ 30 | public interface CompilerConstants { 31 | // End of input 32 | int EOF = -1; 33 | 34 | // Jasm: Number of bits used in file offsets 35 | int OFFSET_BITS = 32; 36 | 37 | //Jcoder: The increment for each character. 38 | int OFFSET_INC = 1; 39 | 40 | // BACKSLASH is a special code indicating a pushback of a backslash that 41 | // definitely isn't the start of a unicode sequence. 42 | int BACKSLASH = -2; 43 | } 44 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/Decoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | import org.openjdk.asmtools.common.outputs.ToolOutput; 26 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 27 | 28 | import static org.openjdk.asmtools.common.Environment.OK; 29 | 30 | public abstract class Decoder> extends Tool { 31 | protected Decoder(ToolOutput toolOutput, DualStreamToolOutput outerLog) { 32 | super(toolOutput, outerLog); 33 | } 34 | 35 | // Runs the decoder with args 36 | public synchronized boolean decode(String... argv) { 37 | parseArgs(argv); 38 | return this.decode() == OK; 39 | } 40 | 41 | // Run a decoder when args already parsed 42 | public abstract int decode(); 43 | } 44 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/EMessageKind.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.common; 2 | 3 | public enum EMessageKind { 4 | ERROR("err."), 5 | WARNING("warn."), 6 | INFO("info."); 7 | final String prefix; 8 | 9 | EMessageKind(String prefix) { 10 | this.prefix = prefix; 11 | } 12 | 13 | public static boolean isFromResourceBundle(String msg) { 14 | for (EMessageKind kind : values()) { 15 | if (msg.startsWith(kind.prefix)) { 16 | return true; 17 | } 18 | } 19 | return false; 20 | } 21 | 22 | public String longForm() { 23 | return name().substring(0, 1) + name().substring(1).toLowerCase(); 24 | } 25 | 26 | public String shortForm() { 27 | return name().length() > 5 ? name().substring(0, 4) : name(); 28 | } 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/ErrorMessage.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.common; 2 | 3 | /** 4 | * A sorted list of error messages 5 | */ 6 | public final class ErrorMessage { 7 | 8 | public int where; 9 | public String message; 10 | public ErrorMessage next; 11 | 12 | /** 13 | * Constructor 14 | */ 15 | public ErrorMessage(int where, String message) { 16 | this.where = where; 17 | this.message = message; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/FormatError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | /** 26 | * FormatError is the generic error thrown by jdis, jdec while parsing a class file. 27 | */ 28 | public class FormatError extends ClassFormatError { 29 | 30 | /** 31 | * Checks and returns formatted string if id isn't a reference in i18n.properties 32 | * 33 | * @param id either format string or a resource id 34 | * @param args arguments of the format string 35 | * @return null id isn't format string otherwise formatted string 36 | */ 37 | private static String getResourceMsg(String id, Object... args) { 38 | return id.startsWith("err.") || id.startsWith("warn.") ? null : String.format(id, args); 39 | } 40 | 41 | public FormatError(T logger, String id, Object... args) { 42 | super( logger.getResourceString(id, args) == null ? 43 | (FormatError.getResourceMsg(id, args) == null ? "(i18n.properties) The message '" + id + "' not found" : FormatError.getResourceMsg(id, args)) 44 | : logger.getResourceString(id, args)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/NotImplementedException.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.common; 2 | 3 | /** class used to indicate missing functionality */ 4 | public class NotImplementedException extends RuntimeException { 5 | public NotImplementedException() { 6 | super("The method is not yet implemented"); 7 | } 8 | public NotImplementedException(String reason) { 9 | super(reason); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/SyntaxError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | /** 26 | * SyntaxError is the generic error thrown by jasm, jcoder while parsing either a jasm file or jcod file. 27 | */ 28 | public class SyntaxError extends Error { 29 | private boolean fatalError = false; 30 | 31 | public SyntaxError setFatal() { 32 | this.fatalError = true; 33 | return this; 34 | } 35 | 36 | public boolean isFatal() { 37 | return this.fatalError; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/TriFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | @FunctionalInterface 26 | public interface TriFunction { 27 | R apply(T t, U u, V v); 28 | 29 | // Default method to compose functions (like BiFunction.andThen) 30 | default TriFunction andThen(java.util.function.Function after) { 31 | if (after == null) throw new NullPointerException("After function must not be null"); 32 | return (t, u, v) -> after.apply(apply(t, u, v)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/inputs/StdinInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.inputs; 24 | 25 | public class StdinInput extends StreamInput { 26 | 27 | public StdinInput() { 28 | super(System.in); 29 | } 30 | 31 | @Override 32 | public String getName() { 33 | //get parent is used 34 | return "stdin/stdin"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/inputs/StringInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.inputs; 24 | 25 | import java.nio.charset.StandardCharsets; 26 | 27 | public class StringInput extends ByteInput { 28 | 29 | public StringInput(final String bytes) { 30 | super(bytes.getBytes(StandardCharsets.UTF_8)); 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | //get parent is used 36 | return "string/string"; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/inputs/TextInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.inputs; 24 | 25 | import java.io.DataInputStream; 26 | import java.io.IOException; 27 | import java.nio.charset.StandardCharsets; 28 | 29 | /** 30 | * Base class for JasmEnvironment.InputFile and 31 | * JcoderEnvironment.InputFile that read the jasm, jcod text files 32 | */ 33 | public abstract class TextInput { 34 | 35 | public long position; 36 | protected int charPos = 0; 37 | protected int linepos = 1; 38 | 39 | 40 | // Buffer to keep the text file content 41 | protected final String strData; 42 | 43 | public TextInput(DataInputStream dataInputStream) throws IOException { 44 | byte[] data = new byte[dataInputStream.available()]; 45 | dataInputStream.read(data); 46 | strData = new String(data, StandardCharsets.UTF_8); 47 | dataInputStream.close(); 48 | } 49 | 50 | public abstract int readUTF(); 51 | } 52 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/outputs/EscapedPrintStreamOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.outputs; 24 | 25 | import org.openjdk.asmtools.common.uEscWriter; 26 | 27 | import java.io.BufferedOutputStream; 28 | import java.io.DataOutputStream; 29 | import java.io.FileNotFoundException; 30 | import java.io.IOException; 31 | import java.io.OutputStream; 32 | 33 | public class EscapedPrintStreamOutput extends PrintWriterOutput { 34 | 35 | private final OutputStream originalStream; 36 | 37 | public EscapedPrintStreamOutput(OutputStream os) { 38 | super(new uEscWriter(os)); 39 | this.originalStream = os; 40 | } 41 | 42 | @Override 43 | public DataOutputStream getDataOutputStream() throws FileNotFoundException { 44 | return new DataOutputStream(new BufferedOutputStream(originalStream)); 45 | } 46 | 47 | @Override 48 | public void finishClass(String fullyQualifiedName) throws IOException { 49 | super.finishClass(fullyQualifiedName); 50 | originalStream.flush(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/outputs/StdoutOutput.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.common.outputs; 2 | 3 | public class StdoutOutput extends EscapedPrintStreamOutput { 4 | 5 | public StdoutOutput() { 6 | super(System.out); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/outputs/log/NamedDualStreamToolOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.outputs.log; 24 | 25 | import org.openjdk.asmtools.common.Environment; 26 | 27 | import java.io.IOException; 28 | import java.util.Optional; 29 | 30 | public abstract class NamedDualStreamToolOutput implements DualStreamToolOutput { 31 | private String fqn; 32 | private Optional suffix; 33 | private Environment environment; 34 | 35 | @Override 36 | public String getCurrentClassName() { 37 | return fqn; 38 | } 39 | 40 | @Override 41 | public void startClass(String fullyQualifiedName, Optional suffix, Environment logger) throws IOException { 42 | this.fqn = fullyQualifiedName; 43 | this.suffix = suffix; 44 | this.environment = logger; 45 | } 46 | 47 | @Override 48 | public void finishClass(String fqn) throws IOException { 49 | this.fqn = null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/outputs/log/SingleDualOutputStreamOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.outputs.log; 24 | 25 | import java.io.PrintStream; 26 | import java.io.PrintWriter; 27 | 28 | public class SingleDualOutputStreamOutput extends DualOutputStreamOutput { 29 | 30 | public SingleDualOutputStreamOutput(PrintWriter er) { 31 | super(er, er); 32 | } 33 | 34 | public SingleDualOutputStreamOutput(PrintStream er) { 35 | super(er, er); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/outputs/log/StderrLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.outputs.log; 24 | 25 | 26 | public class StderrLog extends SingleDualOutputStreamOutput { 27 | 28 | public StderrLog() { 29 | super(System.err); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/structure/ELocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common.structure; 24 | 25 | /** 26 | * Attribute location 27 | * Table 4.7-C. Predefined class file attributes (by location) 28 | */ 29 | public enum ELocation { 30 | UNKNOWN, 31 | ClassFile, 32 | field_info, 33 | method_info, 34 | record_component_info, 35 | Code 36 | } 37 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/common/uEscWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.common; 24 | 25 | import java.io.IOException; 26 | import java.io.OutputStream; 27 | import java.io.Writer; 28 | import java.nio.charset.StandardCharsets; 29 | 30 | public class uEscWriter extends Writer { 31 | 32 | static final char[] hexTable = "0123456789ABCDEF".toCharArray(); 33 | OutputStream out; 34 | byte[] tmpl; 35 | 36 | public uEscWriter(OutputStream out) { 37 | this.out = out; 38 | tmpl = new byte[6]; 39 | tmpl[0] = (byte) '\\'; 40 | tmpl[1] = (byte) 'u'; 41 | } 42 | 43 | 44 | @Override 45 | public synchronized void write(char[] cc, int ofs, int len) throws IOException { 46 | byte[] b = String.copyValueOf(cc, ofs, len).getBytes(StandardCharsets.UTF_8); 47 | out.write(b, ofs, b.length); 48 | } 49 | 50 | @Override 51 | public void flush() { 52 | } 53 | 54 | @Override 55 | public void close() { 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/CPXAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import org.openjdk.asmtools.common.structure.EAttribute; 26 | 27 | import java.io.IOException; 28 | 29 | /** 30 | * Constant Pool Index Attribute 31 | */ 32 | class CPXAttr extends AttrData { 33 | 34 | ConstCell cell; 35 | 36 | public CPXAttr(ConstantPool pool, EAttribute attribute, ConstCell cell) { 37 | super(pool, attribute); 38 | this.cell = classifyConstCell(pool, cell); 39 | } 40 | 41 | public int attrLength() { 42 | return 2; 43 | } 44 | 45 | public void write(CheckedDataOutputStream out) throws IOException { 46 | super.write(out); // attr name, attr len 47 | out.writeShort(cell.cpIndex); 48 | } 49 | } // end class CPXAttr 50 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/CheckedDataOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import java.io.IOException; 26 | 27 | public interface CheckedDataOutputStream { 28 | 29 | void write(int b) throws IOException; 30 | 31 | void write(byte b[], int off, int len) throws IOException; 32 | 33 | default void write(byte b[]) throws IOException { 34 | write(b,0, b.length); 35 | } 36 | 37 | void writeBoolean(boolean v) throws IOException; 38 | 39 | void writeByte(int v) throws IOException; 40 | 41 | void writeShort(int v) throws IOException; 42 | 43 | void writeChar(int v) throws IOException; 44 | 45 | void writeInt(int v) throws IOException; 46 | 47 | void writeLong(long v) throws IOException; 48 | 49 | void writeFloat(float v) throws IOException; 50 | 51 | void writeDouble(double v) throws IOException; 52 | 53 | void writeBytes(String s) throws IOException; 54 | 55 | void writeChars(String s) throws IOException; 56 | 57 | void writeUTF(String s) throws IOException; 58 | } 59 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/DataWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * Base contract for writeable structures 29 | */ 30 | interface DataWriter { 31 | 32 | default boolean isCountable() { 33 | return true; 34 | } 35 | 36 | void write(CheckedDataOutputStream out) throws IOException; 37 | int getLength(); 38 | } 39 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/DefaultAnnotationAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import org.openjdk.asmtools.common.structure.EAttribute; 26 | 27 | import java.io.IOException; 28 | 29 | /** 30 | * DefaultAnnotationAttr 31 | * 32 | * Used to represent Default Annotation Attributes 33 | * 34 | */ 35 | public class DefaultAnnotationAttr extends AttrData { 36 | 37 | DataWriter element; // Data 38 | 39 | public DefaultAnnotationAttr(ConstantPool pool, EAttribute attribute, DataWriter element) { 40 | super(pool, attribute); 41 | this.element = element; 42 | } 43 | 44 | public void add(DataWriter element) { 45 | this.element = element; 46 | } 47 | 48 | @Override 49 | public int attrLength() { 50 | return element.getLength(); // add the length of number of elements 51 | } 52 | 53 | @Override 54 | public void write(CheckedDataOutputStream out) throws IOException { 55 | super.write(out); // attr name, attr len 56 | element.write(out); 57 | } 58 | }// end class DataVectorAttr 59 | 60 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/FieldType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | public enum FieldType { 26 | Array('[', "reference", 1), 27 | Boolean('Z', "boolean", 1), 28 | Byte('B', "byte", 1), 29 | Char('C', "char", 1), 30 | Double('D', "double", 2), 31 | Float('F', "float", 1), 32 | Int('I', "int", 1), 33 | LReference('L', "reference", 1), 34 | Long('J', "long", 2), 35 | QReference('Q', "reference", 1), 36 | Short('S', "short", 1); 37 | 38 | private final char term; 39 | private final String type; 40 | private final int slotsCount; 41 | 42 | FieldType(char term, String type, int slotsCount) { 43 | this.term = term; 44 | this.type = type; 45 | this.slotsCount = slotsCount; 46 | } 47 | 48 | public static FieldType getFieldType(char term) { 49 | for (FieldType ft : FieldType.values()) { 50 | if ( ft.term == term ) { 51 | return ft; 52 | } 53 | } 54 | return null; 55 | } 56 | 57 | public int getSlotsCount() { 58 | return slotsCount; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/Indexer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | /** 26 | * Indexer a position starting from 0 of a constant cell in the Constant Pool. 27 | * Also, the class is used to hold uninitialized (isSet == false) and initialized (isSet == true) indexes,counters: 28 | * max_stack, max_locals, Trap.start_pc, Trap.end_pc 29 | */ 30 | public class Indexer { 31 | 32 | public static final int NotSet = -1; 33 | protected int cpIndex; 34 | 35 | Indexer() { 36 | cpIndex = NotSet; 37 | } 38 | 39 | Indexer(int cpIndex) { 40 | this.cpIndex = cpIndex; 41 | } 42 | 43 | public int hashCode() { return isSet() ? cpIndex : 0; } 44 | 45 | boolean isSet() { return cpIndex != NotSet; } 46 | 47 | boolean inRange(int index){ 48 | return index >=0 && index < cpIndex; 49 | } 50 | 51 | // Alias for max_stack, max_locals 52 | public int value() { 53 | return cpIndex; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/JasmTool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import org.openjdk.asmtools.common.Compiler; 26 | import org.openjdk.asmtools.common.Tool; 27 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 28 | import org.openjdk.asmtools.common.outputs.ToolOutput; 29 | import org.openjdk.asmtools.common.outputs.log.StderrLog; 30 | import org.openjdk.asmtools.jasm.JasmEnvironment.JasmBuilder; 31 | 32 | public abstract class JasmTool extends Compiler { 33 | 34 | protected JasmTool(ToolOutput toolOutput) { 35 | super(toolOutput, new StderrLog()); 36 | } 37 | 38 | protected JasmTool(ToolOutput toolOutput, DualStreamToolOutput logger) { 39 | super(toolOutput, logger); 40 | } 41 | 42 | @Override 43 | public JasmEnvironment getEnvironment(ToolOutput toolOutput, DualStreamToolOutput logger) { 44 | JasmBuilder builder = new JasmBuilder(toolOutput, logger); 45 | return builder.build(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/LineNumberData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * 4.7.12. The LineNumberTable Attribute 29 | *

30 | * LineNumberTable_attribute { 31 | * 32 | * { u2 start_pc; 33 | * u2 line_number; 34 | * } 35 | * 36 | * } 37 | */ 38 | class LineNumberData implements DataWriter { 39 | 40 | int start_pc; 41 | long line_number; 42 | 43 | public LineNumberData(int start_pc, long line_number) { 44 | this.start_pc = start_pc; 45 | this.line_number = line_number; 46 | } 47 | 48 | @Override 49 | public int getLength() { 50 | return 4; 51 | } 52 | 53 | @Override 54 | public void write(CheckedDataOutputStream out) throws IOException { 55 | out.writeShort(start_pc); 56 | out.writeShort((int)line_number); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/LoadableDescriptorsAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import org.openjdk.asmtools.common.structure.EAttribute; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * Valhalla: 31 | *

32 | * LoadableDescriptors_attribute { 33 | * u2 attribute_name_index; 34 | * u4 attribute_length; 35 | * u2 number_of_descriptors; 36 | * u2 descriptors[number_of_descriptors]; 37 | * } 38 | */ 39 | public class LoadableDescriptorsAttr extends ArrayAttr { 40 | public LoadableDescriptorsAttr(ConstantPool pool, List descriptors) { 41 | super(pool, EAttribute.ATT_LoadableDescriptors, descriptors); 42 | } 43 | 44 | @Override 45 | protected ConstCell classifyConstCell(ConstantPool pool, ConstCell cell) { 46 | return cell; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/NestMembersAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import org.openjdk.asmtools.common.structure.EAttribute; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * The "classes[]" data of attributes 31 | * JEP 181 (Nest-based Access Control): class file 55.0 32 | * NestMembers_attribute { 33 | * u2 attribute_name_index; 34 | * u4 attribute_length; 35 | * u2 number_of_classes; 36 | * u2 classes[number_of_classes]; 37 | * } 38 | */ 39 | public class NestMembersAttr extends ArrayAttr { 40 | public NestMembersAttr(ConstantPool pool, List classes) { 41 | super( pool, EAttribute.ATT_NestMembers, classes); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jasm/PermittedSubclassesAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jasm; 24 | 25 | import org.openjdk.asmtools.common.structure.EAttribute; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * The "classes[]" data of attributes 31 | * JEP 360 (Sealed types): class file 59.65535 32 | * PermittedSubclasses_attribute { 33 | * u2 attribute_name_index; 34 | * u4 attribute_length; 35 | * u2 number_of_classes; 36 | * u2 classes[number_of_classes]; 37 | * } 38 | */ 39 | public class PermittedSubclassesAttr extends ArrayAttr { 40 | public PermittedSubclassesAttr(ConstantPool pool, List classes) { 41 | super(pool, EAttribute.ATT_PermittedSubclasses, classes); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jcoder/JcoderTool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jcoder; 24 | 25 | import org.openjdk.asmtools.common.Compiler; 26 | import org.openjdk.asmtools.common.outputs.ToolOutput; 27 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 28 | import org.openjdk.asmtools.common.outputs.log.StderrLog; 29 | 30 | public abstract class JcoderTool extends Compiler { 31 | 32 | protected JcoderTool(ToolOutput toolOutput) { 33 | super(toolOutput, new StderrLog()); 34 | } 35 | 36 | protected JcoderTool(ToolOutput toolOutput, DualStreamToolOutput logger) { 37 | super(toolOutput, logger); 38 | } 39 | 40 | @Override 41 | public JcoderEnvironment getEnvironment(ToolOutput toolOutput, DualStreamToolOutput log) { 42 | JcoderEnvironment.JcoderBuilder builder = new JcoderEnvironment.JcoderBuilder(toolOutput, log); 43 | return builder.build(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdec/JdecTool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdec; 24 | 25 | import org.openjdk.asmtools.common.Decoder; 26 | import org.openjdk.asmtools.common.outputs.EscapedPrintStreamOutput; 27 | import org.openjdk.asmtools.common.outputs.ToolOutput; 28 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 29 | import org.openjdk.asmtools.common.outputs.log.StderrLog; 30 | 31 | import java.io.PrintStream; 32 | 33 | public abstract class JdecTool extends Decoder { 34 | 35 | protected JdecTool(ToolOutput toolOutput, DualStreamToolOutput log) { 36 | super(toolOutput, log); 37 | } 38 | 39 | protected JdecTool(ToolOutput toolOutput) { 40 | super(toolOutput, new StderrLog()); 41 | } 42 | 43 | protected JdecTool(PrintStream toolOutput) { 44 | this(new EscapedPrintStreamOutput(toolOutput)); 45 | } 46 | 47 | @Override 48 | public JdecEnvironment getEnvironment(ToolOutput toolOutput, DualStreamToolOutput log) { 49 | JdecEnvironment.JDecBuilder builder = new JdecEnvironment.JDecBuilder(toolOutput, log); 50 | return builder.build(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdec/NestedByteArrayInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdec; 24 | 25 | import java.io.ByteArrayInputStream; 26 | import java.util.Stack; 27 | 28 | /** 29 | * this class provides functionality needed to read class files: 30 | *

    31 | *
  • methods to read unsigned integers of various length 32 | *
  • counts bytes read so far 33 | *
34 | */ 35 | public class NestedByteArrayInputStream extends ByteArrayInputStream { 36 | 37 | NestedByteArrayInputStream(byte buf[]) { 38 | super(buf); 39 | } 40 | 41 | NestedByteArrayInputStream(byte buf[], int offset, int length) { 42 | super(buf, offset, length); 43 | } 44 | 45 | public int getPos() { 46 | return pos; 47 | } 48 | Stack savedStates = new Stack(); 49 | 50 | public void enter(int range) { 51 | savedStates.push(count); 52 | if (pos + range < count) { 53 | count = pos + range; 54 | } 55 | } 56 | 57 | public void leave() { 58 | pos = count; 59 | count = ((Integer) savedStates.pop()).intValue(); 60 | } 61 | } // end class NestedByteArrayInputStream 62 | 63 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdec/i18n.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. 2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 | # 4 | # This code is free software; you can redistribute it and/or modify it 5 | # under the terms of the GNU General Public License version 2 only, as 6 | # published by the Free Software Foundation. 7 | # 8 | # This code is distributed in the hope that it will be useful, but WITHOUT 9 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 | # version 2 for more details (a copy is included in the LICENSE file that 12 | # accompanied this code). 13 | # 14 | # You should have received a copy of the GNU General Public License version 15 | # 2 along with this work; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 | # 18 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | # or visit www.oracle.com if you need additional information or have any 20 | # questions. 21 | info.usage=\ 22 | Usage: java -jar asmtools.jar jdec [options] |- decompile into jcod file(s)\n\ 23 | \ if - is provided, is used\n\ 24 | where possible options include: 25 | # see also shared section in asmtools/i18 26 | info.opt.g=\ 27 | \ -g Generate a detailed output format 28 | 29 | err.invalid_option=Invalid option: {0} 30 | err.not_found=No such file: {0} 31 | err.count.issues={0}{1}in the file: {2} 32 | err.file.empty=The file is empty: {0} 33 | jdec.trace.CP_len=CP len= {0} 34 | jdec.trace.CP_entry=CP entry # {0} tag= {1} 35 | jdec.trace.access_thisCpx_superCpx=access={0} this_cpx={1} super_cpx={2} 36 | jdec.trace.numinterfaces=numinterfaces={0} 37 | jdec.trace.type=type_cpx[{0}]={1} 38 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/Element.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | /** 26 | * The element of the class Container that belongs to the owner M 27 | */ 28 | public class Element> extends Indenter { 29 | protected M owner; 30 | protected Container container; 31 | 32 | public Element(M owner, Container container) { 33 | super(owner.toolOutput); 34 | this.owner = owner; 35 | this.container = container; 36 | } 37 | 38 | @Override 39 | public int getCommentOffset() { 40 | return container.getCommentOffset(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/ExceptionData.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.jdis; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | import static org.openjdk.asmtools.jasm.JasmTokens.Token.THROWS; 7 | import static org.openjdk.asmtools.jasm.TableFormatModel.Token.EXCEPTIONS; 8 | 9 | /** 10 | * Exceptions_attribute { 11 | * u2 attribute_name_index; 12 | * u4 attribute_length; 13 | * u2 number_of_exceptions; 14 | * u2 exception_index_table[number_of_exceptions]; 15 | * } 16 | */ 17 | public class ExceptionData extends ClassArrayData { 18 | private int keywordPadding = -1; 19 | 20 | public ExceptionData(ClassData classData) { 21 | super(classData, THROWS); 22 | tableToken = EXCEPTIONS; 23 | } 24 | 25 | public ExceptionData read(DataInputStream in, int attribute_length) throws IOException, ClassFormatError { 26 | return (ExceptionData) super.read(in, attribute_length); 27 | } 28 | 29 | public ExceptionData setKeywordPadding(int keywordPadding) { 30 | this.keywordPadding = keywordPadding; 31 | return this; 32 | } 33 | @Override 34 | protected int getPrintAttributeKeyPadding() { 35 | return keywordPadding == -1 ? super.getPrintAttributeKeyPadding() : keywordPadding; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/JdisTool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import org.openjdk.asmtools.common.Decoder; 26 | import org.openjdk.asmtools.common.outputs.ToolOutput; 27 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 28 | import org.openjdk.asmtools.common.outputs.log.StderrLog; 29 | import org.openjdk.asmtools.jdis.JdisEnvironment.JdisBuilder; 30 | 31 | public abstract class JdisTool extends Decoder { 32 | 33 | protected JdisTool(ToolOutput toolOutput, DualStreamToolOutput outerLog) { 34 | super(toolOutput, outerLog); 35 | } 36 | 37 | protected JdisTool(ToolOutput toolOutput) { 38 | super(toolOutput, new StderrLog()); 39 | } 40 | 41 | @Override 42 | public JdisEnvironment getEnvironment(ToolOutput toolOutput, DualStreamToolOutput outerLog) { 43 | JdisBuilder builder = new JdisBuilder(toolOutput, outerLog); 44 | return builder.build(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/LoadableDescriptorsData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import org.openjdk.asmtools.jasm.JasmTokens; 26 | 27 | import java.io.DataInputStream; 28 | import java.io.IOException; 29 | 30 | /** 31 | * Valhalla: 32 | *

33 | * LoadableDescriptors_attribute { 34 | * u2 attribute_name_index; 35 | * u4 attribute_length; 36 | * u2 number_of_descriptors; 37 | * u2 descriptors[number_of_descriptors]; 38 | * } 39 | */ 40 | public class LoadableDescriptorsData extends Utf8ArrayData { 41 | public LoadableDescriptorsData(ClassData cls) { 42 | super(cls, JasmTokens.Token.LOADABLEDESCRIPTORS); 43 | } 44 | 45 | public LoadableDescriptorsData read(DataInputStream in, int attribute_length) throws IOException, ClassFormatError { 46 | return (LoadableDescriptorsData) super.read(in, attribute_length); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/LocalVariableData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import org.openjdk.asmtools.jasm.TableFormatModel; 26 | 27 | import java.io.DataInputStream; 28 | import java.io.IOException; 29 | 30 | import static org.openjdk.asmtools.jasm.JasmTokens.Token.*; 31 | 32 | /** 33 | * LocalVariableTable_attribute { 34 | * u2 attribute_name_index; 35 | * u4 attribute_length; 36 | * u2 local_variable_table_length; 37 | * { u2 start_pc; 38 | * u2 length; 39 | * u2 name_index; 40 | * u2 descriptor_index; 41 | * u2 index; 42 | * } local_variable_table[local_variable_table_length]; 43 | * } 44 | */ 45 | public class LocalVariableData> extends LocalData { 46 | 47 | @Override 48 | public boolean isPrintable() { 49 | return printLocalVariables && tableFormat; 50 | } 51 | 52 | public LocalVariableData(M owner, DataInputStream in, MethodData methodData) throws IOException { 53 | super(owner, in, methodData, DESCRIPTOR.parseKey()); 54 | } 55 | 56 | @Override 57 | protected String getTitle() { 58 | return LOCALVARIABLES_HEADER.parseKey() + ":"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/Measurable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | /** 26 | * Indicates that the element has a specific printable measurement/size. 27 | */ 28 | public interface Measurable { 29 | int getPrintSize(); 30 | 31 | void setMaxPrintSize(int size); 32 | 33 | int getMaxPrintSize(); 34 | } 35 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/NestHostData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import static org.openjdk.asmtools.jasm.TableFormatModel.Token.NEST_HOST; 26 | 27 | /** 28 | * The NestHost attribute data 29 | *

30 | * NestHost_attribute { 31 | * u2 attribute_name_index; 32 | * u4 attribute_length; 33 | * u2 host_class_index; 34 | * } 35 | * since class file 55.0 (JEP 181) 36 | */ 37 | public class NestHostData extends AttributeData { 38 | 39 | public NestHostData(ClassData classData) { 40 | super(classData, NEST_HOST); 41 | } 42 | 43 | public String calculateName() { 44 | if (this.name == null) { 45 | this.name = pool.getClassName(cpx, 46 | index -> "%s #%d".formatted(logger.getResourceString("info.invalid_cp_entry"), index)); 47 | } 48 | return this.name; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/NestMembersData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import org.openjdk.asmtools.jasm.JasmTokens; 26 | 27 | import java.io.DataInputStream; 28 | import java.io.IOException; 29 | 30 | import static java.lang.String.format; 31 | import static org.openjdk.asmtools.jasm.TableFormatModel.Token.NEST_MEMBERS; 32 | 33 | /** 34 | * The NestMembers attribute data 35 | *

36 | * JEP 181 (Nest-based Access Control): class file 55.0 37 | * NestMembers_attribute { 38 | * u2 attribute_name_index; 39 | * u4 attribute_length; 40 | * u2 number_of_classes; 41 | * u2 classes[number_of_classes]; 42 | * } 43 | */ 44 | public class NestMembersData extends ClassArrayData { 45 | public NestMembersData(ClassData cls) { 46 | super(cls, JasmTokens.Token.NESTMEMBERS); 47 | tableToken = NEST_MEMBERS; 48 | } 49 | 50 | public NestMembersData read(DataInputStream in, int attribute_length) throws IOException, ClassFormatError { 51 | return (NestMembersData) super.read(in, attribute_length); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/PermittedSubclassesData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import org.openjdk.asmtools.jasm.JasmTokens; 26 | 27 | import java.io.DataInputStream; 28 | import java.io.IOException; 29 | 30 | /** 31 | * The PermittedSubclasses attribute data 32 | *

33 | * JEP 360 (Sealed types): class file 59.65535 34 | * PermittedSubclasses_attribute { 35 | * u2 attribute_name_index; 36 | * u4 attribute_length; 37 | * u2 number_of_classes; 38 | * u2 classes[number_of_classes]; 39 | * } 40 | */ 41 | public class PermittedSubclassesData extends ClassArrayData { 42 | public PermittedSubclassesData(ClassData cls) { 43 | super(cls, JasmTokens.Token.PERMITTEDSUBCLASSES); 44 | } 45 | 46 | public PermittedSubclassesData read(DataInputStream in, int attribute_length) throws IOException, ClassFormatError { 47 | return (PermittedSubclassesData) super.read(in, attribute_length); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/Printable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import java.io.IOException; 26 | 27 | public interface Printable { 28 | 29 | void print() throws IOException; 30 | 31 | default boolean isPrintable() { 32 | return true; 33 | } 34 | 35 | /** 36 | * @return true if a table format is supported 37 | */ 38 | default boolean tableFormatSupported() { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/SourceFileData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import static org.openjdk.asmtools.jasm.TableFormatModel.Token.SOURCE_FILE; 26 | 27 | /** 28 | * The SourceFile attribute since 45.3 29 | *

30 | * SourceFile_attribute { 31 | * u2 attribute_name_index; 32 | * u4 attribute_length; 33 | * u2 sourcefile_index; 34 | * } 35 | */ 36 | public class SourceFileData extends AttributeData { 37 | 38 | public SourceFileData(ClassData classData) { 39 | super(classData, SOURCE_FILE); 40 | } 41 | 42 | @Override 43 | public boolean isPrintable() { 44 | return !dropSourceFile && calculateName() != null; 45 | } 46 | 47 | public String calculateName() { 48 | if (this.name == null) { 49 | this.name = pool.getString(cpx, index -> null); 50 | } 51 | return this.name; 52 | } 53 | 54 | public SourceFileData getName() { 55 | name = pool.getString(cpx, index -> "#%d".formatted(index)); 56 | return this; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/TrapData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdis; 24 | 25 | import java.io.DataInputStream; 26 | import java.io.IOException; 27 | 28 | /** 29 | * Exception table entry (JVMS 4.7.3 The Code Attribute) describes one exception handler 30 | * in the code array {@link CodeData}. 31 | */ 32 | class TrapData { 33 | 34 | int num; 35 | 36 | // exception_table 37 | int start_pc, // u2 38 | end_pc, // u2 39 | handler_pc, // u2 40 | catch_cpx; // u2 41 | 42 | public TrapData(DataInputStream in, int num) throws IOException { 43 | this.num = num; 44 | start_pc = in.readUnsignedShort(); 45 | end_pc = in.readUnsignedShort(); 46 | handler_pc = in.readUnsignedShort(); 47 | catch_cpx = in.readUnsignedShort(); 48 | } 49 | 50 | // returns recommended identifier 51 | public String id() { 52 | return "T" + num; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/jdis/notations/DescriptorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package org.openjdk.asmtools.jdis.notations; 27 | public class DescriptorException extends Exception { 28 | private static final long serialVersionUID = 2411890273788901032L; 29 | } 30 | -------------------------------------------------------------------------------- /src/org/openjdk/asmtools/util/productinfo.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. 2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 | # 4 | # This code is free software; you can redistribute it and/or modify it 5 | # under the terms of the GNU General Public License version 2 only, as 6 | # published by the Free Software Foundation. 7 | # 8 | # This code is distributed in the hope that it will be useful, but WITHOUT 9 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 | # version 2 for more details (a copy is included in the LICENSE file that 12 | # accompanied this code). 13 | # 14 | # You should have received a copy of the GNU General Public License version 15 | # 2 along with this work; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 | # 18 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | # or visit www.oracle.com if you need additional information or have any 20 | # questions. 21 | 22 | PRODUCT_NAME = %%PRODUCT_NAME%% 23 | PRODUCT_VERSION = %%PRODUCT_VERSION%% 24 | PRODUCT_MILESTONE = %%PRODUCT_MILESTONE%% 25 | PRODUCT_BUILDNUMBER = %%PRODUCT_BUILDNUMBER%% 26 | PRODUCT_NAME_LONG = %%PRODUCT_NAME_LONG%% 27 | PRODUCT_DATE = %%BUILD_DATE%% 28 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/attribute/BootstrapMethods/data/BootstrapExample02.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.attribute.BootstrapMethods.data; 24 | 25 | import java.util.function.Function; 26 | 27 | public class BootstrapExample02 { 28 | public static int main(String[] args) { 29 | Function string = s -> " = 2 x " + s; 30 | Function square = i -> (int) Math.pow(i, 2); 31 | 32 | Integer result = square.apply(2); 33 | String message = string.apply("2"); 34 | // expected: 4 = 2 x 2 35 | System.out.println("%s %s%s".formatted(BootstrapExample02.class.getName(), result, message)); 36 | return result; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/common/data/TestedHelloWorld.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.common.data; 2 | 3 | public class TestedHelloWorld { 4 | 5 | private static final int SOME_PRIMTIVE_CONSTANT=666; 6 | private static int somePrimtiveField = 999; 7 | 8 | private static final TestedHelloWorld SOME_OBJECT_CONSTANT=new TestedHelloWorld(); 9 | private static TestedHelloWorld someObjectField = new TestedHelloWorld(); 10 | 11 | private String privateMethod() { 12 | return "hello1"; 13 | } 14 | 15 | protected String protectedMethod() { 16 | return "hello2"; 17 | } 18 | 19 | public String publicMethod() { 20 | return "hello3"; 21 | } 22 | 23 | private static String privateUtilityMethod() { 24 | return "hello4"; 25 | } 26 | 27 | public static String publicUtilityMethod() { 28 | return "hello5"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/jasm/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | /** 24 | * jasm oriented tests 25 | */ 26 | package org.openjdk.asmtools.jasm; 27 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/jcoder/MultipleFilesInSingleJcoderTest.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.jcoder; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | import org.openjdk.asmtools.common.inputs.ByteInput; 6 | import org.openjdk.asmtools.common.inputs.ToolInput; 7 | import org.openjdk.asmtools.common.outputs.ByteOutput; 8 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 9 | import org.openjdk.asmtools.common.outputs.log.StderrLog; 10 | 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | import java.nio.charset.StandardCharsets; 14 | 15 | public class MultipleFilesInSingleJcoderTest { 16 | 17 | @Test 18 | public void jcod12Test() throws IOException { 19 | byte[] jcodFile = getJcodFile("12.jcod"); 20 | ToolInput file = new ByteInput(jcodFile); 21 | ByteOutput output = new ByteOutput(); 22 | DualStreamToolOutput log = new StderrLog(); //todo hide to ToolOutput.StringLog once done 23 | org.openjdk.asmtools.jcoder.Main jcod = new org.openjdk.asmtools.jcoder.Main(output, log, file, "-v"); 24 | int i = jcod.compile(); 25 | Assertions.assertEquals(0, i); 26 | Assertions.assertEquals(2, output.getOutputs().size()); 27 | } 28 | 29 | private byte[] getJcodFile(String s) throws IOException { 30 | InputStream is = this.getClass().getResourceAsStream(s); 31 | byte[] bytes = null; 32 | try (is) { 33 | bytes = is.readAllBytes(); 34 | } 35 | Assertions.assertNotNull(bytes); 36 | String jasm = new String(bytes, StandardCharsets.UTF_8); 37 | Assertions.assertNotNull(jasm); 38 | return bytes; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/jdec/JdecJcodTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.jdec; 24 | 25 | import org.junit.jupiter.api.Test; 26 | import org.openjdk.asmtools.lib.helper.BruteForceHelper; 27 | 28 | import java.io.IOException; 29 | 30 | class JdecJcodTest { 31 | 32 | @Test 33 | public void jdecJcodAllDecompileCompileAndLoad() throws IOException { 34 | BruteForceHelper worker = new BruteForceHelper(); 35 | new JdecJcod(false, worker).run(); 36 | } 37 | 38 | @Test 39 | public void jdecGJcodAllDecompileCompileAndLoad() throws IOException { 40 | BruteForceHelper worker = new BruteForceHelper(); 41 | new JdecJcod(true, worker).run(); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/action/DebugHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.action; 24 | 25 | import java.util.function.Supplier; 26 | 27 | public class DebugHelper { 28 | 29 | protected static boolean Debug = false; 30 | 31 | public static void setDebug(boolean debug) { 32 | Debug = debug; 33 | } 34 | 35 | public static boolean isDebug() { 36 | return Debug; 37 | } 38 | 39 | 40 | public static void trace(Supplier info) { 41 | if (Debug) { 42 | System.out.format("TRACE: %s%n".formatted(info.get())); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/action/Jasm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.action; 24 | 25 | import org.openjdk.asmtools.jasm.Main; 26 | import org.openjdk.asmtools.lib.log.LogAndBinResults; 27 | 28 | import java.nio.file.Path; 29 | 30 | import static org.openjdk.asmtools.lib.action.EAsmTool.JASM; 31 | 32 | public final class Jasm extends CompileActor { 33 | public Jasm() { 34 | super(JASM); 35 | inputsCompiler = (encodedFiles, encodeLog, inputs) -> 36 | new Main(encodedFiles, encodeLog, inputs); 37 | filesCompiler = (encodedFiles, encodeLog, args) -> 38 | new Main(encodedFiles, encodeLog, args); 39 | } 40 | 41 | public Jasm(Path destDir) { 42 | super(JASM, destDir); 43 | inputsCompiler = (encodedFiles, encodeLog, inputs) -> 44 | new Main(encodedFiles, encodeLog, inputs); 45 | filesCompiler = (encodedFiles, encodeLog, args) -> 46 | new Main(encodedFiles, encodeLog, args); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/action/Jcoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.action; 24 | 25 | import org.openjdk.asmtools.jcoder.Main; 26 | import org.openjdk.asmtools.lib.log.LogAndBinResults; 27 | 28 | import java.nio.file.Path; 29 | 30 | import static org.openjdk.asmtools.lib.action.EAsmTool.JCODER; 31 | 32 | public final class Jcoder extends CompileActor { 33 | 34 | public Jcoder() { 35 | super(JCODER); 36 | inputsCompiler = (encodedFiles, encodeLog, inputs) -> 37 | new Main(encodedFiles, encodeLog, inputs); 38 | filesCompiler = (encodedFiles, encodeLog, args) -> 39 | new Main(encodedFiles, encodeLog, args); 40 | } 41 | 42 | public Jcoder(Path destDir) { 43 | super(JCODER, destDir); 44 | inputsCompiler = (encodedFiles, encodeLog, inputs) -> 45 | new Main(encodedFiles, encodeLog, inputs); 46 | filesCompiler = (encodedFiles, encodeLog, args) -> 47 | new Main(encodedFiles, encodeLog, args); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/helper/ClassPathClassWork.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.lib.helper; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | 5 | import java.io.File; 6 | import java.nio.file.Paths; 7 | import java.util.Objects; 8 | import java.util.regex.Pattern; 9 | 10 | public class ClassPathClassWork { 11 | 12 | protected static Class clazz; 13 | protected static String classFile; 14 | protected static Pattern className; 15 | protected static Pattern packageName; 16 | 17 | public static void initMainClassData(Class testsClass) { 18 | initGenericClassData(testsClass,"classes"); 19 | } 20 | 21 | public static void initTestClassData(Class testsClass) { 22 | initGenericClassData(testsClass,"test-classes"); 23 | } 24 | 25 | private static void initGenericClassData(Class testsClass, String subdir) { 26 | clazz = testsClass; 27 | classFile = "./target/"+subdir+"/" + clazz.getName().replace('.', '/') + ".class"; 28 | Assertions.assertTrue(new File(classFile).exists(), "\"%s\" not found".formatted(Paths.get(classFile).toFile().getAbsolutePath())); 29 | className = Pattern.compile("public .*class .*" + clazz.getSimpleName() + " extends .*"); 30 | packageName = Pattern.compile("package "+clazz.getPackageName() + ";"); 31 | } 32 | 33 | protected String getFile(String fileResource) { 34 | File resourceDir = new File(Objects.requireNonNull(this.getClass().getResource(fileResource)).getFile()).getParentFile(); 35 | return resourceDir + File.separator + new File(fileResource).getName(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/helper/ThreeStringWriters.java: -------------------------------------------------------------------------------- 1 | package org.openjdk.asmtools.lib.helper; 2 | 3 | import org.openjdk.asmtools.common.outputs.log.DualStreamToolOutput; 4 | import org.openjdk.asmtools.common.outputs.PrintWriterOutput; 5 | import org.openjdk.asmtools.common.outputs.log.SingleDualOutputStreamOutput; 6 | import org.openjdk.asmtools.common.outputs.ToolOutput; 7 | 8 | import java.io.ByteArrayOutputStream; 9 | import java.io.PrintWriter; 10 | 11 | public class ThreeStringWriters { 12 | private final ByteArrayOutputStream toolBos = new ByteArrayOutputStream(); 13 | private final ByteArrayOutputStream errorBos = new ByteArrayOutputStream(); 14 | private final ByteArrayOutputStream loggerBos = new ByteArrayOutputStream(); 15 | private final PrintWriter toolOutput = new PrintWriter(toolBos); 16 | private final PrintWriter errorOutput = new PrintWriter(errorBos); 17 | private final PrintWriter loggerOutput = new PrintWriter(loggerBos); 18 | 19 | public void flush(){ 20 | toolOutput.flush(); 21 | errorOutput.flush(); 22 | loggerOutput.flush(); 23 | } 24 | 25 | public ToolOutput getToolOutputWrapper() { 26 | return new PrintWriterOutput(toolOutput); 27 | } 28 | public PrintWriter getToolOutput() { 29 | return toolOutput; 30 | } 31 | 32 | public PrintWriter getErrorOutput() { 33 | return errorOutput; 34 | } 35 | 36 | public PrintWriter getLoggerOutput() { 37 | return loggerOutput; 38 | } 39 | 40 | public String getLoggerBos() { 41 | return loggerBos.toString(); 42 | } 43 | 44 | public String getErrorBos() { 45 | return errorBos.toString(); 46 | } 47 | 48 | public String getToolBos() { 49 | return toolBos.toString(); 50 | } 51 | 52 | public DualStreamToolOutput getLoggers() { 53 | return new SingleDualOutputStreamOutput(getErrorOutput()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/log/LogAndBinResults.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.log; 24 | 25 | import org.openjdk.asmtools.common.inputs.ByteInput; 26 | import org.openjdk.asmtools.common.outputs.ByteOutput; 27 | import org.openjdk.asmtools.common.outputs.log.StringLog; 28 | 29 | public class LogAndBinResults extends LogAndReturn { 30 | 31 | public final ByteOutput output; 32 | 33 | public ByteInput[] getAsByteInput() { 34 | return output.getOutputs().stream().map(out->new ByteInput(out.getBody())).toArray(ByteInput[]::new); 35 | } 36 | 37 | public LogAndBinResults(ByteOutput output, StringLog log, int result) { 38 | super(log, result); 39 | this.output = output; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/log/LogAndReturn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.log; 24 | 25 | import org.openjdk.asmtools.lib.utility.StringUtils; 26 | import org.openjdk.asmtools.common.outputs.log.StringLog; 27 | 28 | import java.util.List; 29 | 30 | public class LogAndReturn { 31 | 32 | public final StringLog log; 33 | public final int result; 34 | 35 | 36 | public LogAndReturn(StringLog log, int result) { 37 | this.log = log; 38 | this.result = result; 39 | } 40 | 41 | public List getLogStringsByPrefix(String prefix) { 42 | return StringUtils.substrBetween(log.toString(), prefix, System.lineSeparator()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/log/LogAndTextResults.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.log; 24 | 25 | import org.openjdk.asmtools.common.outputs.TextOutput; 26 | import org.openjdk.asmtools.common.outputs.log.StringLog; 27 | 28 | import java.util.function.Function; 29 | import java.util.stream.Collectors; 30 | 31 | public class LogAndTextResults extends LogAndReturn { 32 | 33 | public final TextOutput output; 34 | 35 | public LogAndTextResults(TextOutput output, StringLog log, int result) { 36 | super(log, result); 37 | this.output = output; 38 | } 39 | 40 | public String getResultAsString(Function stringTransform) { 41 | return stringTransform.apply(this.output.getOutputs().stream().map(out->out.getBody()).collect(Collectors.joining())); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | /** 24 | * Helper frameworks, utilities, base classes designed to support JUnit testing of ASM tools. 25 | */ 26 | package org.openjdk.asmtools.lib; 27 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/transform/ITestRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.transform; 24 | 25 | public interface ITestRunner { 26 | void run(); 27 | } 28 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/transform/pipeline/Clazz.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.transform.pipeline; 24 | 25 | public class Clazz extends AsmtoolsType { 26 | 27 | public Clazz(Pipeline.Status status) { 28 | super(status, FileType.CLAZZ); 29 | } 30 | 31 | public Clazz(Pipeline.Status status, boolean isInput) { 32 | super(status, FileType.CLAZZ, isInput); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/transform/pipeline/Converter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.transform.pipeline; 24 | 25 | import org.openjdk.asmtools.common.outputs.log.StringLog; 26 | 27 | public class Converter { 28 | 29 | private Pipeline.Status record; 30 | private final String stageName; 31 | private StringLog log; 32 | 33 | public Converter(String stageName) { 34 | this.stageName = stageName; 35 | this.log = new StringLog(); 36 | } 37 | 38 | public StringLog log() { 39 | return log; 40 | } 41 | 42 | public Converter setLog(StringLog log) { 43 | this.log = log; 44 | return this; 45 | } 46 | 47 | public String stageName() { 48 | return stageName; 49 | } 50 | 51 | public Pipeline.Status record() { 52 | return record; 53 | } 54 | 55 | public Converter setRecord(Pipeline.Status record) { 56 | this.record = record; 57 | return this; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/transform/pipeline/Jasm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.transform.pipeline; 24 | 25 | public class Jasm extends AsmtoolsType { 26 | 27 | public Jasm(Pipeline.Status status) { 28 | super(status, FileType.JASM); 29 | } 30 | 31 | public Jasm(Pipeline.Status status, boolean isInput) { 32 | super(status, FileType.JASM, isInput); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/lib/transform/pipeline/Jcod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.lib.transform.pipeline; 24 | 25 | public class Jcod extends AsmtoolsType { 26 | 27 | public Jcod(Pipeline.Status status) { 28 | super(status, FileType.JCOD); 29 | } 30 | 31 | public Jcod(Pipeline.Status status, boolean isInput) { 32 | super(status, FileType.JCOD, isInput); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/case7902820/TestRunnerNegative.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.transform.case7902820; 24 | 25 | import org.openjdk.asmtools.lib.transform.ITestRunner; 26 | 27 | import java.util.List; 28 | 29 | public class TestRunnerNegative implements ITestRunner { 30 | 31 | private final List classNames = List.of("SourceDebugExtensionNegative01", "SourceDebugExtensionNegative02"); 32 | 33 | final String dataPackage = TestRunnerNegative.class.getPackageName() + ".data."; 34 | 35 | @Override 36 | public void run() { 37 | for (String name : classNames) { 38 | try { 39 | this.getClass().getClassLoader().loadClass(dataPackage + name).getDeclaredConstructor().newInstance(); 40 | } catch (Throwable ignored) { 41 | /* ignore to be able to analyze stderr */ 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/case7902820/data/SourceDebugExtension_source.java: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | // 5 | // This code is free software; you can redistribute it and/or modify it 6 | // under the terms of the GNU General Public License version 2 only, as 7 | // published by the Free Software Foundation. 8 | // 9 | // This code is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | // version 2 for more details (a copy is included in the LICENSE file that 13 | // accompanied this code). 14 | // 15 | // You should have received a copy of the GNU General Public License version 16 | // 2 along with this work; if not, write to the Free Software Foundation, 17 | // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | // 19 | // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | // or visit www.oracle.com if you need additional information or have any 21 | // questions. 22 | // 23 | // Java source to generate InvalidSourceDebugExtension.class.jcod & SourceDebugExtension.class.jcod 24 | // 25 | package org.openjdk.asmtools.transform.case7902820.data; 26 | 27 | public class SourceDebugExtension_source { 28 | 29 | public int calculate() { 30 | int a1 = 1; 31 | int a2 = 1; 32 | int a3 = 1; 33 | try { 34 | for (int i = a1 / (a2 - a3); i < 5; i++) { 35 | a1 += 1; 36 | } 37 | a2 = 2; 38 | } catch (ArithmeticException e) { 39 | a3 = 2; 40 | } 41 | if (a1 != 1 || a2 != 1 || a3 != 2) { 42 | System.out.print("failed"); 43 | return 2; 44 | } 45 | System.out.print("passed"); 46 | return 0; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/case7903259/BuildString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.transform.case7903259; 24 | 25 | /** 26 | * The class for producing files ["jasm", "jcoder", "jdec", "jdis"] in resources/org.openjdk.asmtools.transform.case7903259 27 | * used by case7903259Tests::NoExtensionTest() 28 | */ 29 | public final class BuildString { 30 | private final String intialString = "Hello"; 31 | public void printDecoratedString() { 32 | System.out.println(intialString.concat(" World !")); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/case8302260/data/CTestClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.transform.case8302260.data; 24 | 25 | 26 | import org.openjdk.asmtools.transform.case8302260.data.pkg.CTestSuperClass; 27 | 28 | public class CTestClass extends CTestSuperClass implements ITestInterfaceA { 29 | public static String ctestString = "CTestClass"; 30 | public static long ctestLong = 1l; 31 | } 32 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/case8302260/data/ITestInterfaceA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.transform.case8302260.data; 24 | 25 | public interface ITestInterfaceA { 26 | String stringField = "ITestInterfaceA"; 27 | long longField = 10l; 28 | 29 | String stringField3 = "ITestInterfaceA3"; 30 | long longField3 = 13L; 31 | } 32 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/case8302260/data/pkg/CTestSuperClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package org.openjdk.asmtools.transform.case8302260.data.pkg; 24 | 25 | public class CTestSuperClass { 26 | public static String stringField = "CTestSuperClass"; 27 | public static long longField = 100L; 28 | 29 | public static String stringField2 = "CTestSuperClass2"; 30 | public static long longField2 = 102L; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/java/org/openjdk/asmtools/transform/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | /** 24 | * Facilities for behavioral testing of transitions from a binary to jcod/jasm presentation and vice versa. 25 | * The stdout/stderr should be equal before and after transition as follows: 26 | *

27 | * javac class(output1) -> jasm->class(output2) => output1 == output2 28 | * javac class(output1) -> jcod->class(output2) => output1 == output2 29 | * (expected output): class(output) => expected output == output 30 | * (expected output): jasm-> class(output) => expected output == output 31 | * (expected output): jcod-> class(output) => expected output == output 32 | */ 33 | package org.openjdk.asmtools.transform; 34 | -------------------------------------------------------------------------------- /test/resources/jcod-files/abc.txt: -------------------------------------------------------------------------------- 1 | some random text -------------------------------------------------------------------------------- /test/resources/jcod-files/atrcvl00101m10p.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Ident: @(#)atrcvl00101m10p.jasm generated from: @(#)atrcvl00101m.jmpp 03/11/19 3 | * 4 | * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | package javasoft/sqe/tests/vm/classfmt/atr/atrcvl001/atrcvl00101m1; 9 | 10 | public class atrcvl00101m10p 11 | version 45:3 12 | { 13 | 14 | final Field ifi:"I" = int 200000; 15 | 16 | public Method "":"()V" 17 | throws java/lang/Exception 18 | stack 2 locals 1 19 | { 20 | aload_0; 21 | invokespecial Method java/lang/Object."":"()V"; 22 | aload_0; 23 | getfield Field ifi:"I"; 24 | ifeq OK; 25 | new class java/lang/Exception; 26 | dup; 27 | invokespecial Method java/lang/Exception."":"()V"; 28 | athrow; 29 | OK: 30 | return; 31 | } 32 | } // end Class atrcvl00101m10p 33 | -------------------------------------------------------------------------------- /test/resources/jcod-files/atrcvl00701m10p.jcod: -------------------------------------------------------------------------------- 1 | class javasoft/sqe/tests/vm/classfmt/atr/atrcvl007/atrcvl00701m1/atrcvl00701m10p { 2 | 0xCAFEBABE; 3 | 3; // minor version 4 | 45; // version 5 | [] { // Constant Pool 6 | ; // first element is empty 7 | Class #4; // #1 8 | Class #5; // #2 9 | Field #2 #6; // #3 10 | Utf8 "java/lang/Object"; // #4 11 | Utf8 "javasoft/sqe/tests/vm/classfmt/atr/atrcvl007/atrcvl00701m1/atrcvl00701m10p"; // #5 12 | NameAndType #8 #9; // #6 13 | Utf8 "ConstantValue"; // #7 14 | Utf8 "number"; // #8 15 | Utf8 "I"; // #9 16 | Integer 0x0000007B; // #10 17 | } 18 | 19 | 0x0001; // access 20 | #2; // this_cpx 21 | #1; // super_cpx 22 | 23 | [] { // Interfaces 24 | } // end of Interfaces 25 | 26 | [] { // Fields 27 | { // field 28 | 0x0009; // access 29 | #8; // name_index 30 | #9; // descriptor_index 31 | [] { // Attributes 32 | Attr(#7) { // ConstantValue 33 | #10; 34 | } // end of ConstantValue 35 | } // end of Attributes 36 | } 37 | } // end of Fields 38 | 39 | [] { // Methods 40 | } // end of Methods 41 | 42 | [] { // Attributes 43 | } // end of Attributes 44 | } 45 | -------------------------------------------------------------------------------- /test/resources/jcod-files/atrcvl00702m10p.jcod: -------------------------------------------------------------------------------- 1 | class javasoft/sqe/tests/vm/classfmt/atr/atrcvl007/atrcvl00702m1/atrcvl00702m10p { 2 | 0xCAFEBABE; 3 | 3; // minor version 4 | 45; // version 5 | [] { // Constant Pool 6 | ; // first element is empty 7 | Class #4; // #1 8 | Class #5; // #2 9 | Field #2 #6; // #3 10 | Utf8 "java/lang/Object"; // #4 11 | Utf8 "javasoft/sqe/tests/vm/classfmt/atr/atrcvl007/atrcvl00702m1/atrcvl00702m10p"; // #5 12 | NameAndType #8 #9; // #6 13 | Utf8 "constantValue"; // #7 14 | Utf8 "number"; // #8 15 | Utf8 "I"; // #9 16 | Integer 0x0000007B; // #10 17 | } 18 | 19 | 0x0001; // access 20 | #2; // this_cpx 21 | #1; // super_cpx 22 | 23 | [] { // Interfaces 24 | } // end of Interfaces 25 | 26 | [] { // Fields 27 | { // field 28 | 0x0009; // access 29 | #8; // name_index 30 | #9; // descriptor_index 31 | [] { // Attributes 32 | Attr(#7) { // constantValue 33 | 0x00 0x00 0x00 0x0A; 34 | } // end of constantValue 35 | } // end of Attributes 36 | } 37 | } // end of Fields 38 | 39 | [] { // Methods 40 | } // end of Methods 41 | 42 | [] { // Attributes 43 | } // end of Attributes 44 | } 45 | -------------------------------------------------------------------------------- /test/resources/jcod-files/atrcvl00702m11p.jcod: -------------------------------------------------------------------------------- 1 | class javasoft/sqe/tests/vm/classfmt/atr/atrcvl007/atrcvl00702m1/atrcvl00702m11p { 2 | 0xCAFEBABE; 3 | 3; // minor version 4 | 45; // version 5 | [] { // Constant Pool 6 | ; // first element is empty 7 | Class #4; // #1 8 | Class #5; // #2 9 | Field #2 #6; // #3 10 | Utf8 "java/lang/Object"; // #4 11 | Utf8 "javasoft/sqe/tests/vm/classfmt/atr/atrcvl007/atrcvl00702m1/atrcvl00702m11p"; // #5 12 | NameAndType #8 #9; // #6 13 | Utf8 "ConstantValue1"; // #7 14 | Utf8 "number"; // #8 15 | Utf8 "I"; // #9 16 | Integer 0x0000007B; // #10 17 | } 18 | 19 | 0x0001; // access 20 | #2; // this_cpx 21 | #1; // super_cpx 22 | 23 | [] { // Interfaces 24 | } // end of Interfaces 25 | 26 | [] { // Fields 27 | { // field 28 | 0x0009; // access 29 | #8; // name_index 30 | #9; // descriptor_index 31 | [] { // Attributes 32 | Attr(#7) { // ConstantValue1 33 | 0x00 0x00 0x00 0x0A; 34 | } // end of ConstantValue1 35 | } // end of Attributes 36 | } 37 | } // end of Fields 38 | 39 | [] { // Methods 40 | } // end of Methods 41 | 42 | [] { // Attributes 43 | } // end of Attributes 44 | } 45 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/LoadableDescriptors/Test01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | package org/openjdk/asmtools/attribute/LoadableDescriptors; 6 | 7 | public class Test01 version 55:0 8 | { 9 | LoadableDescriptors "LLoadableDescriptors01;", "LLoadableDescriptors02;"; 10 | 11 | InnerClass public Test01 = class Test01 of class OuterClass; 12 | } // end Class org/openjdk/asmtools/attribute/NestHost/Test01 13 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/NestHost/Test01.g.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | package org/openjdk/asmtools/attribute/NestHost; 6 | 7 | public class #2 /* Test01 */ version 55:0 8 | { 9 | const #1 = Utf8 "org/openjdk/asmtools/attribute/NestHost/Test01"; 10 | const #2 = Class #1; // Test01 11 | const #3 = Utf8 "org/openjdk/asmtools/attribute/NestHost/NestHost01"; 12 | const #4 = Utf8 "NestHost"; 13 | const #5 = Class #3; // NestHost01 14 | const #6 = Utf8 "Test01"; 15 | const #7 = Utf8 "org/openjdk/asmtools/attribute/NestHost/OuterClass"; 16 | const #8 = Class #7; // OuterClass 17 | const #9 = Utf8 "InnerClasses"; 18 | const #10 = Utf8 "Test01.jasm"; 19 | const #11 = Utf8 "SourceFile"; 20 | const #12 = Utf8 "java/lang/Object"; 21 | const #13 = Class #12; // java/lang/Object 22 | 23 | SourceFile #10; // Test01.jasm 24 | 25 | NestHost #5; // org/openjdk/asmtools/attribute/NestHost/NestHost01 26 | 27 | InnerClasses { 28 | public #6 = #2 of #8; // Test01 = class Test01 of class OuterClass 29 | } 30 | } // end Class org/openjdk/asmtools/attribute/NestHost/Test01 compiled from "Test01.jasm" 31 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/NestHost/Test01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | package org/openjdk/asmtools/attribute/NestHost; 6 | 7 | public class Test01 version 55:0 8 | { 9 | NestHost "NestHost01"; 10 | 11 | InnerClass public Test01 = class Test01 of class OuterClass; 12 | } // end Class org/openjdk/asmtools/attribute/NestHost/Test01 13 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/NestHost/Test02.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | package org/openjdk/asmtools/attribute/NestHost; 6 | 7 | public class Test02 version 55:0 8 | { 9 | SourceFile "Test02.jasm"; 10 | 11 | NestHost org/openjdk/asmtools/attribute/NestHost/NestHost02; 12 | 13 | InnerClass public Test02 = class Test02 of class OuterClass; 14 | } // end Class org/openjdk/asmtools/attribute/NestHost/Test02 compiled from "Test02.jasm" 15 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/NestMembers/Test01.g.t.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | package org/openjdk/asmtools/attribute/NestMembers/Test01; 6 | 7 | public class #2 /* Test01 */ version 55:0 8 | { 9 | const #1 = Utf8 "org/openjdk/asmtools/attribute/NestMembers/Test01/Test01"; 10 | const #2 = Class #1; // Test01 11 | const #3 = Utf8 "NestMember01"; 12 | const #4 = Utf8 "org/openjdk/asmtools/attribute/NestMembers/Test01/NestMember01"; 13 | const #5 = Class #4; // NestMember01 14 | const #6 = Utf8 "InnerClasses"; 15 | const #7 = Utf8 "NestMembers"; 16 | const #8 = Utf8 "Test01.jasm"; 17 | const #9 = Utf8 "SourceFile"; 18 | const #10 = Utf8 "java/lang/Object"; 19 | const #11 = Class #10; // java/lang/Object 20 | 21 | SourceFile #8; // Test01.jasm 22 | 23 | InnerClasses { 24 | public #3 = #5 of #2; // NestMember01 = class NestMember01 of class Test01 25 | } 26 | 27 | NestMembers #5; // NestMember01 28 | } // end Class org/openjdk/asmtools/attribute/NestMembers/Test01/Test01 compiled from "Test01.jasm" 29 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/NestMembers/Test01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | package org/openjdk/asmtools/attribute/NestMembers/Test01; 6 | 7 | public class Test01 version 55:0 8 | { 9 | InnerClass public NestMember01 = class NestMember01 of class Test01; 10 | 11 | NestMembers NestMember01; 12 | } // end Class org/openjdk/asmtools/attribute/NestMembers/Test01 13 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/attribute/PermittedSubclasses/Test01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | super public class org/openjdk/asmtools/attribute/PermittedSubclasses/Test01 6 | version 62:0 7 | { 8 | public Method "":"()V" 9 | stack 1 locals 1 10 | { 11 | aload_0; 12 | invokespecial Method java/lang/Object."":"()V"; 13 | return; 14 | } 15 | 16 | InnerClass public NestMember01 = class NestMember01 of class Test01; 17 | InnerClass public NestMember02 = class NestMember02 of class Test01; 18 | InnerClass public NestMember03 = class NestMember03 of class Test01; 19 | InnerClass public NestMember04 = class NestMember04 of class Test01; 20 | 21 | PermittedSubclasses SubClass01, SubClass02, SubClass03, SubClass04; 22 | 23 | NestMembers NestMember01, NestMember02, NestMember03, NestMember04; 24 | } // end Class Test01 25 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/common/sequence/TestInterface01n01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. 3 | */ 4 | package javasoft/sqe/tests/api/java/lang/invoke/MethodHandles/Lookup; 5 | 6 | interface TestInterface01n01 version 51:0 7 | { 8 | public static final Field iField:I = int 255; 9 | 10 | public abstract Method getTestResult:"()I"; 11 | public Method xAA:"()I" 12 | stack 1 locals 1 13 | { 14 | sipush 170; 15 | ireturn; 16 | } 17 | public static Method xBB:"()I" 18 | stack 1 locals 0 19 | { 20 | sipush 187; 21 | ireturn; 22 | } 23 | 24 | } // end Class TestInterface01n01 25 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/common/sequence/atrcod00402m1n.jcod: -------------------------------------------------------------------------------- 1 | /* 2 | * Ident: @(#)atrcod00402m1n.jcod generated from: @(#)atrcod00402m.jmpp 1.8 99/10/07 3 | * 4 | * Copyright 1999 Sun Microsystems, Inc. All rights reserved. 5 | * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | 9 | 10 | class javasoft/sqe/tests/vm/classfmt/atr/atrcod004/atrcod00402m1/atrcod00402m1n { 11 | 0xCAFEBABE; 12 | 3; // minor version 13 | 45; // version 14 | 15 | [] { // Constant Pool 16 | ; // first element is empty 17 | class #12; // #1 18 | class #6; // #2 19 | Method #1 #4; // #3 20 | NameAndType #14 #15; // #4 21 | Utf8 "ConstantValue"; // #5 22 | Utf8 "javasoft/sqe/tests/vm/classfmt/atr/atrcod004/atrcod00402m1/atrcod00402m1n"; // 23 | Utf8 "Exceptions"; // #7 24 | Utf8 "LineNumberTable"; // #8 25 | Utf8 "SourceFile"; // #9 26 | Utf8 "LocalVariables"; // #10 27 | Utf8 "Code"; // #11 at 0x92 28 | Utf8 "java/lang/Object"; // #12 29 | Utf8 "attr003.jcod"; // #13 30 | Utf8 ""; // #14 31 | Utf8 "()V"; // #15 32 | } // Constant Pool 33 | 34 | 0x0001; // access 35 | #2;// this_cpx 36 | #1;// super_cpx 37 | 38 | [] { // Interfaces 39 | } // Interfaces 40 | 41 | [] { // fields 42 | } // fields 43 | 44 | [] { // methods 45 | { // Member at 0xD4 46 | 0x0001; // access 47 | #14; // name_cpx 48 | #15; // sig_cpx 49 | [] { // Attributes 50 | Attr(#11) { // Code 51 | 1; // max_stack 52 | 1; // max_locals 53 | /* right: 54 | Bytes[5] { 55 | end right */ 56 | // wrong: 57 | Bytes[10] { 58 | // end wrong 59 | 0x2AB70003B1; 60 | }; 61 | [] { // Traps 62 | } // end Traps 63 | [] { // Attributes 64 | } // Attributes 65 | } // end Code 66 | } // Attributes 67 | } // Member 68 | } // methods 69 | 70 | [] { // Attributes 71 | } // Attributes 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/common/sequence/module-info.jcod: -------------------------------------------------------------------------------- 1 | /* 2 | * Ident: @(#)module-info.jcod generated from:%W% %E% 3 | * 4 | * Copyright (c) 1996, 2018 Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | module module-info { 8 | 0xCAFEBABE;// magic 9 | 0;// minor class version 10 | 53;// major class version 11 | []s{ 12 | { };// first element is empty 13 | Utf8 "javasoft/sqe/jck/tests/vm/atrmmc00101m012/Main0012";// #1 14 | class #1;// #2 15 | Utf8 "module-info";// #3 16 | class #3;// #4 17 | Utf8 "Module";// #5 18 | Utf8 "module012";// #6 19 | Module #6;// #7 20 | Utf8 "java.base";// #8 21 | Module #8;// #9 22 | Utf8 "javasoft/sqe/jck/tests/vm/atrmmc00101m012";// #10 23 | Package #10;// #11 24 | Utf8 "ModuleMainClass";// #12 25 | Utf8 "UNUSED_DUMMY_ATTRIBUTE";// #13 26 | String #13;// #14 27 | }; 28 | 0x8000;// module 29 | #4;// this_class{"module-info"} 30 | #0;// super_class#0 31 | // interfaces 32 | []s{ 33 | 34 | }; 35 | // fields 36 | []s{ 37 | 38 | }; 39 | // methods 40 | []s{ 41 | 42 | }; 43 | // class attributes 44 | []s{ 45 | // attribute "Module" 46 | Attr(#5) { 47 | #7;// module_name_index {"module012"} 48 | 0x0000; 49 | #0;// module_version_index #0 50 | // requires 51 | []s{ 52 | { #9 0x0020 #0 }; 53 | }; 54 | // exports 55 | []s{ 56 | { #11 0x0000 []s{} }; 57 | }; 58 | // opens 59 | []s{ 60 | { #11 0x0000 []s{} }; 61 | }; 62 | // uses 63 | [0]s{ 64 | 65 | }; 66 | // provides 67 | [0]s{ 68 | 69 | }; 70 | }; 71 | //test attribute "ModuleMainClass" 72 | //attribute_length, 1 less 73 | Attr(#12, 1) { 74 | #2;// {"javasoft/sqe/jck/tests/vm/atrmmc00101m012/Main0012"} 75 | }; 76 | 77 | 78 | }; 79 | } // end of module-info 80 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/common/sequence/nonvoidinit.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | * 23 | */ 24 | package org/openjdk/asmtools/sequence; 25 | 26 | // Interface containing non-void method. 27 | public interface nonvoidinit version 50:0 28 | { 29 | public abstract Method "":"()I"; 30 | 31 | } // end Class nonvoidinit 32 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/common/sequence/voidinit.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | * 23 | */ 24 | package org/openjdk/asmtools/sequence; 25 | 26 | // Interface containing void method. 27 | public interface voidinit version 50:0 28 | { 29 | public abstract Method "":"()V"; 30 | 31 | } // end Class voidinit 32 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile01.g.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName01.class version 66:0 2 | { 3 | const #1 = Method #2.#3; // java/lang/Object."":"()V" 4 | const #2 = class #4; // java/lang/Object 5 | const #3 = NameAndType #5:#6; // "":"()V" 6 | const #4 = Utf8 "java/lang/Object"; 7 | const #5 = Utf8 ""; 8 | const #6 = Utf8 "()V"; 9 | const #7 = class #10; // ClassName 10 | const #8 = Utf8 "java/lang/String"; 11 | const #9 = class #8; // java/lang/String 12 | const #10 = Utf8 "ClassName01"; 13 | const #11 = Utf8 "Code"; 14 | const #12 = Utf8 "LineNumberTable"; 15 | const #13 = Utf8 "m"; 16 | const #14 = Utf8 "JasmFile.g.jasm"; 17 | const #15 = Utf8 "SourceFile"; 18 | 19 | this_class: #7; // ClassName01 20 | super_class #9; // java/lang/String 21 | 22 | public Method #5:#6 // "":"()V" 23 | stack 1 locals 1 24 | { 25 | 0: aload_0; 26 | 1: invokespecial #1; // Method java/lang/Object."":"()V" 27 | 4: return; 28 | } 29 | private static Method #13:#6 // m:"()V" 30 | stack 0 locals 0 31 | { 32 | 0: return; 33 | } 34 | 35 | SourceFile #14; // JasmFile01.g.jasm 36 | } 37 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile01.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName01.class version 66:0 2 | { 3 | this_class ClassName01; 4 | super_class java/lang/String; 5 | 6 | public Method "":"()V" 7 | stack 1 locals 1 8 | { 9 | aload_0; 10 | invokespecial Method java/lang/Object."":"()V"; 11 | return; 12 | } 13 | private static Method m:"()V" 14 | stack 0 locals 0 15 | { 16 | return; 17 | } 18 | 19 | SourceFile "JasmFile.g.jasm"; 20 | } // end Class ClassName01 compiled from "JasmFile.g.jasm" 21 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile02.g.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName02.data version 66:0 2 | { 3 | const #1 = Method #2.#3; // java/lang/Object."":"()V" 4 | const #2 = class #4; // java/lang/Object 5 | const #3 = NameAndType #5:#6; // "":"()V" 6 | const #4 = Utf8 "java/lang/Object"; 7 | const #5 = Utf8 ""; 8 | const #6 = Utf8 "()V"; 9 | const #7 = class #10; // ClassName is not used 10 | const #8 = Utf8 "java/lang/String"; 11 | const #9 = class #8; // java/lang/String 12 | const #10 = Utf8 "ClassName"; 13 | const #11 = Utf8 "Code"; 14 | const #12 = Utf8 "LineNumberTable"; 15 | const #13 = Utf8 "m"; 16 | const #14 = Utf8 "JasmFile.g.jasm"; 17 | const #15 = Utf8 "SourceFile"; 18 | 19 | this_class: ClassName02; 20 | super_class #9; // java/lang/String 21 | 22 | public Method #5:#6 // "":"()V" 23 | stack 1 locals 1 24 | { 25 | 0: aload_0; 26 | 1: invokespecial #1; // Method java/lang/Object."":"()V" 27 | 4: return; 28 | } 29 | private static Method #13:#6 // m:"()V" 30 | stack 0 locals 0 31 | { 32 | 0: return; 33 | } 34 | 35 | SourceFile #14; // JasmFile02.g.jasm 36 | } 37 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile02.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName02.data extends java/lang/String version 66:0 2 | { 3 | this_class ClassName02; 4 | super_class java/lang/String; 5 | 6 | public Method "":"()V" 7 | stack 1 locals 1 8 | { 9 | aload_0; 10 | invokespecial Method java/lang/Object."":"()V"; 11 | return; 12 | } 13 | private static Method m:"()V" 14 | stack 0 locals 0 15 | { 16 | return; 17 | } 18 | 19 | SourceFile "JasmFile.g.jasm"; 20 | } // end Class ClassName01 compiled from "JasmFile.g.jasm" 21 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile03.g.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName03 extends package/ClassName version 66:0 2 | { 3 | const #1 = Method #2.#3; // java/lang/Object."":"()V" 4 | const #2 = class #4; // java/lang/Object 5 | const #3 = NameAndType #5:#6; // "":"()V" 6 | const #4 = Utf8 "java/lang/Object"; 7 | const #5 = Utf8 ""; 8 | const #6 = Utf8 "()V"; 9 | const #7 = class #10; // ClassName03 10 | const #8 = Utf8 "package/SuperClassName03"; 11 | const #9 = class #8; // package/SuperClassName03 12 | const #10 = Utf8 "ClassName03"; 13 | const #11 = Utf8 "Code"; 14 | const #12 = Utf8 "LineNumberTable"; 15 | const #13 = Utf8 "m"; 16 | const #14 = Utf8 "JasmFile.g.jasm"; 17 | const #15 = Utf8 "SourceFile"; 18 | 19 | this_class: #7; // ClassName03 20 | super_class #9; // package/SuperClassName03 21 | 22 | public Method #5:#6 // "":"()V" 23 | stack 1 locals 1 24 | { 25 | 0: aload_0; 26 | 1: invokespecial #1; // Method java/lang/Object."":"()V" 27 | 4: return; 28 | } 29 | private static Method #13:#6 // m:"()V" 30 | stack 0 locals 0 31 | { 32 | 0: return; 33 | } 34 | 35 | SourceFile #14; // JasmFile03.g.jasm 36 | } 37 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile03.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName03.class extends java/lang/String version 66:0 2 | { 3 | this_class ClassName03; 4 | super_class package/SuperClassName03; 5 | 6 | public Method "":"()V" 7 | stack 1 locals 1 8 | { 9 | aload_0; 10 | invokespecial Method java/lang/Object."":"()V"; 11 | return; 12 | } 13 | private static Method m:"()V" 14 | stack 0 locals 0 15 | { 16 | return; 17 | } 18 | 19 | SourceFile "JasmFile.g.jasm"; 20 | } // end Class ClassName01 compiled from "JasmFile.g.jasm" 21 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile04.g.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName04.obj extends #2 version 66:0 2 | { 3 | const #1 = Method #2.#3; // java/lang/Object."":"()V" 4 | const #2 = class #4; // java/lang/Object 5 | const #3 = NameAndType #5:#6; // "":"()V" 6 | const #4 = Utf8 "java/lang/Object"; 7 | const #5 = Utf8 ""; 8 | const #6 = Utf8 "()V"; 9 | const #7 = class #10; // ClassName03 -- ignored 10 | const #8 = Utf8 "package/SuperClassName03"; 11 | const #9 = class #8; // package/SuperClassName03 -- ignored 12 | const #10 = Utf8 "ClassName03"; 13 | const #11 = Utf8 "Code"; 14 | const #12 = Utf8 "LineNumberTable"; 15 | const #13 = Utf8 "m"; 16 | const #14 = Utf8 "JasmFile.g.jasm"; 17 | const #15 = Utf8 "SourceFile"; 18 | 19 | this_class: ClassName04; 20 | super_class package/SuperClassName04; 21 | 22 | public Method #5:#6 // "":"()V" 23 | stack 1 locals 1 24 | { 25 | 0: aload_0; 26 | 1: invokespecial #1; // Method java/lang/Object."":"()V" 27 | 4: return; 28 | } 29 | private static Method #13:#6 // m:"()V" 30 | stack 0 locals 0 31 | { 32 | 0: return; 33 | } 34 | 35 | SourceFile #14; // JasmFile03.g.jasm 36 | } 37 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903558/JasmFile04.jasm: -------------------------------------------------------------------------------- 1 | public super class FileName04.obj extends package/SuperClassName04 version 66:0 2 | { 3 | this_class: ClassName04; 4 | super_class: java/lang/Object; 5 | 6 | public Method "":"()V" 7 | stack 1 locals 1 8 | { 9 | aload_0; 10 | invokespecial Method java/lang/Object."":"()V"; 11 | return; 12 | } 13 | 14 | private static Method m:"()V" 15 | stack 0 locals 0 16 | { 17 | return; 18 | } 19 | 20 | SourceFile "JasmFile.g.jasm"; 21 | } // end Class ClassName04 compiled from "JasmFile.g.jasm" 22 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test00.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"(Ljava/lang/String;)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test01.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test02.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"(Ljava/lang/String)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test03.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"([X" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test04.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"(X)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test05.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"(Ljava/lang/String)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test06.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"Ljava/lang/String;)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test07.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"([X)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test08.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"([)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test09.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"(Ljava/lang/String[)Ljava/lang/String;" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903976/Test10.jasm: -------------------------------------------------------------------------------- 1 | identity class Test00 version 69:0 2 | { 3 | Method "":"()V" 4 | stack 1 locals 1 5 | { 6 | aload_0; 7 | invokespecial Method java/lang/Object."":"()V"; 8 | return; 9 | } 10 | 11 | Method m:"(Ljava/lang/String" 12 | stack 1 locals 2 13 | { 14 | aconst_null; 15 | areturn; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/case7903987/Test00.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle, Red Hat and/or theirs affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | identity class Test00 version 69:0 24 | { 25 | const #1=true; 26 | const #2=192837465; 27 | const #3=1l; 28 | const #5=2.1f; 29 | const #6=2.2d; 30 | const #8="Long utf-8"; 31 | const #9=false; 32 | 33 | Field v1:I; 34 | 35 | Method "":"()V" 36 | stack 1 locals 1 37 | { 38 | aload_0; 39 | invokespecial Method java/lang/Object."":"()V"; 40 | return; 41 | } 42 | 43 | Method m:"(Ljava/lang/String;)Ljava/lang/String;" 44 | stack 1 locals 2 45 | { 46 | aconst_null; 47 | areturn; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/jasm/clfacc00610m10p.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996, 2018 Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | */ 5 | 6 | package javasoft/sqe/tests/vm/classfmt/clf/clfacc006/clfacc00610m1; 7 | 8 | public class clfacc00610m10p { 9 | 10 | public Method :"()V" 11 | stack 4 locals 1 12 | { 13 | aload_0; 14 | invokespecial Method java/lang/Object.:"()V"; 15 | 16 | iconst_1; 17 | anewarray class clfacc00610m10p_; 18 | pop; 19 | 20 | return; 21 | } 22 | } 23 | 24 | private class clfacc00610m10p_ { 25 | 26 | public Method :"()V" 27 | stack 1 locals 1 28 | { 29 | aload_0; 30 | invokespecial Method java/lang/Object.:"()V"; 31 | return; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassField00.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | abstract interface class ClassField00 version 69:0 26 | { 27 | static public protected Field field0:"I"; 28 | 29 | static public final transient Field field1:"I"; 30 | 31 | Method "init":"()V" 32 | stack 4 locals 1 33 | { 34 | aload_0; 35 | invokespecial Method java/lang/Object."":"()V"; 36 | return; 37 | stack_map class ClassField00, float; 38 | putfield Field field:"I"; 39 | return; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassField01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | value abstract class ClassField01 version 69:65535 26 | { 27 | 28 | static public final volatile Field field0:"I"; 29 | 30 | static public final strict transient Field field1:"I"; 31 | 32 | Method "init":"()V" 33 | stack 4 locals 1 34 | { 35 | aload_0; 36 | invokespecial Method java/lang/Object."":"()V"; 37 | return; 38 | stack_map class ClassField01, float; 39 | putfield Field field:"I"; 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassField03.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | abstract interface class ClassField03 version 69:0 26 | { 27 | 28 | static public final Field field0:"I"; 29 | 30 | static public final strict Field field1:"I"; 31 | 32 | Method "init":"()V" 33 | stack 4 locals 1 34 | { 35 | aload_0; 36 | invokespecial Method java/lang/Object."":"()V"; 37 | return; 38 | stack_map class ClassField03, float; 39 | putfield Field field:"I"; 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassField04.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | // Each field of a value class must have at least one of its ACC_STATIC or ACC_STRICT_INIT flags set. 26 | 27 | value final class ClassField04 version 69:65535 28 | { 29 | // OK 30 | static public final strict Field field0:"I"; 31 | public strict synthetic Field field1:"I"; 32 | public static enum Field field2:"I"; 33 | 34 | // negative 35 | public final Field field3:"I"; 36 | Field field4:"I"; 37 | 38 | Method "init":"()V" 39 | stack 4 locals 1 40 | { 41 | aload_0; 42 | invokespecial Method java/lang/Object."":"()V"; 43 | return; 44 | stack_map class ClassField04, float; 45 | putfield Field field:"I"; 46 | return; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile00.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public value class ClassFile00 version 69:0 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile00, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile01.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public identity class ClassFile01 version 69:0 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile01, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile02.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public identity class ClassFile02 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile02, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile03.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public value class ClassFile03 { 26 | 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile03, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile04.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public identity value class ClassFile04 version 69:65535 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile04, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile05.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | private public identity class ClassFile05 version 69:65535 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile05, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile06.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public identity enum interface class ClassFile06 version 69:65535 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile06, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile07.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | // If the ACC_ANNOTATION flag is set, the ACC_INTERFACE flag must also be set. 26 | 27 | public annotation class ClassFile06 version 69:65535 28 | { 29 | strict private Field field:"I"; 30 | 31 | Method "":"()V" 32 | stack 4 locals 1 33 | { 34 | aload_0; 35 | invokespecial Method java/lang/Object."":"()V"; 36 | return; 37 | stack_map class ClassFile07, float; 38 | putfield Field field:"I"; 39 | return; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile08.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | // If the ACC_INTERFACE flag is set, the ACC_ABSTRACT flag must also be set, 26 | // and the ACC_FINAL, ACC_SUPER ACC_IDENTITY, ACC_ENUM, and ACC_MODULE flags set must not be set. 27 | 28 | interface enum class ClassFile08 version 69:65535 29 | { 30 | public Field field:"I"; 31 | 32 | Method "init":"()V" 33 | stack 4 locals 1 34 | { 35 | aload_0; 36 | invokespecial Method java/lang/Object."":"()V"; 37 | return; 38 | stack_map class ClassFile08, float; 39 | putfield Field field:"I"; 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile09.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | // If the ACC_INTERFACE flag is not set, any of the other flags in Table 4.1-B may be set except ACC_ANNOTATION and ACC_MODULE. 26 | // However, such a class file must have at least one of its ACC_FINAL, ACC_IDENTITY, or ACC_ABSTRACT flags set, 27 | // and must not have both its ACC_FINAL and ACC_ABSTRACT flags set (JLS §8.1.1.2). 28 | 29 | value class ClassFile09 version 69:65535 30 | { 31 | public Field field:"I"; 32 | 33 | Method "init":"()V" 34 | stack 4 locals 1 35 | { 36 | aload_0; 37 | invokespecial Method java/lang/Object."":"()V"; 38 | return; 39 | stack_map class ClassFile09, float; 40 | putfield Field field:"I"; 41 | return; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile10.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | // If the ACC_INTERFACE flag is not set, any of the other flags in Table 4.1-B may be set except ACC_ANNOTATION and ACC_MODULE. 26 | // However, such a class file must have at least one of its ACC_FINAL, ACC_IDENTITY, or ACC_ABSTRACT flags set, 27 | // and must not have both its ACC_FINAL and ACC_ABSTRACT flags set (JLS §8.1.1.2). 28 | 29 | value abstract final class ClassFile10 version 69:65535 30 | { 31 | static public Field field:"I"; 32 | 33 | Method "init":"()V" 34 | stack 4 locals 1 35 | { 36 | aload_0; 37 | invokespecial Method java/lang/Object."":"()V"; 38 | return; 39 | stack_map class ClassFile10, float; 40 | putfield Field field:"I"; 41 | return; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile11.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | final value class ClassFile11 version 69:65535 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile11, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile12.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | identity class ClassFile12 version 69:65535 26 | { 27 | strict private Field field:"I"; 28 | 29 | Method "":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile12, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile13.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | value interface ClassFile13 version 69:65535 26 | { 27 | strict public static final Field field:"I"; 28 | 29 | Method "init":"()V" 30 | stack 4 locals 1 31 | { 32 | aload_0; 33 | invokespecial Method java/lang/Object."":"()V"; 34 | return; 35 | stack_map class ClassFile13, float; 36 | putfield Field field:"I"; 37 | return; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile14.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public super class ClassFile14 version 69:0 26 | { 27 | strict private Field field00:"I"; 28 | private Field field01:"I"; 29 | 30 | Method "":"()V" 31 | stack 4 locals 1 32 | { 33 | aload_0; 34 | invokespecial Method java/lang/Object."":"()V"; 35 | return; 36 | stack_map class ClassFile00, float; 37 | putfield Field field:"I"; 38 | return; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/structure/ClassFile/ClassFile15.jasm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * version 2 for more details (a copy is included in the LICENSE file that 13 | * accompanied this code). 14 | * 15 | * You should have received a copy of the GNU General Public License version 16 | * 2 along with this work; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 | * or visit www.oracle.com if you need additional information or have any 21 | * questions. 22 | */ 23 | package javasoft/sqe/tests; 24 | 25 | public super class ClassFile15 version 69:65535 26 | { 27 | strict private Field field00:"I"; 28 | private Field field01:"I"; 29 | 30 | Method "":"()V" 31 | stack 4 locals 1 32 | { 33 | aload_0; 34 | invokespecial Method java/lang/Object."":"()V"; 35 | return; 36 | stack_map class ClassFile00, float; 37 | putfield Field field:"I"; 38 | return; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/transform/case7903259/jdec.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openjdk/asmtools/080f0834c5053660b7e811351ccb81c0d84899eb/test/resources/org/openjdk/asmtools/transform/case7903259/jdec.bin -------------------------------------------------------------------------------- /test/resources/org/openjdk/asmtools/transform/case7903259/jdis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openjdk/asmtools/080f0834c5053660b7e811351ccb81c0d84899eb/test/resources/org/openjdk/asmtools/transform/case7903259/jdis.bin --------------------------------------------------------------------------------