Skip to content

Commit

Permalink
Small noop cleanup in JTypeOracle.
Browse files Browse the repository at this point in the history
Change-Id: I16baa5d2b98a65bba0a0ef9761a9b5c02d2caef1
  • Loading branch information
rluble authored and Gerrit Code Review committed Oct 8, 2015
1 parent bf45dc4 commit 3ea97d0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java
Expand Up @@ -154,7 +154,7 @@ public void setOptimize(boolean optimize) {
*/ */
private static final class CheckClinitVisitor extends JVisitor { private static final class CheckClinitVisitor extends JVisitor {


private final Set<JDeclaredType> clinitTargets = Sets.newIdentityHashSet(); private final Set<JDeclaredType> clinitTargets = Sets.newLinkedHashSet();


/** /**
* Tracks whether any live code is run in this clinit. This is only reliable * Tracks whether any live code is run in this clinit. This is only reliable
Expand All @@ -166,8 +166,8 @@ private static final class CheckClinitVisitor extends JVisitor {
*/ */
private boolean hasLiveCode = false; private boolean hasLiveCode = false;


public JDeclaredType[] getClinitTargets() { public Set<JDeclaredType> getClinitTargets() {
return clinitTargets.toArray(new JDeclaredType[clinitTargets.size()]); return clinitTargets;
} }


public boolean hasLiveCode() { public boolean hasLiveCode() {
Expand All @@ -191,8 +191,9 @@ public boolean visit(JDeclarationStatement x, Context ctx) {
JVariable target = x.getVariableRef().getTarget(); JVariable target = x.getVariableRef().getTarget();
if (target instanceof JField) { if (target instanceof JField) {
JField field = (JField) target; JField field = (JField) target;
assert field.isStatic();
// {@See ControlFlowAnalizer.rescue(JVariable var) // {@See ControlFlowAnalizer.rescue(JVariable var)
if (field.getLiteralInitializer() != null && field.isStatic()) { if (field.getLiteralInitializer() != null) {
// Literal initializers for static fields, even though they appear in the clinit they are // Literal initializers for static fields, even though they appear in the clinit they are
// not considered part of it; instead they are normally considered part of the fields they // not considered part of it; instead they are normally considered part of the fields they
// initialize. // initialize.
Expand Down Expand Up @@ -1071,11 +1072,10 @@ private JDeclaredType computeClinitTargetRecursive(JDeclaredType type,
return type; return type;
} }
// Check for trivial super clinit. // Check for trivial super clinit.
JDeclaredType[] clinitTargets = v.getClinitTargets(); Collection<JDeclaredType> clinitTargets = v.getClinitTargets();
if (clinitTargets.length == 1) { if (clinitTargets.size() == 1) {
JDeclaredType singleTarget = clinitTargets[0]; JDeclaredType singleTarget = clinitTargets.iterator().next();
if (type instanceof JClassType && singleTarget instanceof JClassType if (isSuperClass(type, singleTarget)) {
&& isSuperClass(type, singleTarget)) {
return singleTarget.getClinitTarget(); return singleTarget.getClinitTarget();
} }
} }
Expand Down

0 comments on commit 3ea97d0

Please sign in to comment.