Skip to content

Commit 22ffb30

Browse files
hansonrhansonr
authored andcommitted
3.2.2 @j2sNative fixes for qualified methods
1 parent 8ed6412 commit 22ffb30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+419
-766
lines changed
962 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180730180217
1+
20180801101958
962 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180730180217
1+
20180801101958

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/VariableAdapter.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class VariableAdapter extends VisitorAdapter {
3131
*
3232
* 2006-12-6
3333
*/
34-
static class FinalVariable {
34+
static class LocalVariable {
3535

3636
/**
3737
* Level of the block
@@ -59,15 +59,15 @@ static class FinalVariable {
5959
*/
6060
String prefixedName;
6161

62-
FinalVariable(int blockLevel, String variableName, String methodScope) {
62+
LocalVariable(int blockLevel, String variableName, String methodScope) {
6363
super();
6464
this.blockLevel = blockLevel;
6565
this.variableName = variableName;
6666
this.methodScope = methodScope;
6767
}
6868

6969
public String toString() {
70-
return variableName + ":" + variableName;
70+
return variableName + ":" + variableName + "[" + blockLevel + "," + methodScope + "]";
7171
}
7272

7373
public int hashCode() {
@@ -88,7 +88,7 @@ public boolean equals(Object obj) {
8888
return true;
8989
if (obj == null || getClass() != obj.getClass())
9090
return false;
91-
final FinalVariable other = (FinalVariable) obj;
91+
final LocalVariable other = (LocalVariable) obj;
9292
if (blockLevel != other.blockLevel)
9393
return false;
9494
if (methodScope == null) {
@@ -110,30 +110,32 @@ public boolean equals(Object obj) {
110110
}
111111

112112
}
113-
113+
114+
public VariableAdapter() {
115+
}
114116
/**
115117
* Final variables only make senses (need "this.$finals[...]") inside anonymous
116118
* class.
117119
*/
118-
boolean isAnonymousClass = true;
120+
boolean isAnonymousOrLocalClass = true;
119121

120122
/**
121123
* List of variables that are declared as final.
122124
*/
123-
List<FinalVariable> finalVars = new ArrayList<FinalVariable>();
125+
List<LocalVariable> finalVars = new ArrayList<LocalVariable>();
124126

125127
/**
126128
* Normal (non-final) variables may be affected by final variable names.
127129
*/
128-
List<FinalVariable> normalVars = new ArrayList<FinalVariable>();
130+
List<LocalVariable> normalVars = new ArrayList<LocalVariable>();
129131

130132
/**
131133
* Only those final variables that are referenced inside anonymous class
132134
* need to be passed into anonymous class.
133135
*/
134-
List<FinalVariable> visitedVars = new ArrayList<FinalVariable>();
136+
List<LocalVariable> visitedVars = new ArrayList<LocalVariable>();
135137

136-
List<FinalVariable> getVariableList(char fvn) {
138+
List<LocalVariable> getVariableList(char fvn) {
137139
switch (fvn) {
138140
case 'f':
139141
return finalVars;

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/VisitorAdapter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ public class VisitorAdapter {
2020

2121
protected Java2ScriptVisitor visitor;
2222

23-
public void setVisitor(Java2ScriptVisitor visitor) {
23+
public VisitorAdapter setVisitor(Java2ScriptVisitor visitor) {
2424
this.visitor = visitor;
25+
return this;
2526
}
2627

2728
}

sources/net.sf.j2s.java.core/src/a2s/Canvas.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ public void paint(Graphics g) {
2424
}
2525

2626
private boolean notified;
27+
@SuppressWarnings("unused")
2728
@Override
2829
public void update(Graphics g) {
2930
if (!notified)
3031
System.out.println("neither paint(g) nor update(g) is implemented for " + this);
3132
notified = true;
32-
/**
33-
* @j2sNative
34-
*
35-
* this.paintComponent$java_awt_Graphics && this.paintComponent$java_awt_Graphics(g);
36-
*
37-
*/
38-
{}
33+
if (/** @j2sNative this.paintComponent$java_awt_Graphics || */false)
34+
paintComponent(g);
3935
}
4036
}

sources/net.sf.j2s.java.core/src/a2s/Frame.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,7 @@ public Frame(String title, GraphicsConfiguration gc) {
3737

3838
@Override
3939
public void remove(int i) {
40-
/**
41-
* SwingJ has a somewhat reduced method set; we just use
42-
* this interface to add ones we feel we need.
43-
*
44-
* @j2sNative
45-
*
46-
* this.removeInt(i);
47-
*
48-
*/
49-
{
50-
super.remove(i);
51-
}
40+
super.remove(i);
5241
}
5342

5443
public void setMenuBar(MenuBar m) {

sources/net.sf.j2s.java.core/src/a2s/Util.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
public class Util {
77

88
public static void drawString(Graphics g, String text, int x, int y) {
9-
/**
10-
* @j2sNative
11-
*
12-
* g.drawStringUnique(text, x, y);
13-
*
14-
*/
15-
{
169
g.drawString(text, x, y);
17-
return;
18-
}
1910
}
2011
}

sources/net.sf.j2s.java.core/src/gnu/jpdf/PDFGraphics.java

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)