File tree 1 file changed +9
-7
lines changed
src/jdk.jdeps/share/classes/com/sun/tools/javap
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2007, 2020 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2007, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -92,20 +92,22 @@ public void writeVerboseHeader(CodeAttribute attr) {
92
92
public void writeInstrs (CodeAttribute attr ) {
93
93
List <InstructionDetailWriter > detailWriters = getDetailWriters (attr );
94
94
95
- int pc = 0 ;
95
+ int [] pcState = { 0 } ;
96
96
try {
97
- for ( var coe : attr ) {
97
+ attr . forEach ( coe -> {
98
98
if (coe instanceof Instruction instr ) {
99
- for (InstructionDetailWriter w : detailWriters )
99
+ int pc = pcState [0 ];
100
+ for (InstructionDetailWriter w : detailWriters )
100
101
w .writeDetails (pc , instr );
101
102
writeInstr (pc , instr , attr );
102
- pc += instr .sizeInBytes ();
103
+ pcState [ 0 ] = pc + instr .sizeInBytes ();
103
104
}
104
- }
105
+ });
105
106
} catch (IllegalArgumentException e ) {
106
- report ("error at or after byte " + pc );
107
+ report ("error at or after address " + pcState [ 0 ] + ": " + e . getMessage () );
107
108
}
108
109
110
+ int pc = pcState [0 ];
109
111
for (InstructionDetailWriter w : detailWriters )
110
112
w .flush (pc );
111
113
}
You can’t perform that action at this time.
0 commit comments