Revision: 9642
Author: sco...@google.com
Date: Thu Jan 27 12:46:16 2011
Log: Sort & format some files.
Review by: zun...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9642
Modified:
/trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
/trunk/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
/trunk/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
=======================================
---
/trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
Thu Sep 23 06:33:21 2010
+++
/trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
Thu Jan 27 12:46:16 2011
@@ -83,17 +83,14 @@
MethodArgNamesLookup methodArgs =
MethodParamCollector.collect(cud);
StringInterner interner = StringInterner.get();
- String packageName = interner.intern(
- Shared.getPackageName(builder.getTypeName()));
+ String packageName =
interner.intern(Shared.getPackageName(builder.getTypeName()));
List<String> unresolvedQualified = new ArrayList<String>();
List<String> unresolvedSimple = new ArrayList<String>();
for (char[] simpleRef :
cud.compilationResult().simpleNameReferences) {
unresolvedSimple.add(interner.intern(String.valueOf(simpleRef)));
}
- for (char[][] qualifiedRef :
- cud.compilationResult().qualifiedReferences) {
- unresolvedQualified.add(
- interner.intern(CharOperation.toString(qualifiedRef)));
+ for (char[][] qualifiedRef :
cud.compilationResult().qualifiedReferences) {
+
unresolvedQualified.add(interner.intern(CharOperation.toString(qualifiedRef)));
}
for (String jsniDep : jsniDeps) {
unresolvedQualified.add(interner.intern(jsniDep));
@@ -148,11 +145,10 @@
public CompileMoreLater(AdditionalTypeProviderDelegate delegate) {
compiler.setAdditionalTypeProviderDelegate(delegate);
}
-
+
public Collection<CompilationUnit> addGeneratedTypes(TreeLogger logger,
Collection<GeneratedUnit> generatedUnits) {
- Event compilationStateBuilderProcess =
-
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
+ Event compilationStateBuilderProcess =
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
try {
return doBuildGeneratedTypes(logger, generatedUnits, this);
} finally {
@@ -269,19 +265,17 @@
public static CompilationState buildFrom(TreeLogger logger,
Set<Resource> resources) {
- Event compilationStateBuilderProcessEvent =
-
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
- try {
- return instance.doBuildFrom(logger, resources, null);
- } finally {
- compilationStateBuilderProcessEvent.end();
- }
+ Event compilationStateBuilderProcessEvent =
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
+ try {
+ return instance.doBuildFrom(logger, resources, null);
+ } finally {
+ compilationStateBuilderProcessEvent.end();
+ }
}
public static CompilationState buildFrom(TreeLogger logger,
Set<Resource> resources, AdditionalTypeProviderDelegate delegate) {
- Event compilationStateBuilderProcessEvent =
-
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
+ Event compilationStateBuilderProcessEvent =
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
try {
return instance.doBuildFrom(logger, resources, delegate);
} finally {
@@ -342,22 +336,20 @@
/**
* Build a new compilation state from a source oracle.
*/
- public CompilationState doBuildFrom(TreeLogger logger,
- Set<Resource> resources) {
+ public CompilationState doBuildFrom(TreeLogger logger, Set<Resource>
resources) {
return doBuildFrom(logger, resources, null);
}
/**
- * Build a new compilation state from a source oracle. Allow the caller
to specify
- * a compiler delegate that will handle undefined names.
+ * Build a new compilation state from a source oracle. Allow the caller
to
+ * specify a compiler delegate that will handle undefined names.
*
* TODO: maybe use a finer brush than to synchronize the whole thing.
*/
public synchronized CompilationState doBuildFrom(TreeLogger logger,
Set<Resource> resources, AdditionalTypeProviderDelegate
compilerDelegate) {
- Event compilationStateBuilderProcess =
-
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
-
+ Event compilationStateBuilderProcess =
SpeedTracerLogger.start(DevModeEventType.COMPILATION_STATE_BUILDER_PROCESS);
+
try {
// Units we definitely want to build.
List<CompilationUnitBuilder> builders = new
ArrayList<CompilationUnitBuilder>();
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java Wed Dec
1 13:52:36 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java Thu Jan
27 12:46:16 2011
@@ -213,8 +213,9 @@
return;
}
if (target.isDeprecated()) {
- emitWarning("deprecation", "Referencing deprecated field '"
- + jsniRef.className() + "." + jsniRef.memberName() + "'");
+ emitWarning("deprecation",
+ "Referencing deprecated field '" + jsniRef.className() + "."
+ + jsniRef.memberName() + "'");
}
if (hasUnsafeLongsAnnotation) {
@@ -237,8 +238,9 @@
return;
}
if (target.isDeprecated()) {
- emitWarning("deprecation", "Referencing deprecated method '"
- + jsniRef.className() + "." + jsniRef.memberName() + "'");
+ emitWarning("deprecation",
+ "Referencing deprecated method '" + jsniRef.className() + "."
+ + jsniRef.memberName() + "'");
}
if (hasUnsafeLongsAnnotation) {
=======================================
---
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
Fri Jan 21 04:40:04 2011
+++
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
Thu Jan 27 12:46:16 2011
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not
* use this file except in compliance with the License. You may obtain a
copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -168,8 +168,6 @@
*/
public class JavaToJavaScriptCompiler {
- private static final String ENUM_NAME_OBFUSCATION_PROPERTY
= "compiler.enum.obfuscate.names";
-
private static class PermutationResultImpl implements PermutationResult {
private final ArtifactSet artifacts = new ArtifactSet();
private final byte[][] js;
@@ -234,15 +232,15 @@
return true;
}
}
+
+ private static final String ENUM_NAME_OBFUSCATION_PROPERTY
= "compiler.enum.obfuscate.names";
/**
* Compiles a particular permutation, based on a precompiled unified AST.
- *
+ *
* @param logger the logger to use
* @param unifiedAst the result of a
- * {@link #precompile(TreeLogger, ModuleDef,
RebindPermutationOracle,
- * String[], String[], JJSOptions, boolean,
- * PrecompilationMetricsArtifact)}
+ * {@link #precompile(TreeLogger, ModuleDef,
RebindPermutationOracle, String[], String[], JJSOptions, boolean,
PrecompilationMetricsArtifact)}
* @param permutation the permutation to compile
* @return the output JavaScript
* @throws UnableToCompleteException if an error other than
@@ -309,8 +307,8 @@
// (7) Generate a JavaScript code DOM from the Java type declarations
jprogram.typeOracle.recomputeAfterOptimizations();
- JavaToJavaScriptMap jjsmap = GenerateJavaScriptAST.exec(jprogram,
jsProgram,
- options.getOutput(), symbolTable, propertyOracles);
+ JavaToJavaScriptMap jjsmap = GenerateJavaScriptAST.exec(jprogram,
+ jsProgram, options.getOutput(), symbolTable, propertyOracles);
// (8) Normalize the JS AST.
// Fix invalid constructs created during JS AST gen.
@@ -337,7 +335,7 @@
/*
* Work around Safari 5 bug by rewriting a >> b as ~~a >> b.
- *
+ *
* No shifts may be generated after this point.
*/
JsCoerceIntShift.exec(jsProgram, logger, propertyOracles);
@@ -424,11 +422,11 @@
// (12) Generate the final output text.
String[] js = new String[jsProgram.getFragmentCount()];
StatementRanges[] ranges = new StatementRanges[js.length];
- SizeBreakdown[] sizeBreakdowns =
- options.isSoycEnabled() || options.isCompilerMetricsEnabled() ?
- new SizeBreakdown[js.length] : null;
- List<Map<Range, SourceInfo>> sourceInfoMaps = options.isSoycExtra() ?
- new ArrayList<Map<Range, SourceInfo>>() : null;
+ SizeBreakdown[] sizeBreakdowns = options.isSoycEnabled()
+ || options.isCompilerMetricsEnabled() ? new
SizeBreakdown[js.length]
+ : null;
+ List<Map<Range, SourceInfo>> sourceInfoMaps = options.isSoycExtra()
+ ? new ArrayList<Map<Range, SourceInfo>>() : null;
generateJavaScriptCode(options, jsProgram, jjsmap, js, ranges,
sizeBreakdowns, sourceInfoMaps, splitBlocks);
@@ -447,12 +445,13 @@
unifiedAst.getPrecompilationMetrics(), compilationMetrics));
}
toReturn.addArtifacts(makeSoycArtifacts(logger, permutationId,
jprogram,
- js, sizeBreakdowns, sourceInfoMaps, dependencies, jjsmap,
obfuscateMap,
- unifiedAst.getModuleMetrics(),
unifiedAst.getPrecompilationMetrics(),
- compilationMetrics));
-
- logger.log(TreeLogger.TRACE, "Permutation took "
- + (System.currentTimeMillis() - permStart) + " ms");
+ js, sizeBreakdowns, sourceInfoMaps, dependencies, jjsmap,
+ obfuscateMap, unifiedAst.getModuleMetrics(),
+ unifiedAst.getPrecompilationMetrics(), compilationMetrics));
+
+ logger.log(TreeLogger.TRACE,
+ "Permutation took " + (System.currentTimeMillis() - permStart)
+ + " ms");
return toReturn;
} catch (Throwable e) {
throw logAndTranslateException(logger, e);
@@ -471,7 +470,7 @@
/**
* Performs a precompilation, returning a unified AST.
- *
+ *
* @param logger the logger to use
* @param module the module to compile
* @param rpo the RebindPermutationOracle
@@ -493,7 +492,7 @@
String[] additionalRootTypes, JJSOptions options,
boolean singlePermutation,
PrecompilationMetricsArtifact precompilationMetrics)
- throws UnableToCompleteException {
+ throws UnableToCompleteException {
InternalCompilerException.preload();
@@ -623,9 +622,9 @@
/*
* 4) Possibly optimize some.
- *
- * Don't optimize early if this is a draft compile, or if there's
only
- * one permutation.
+ *
+ * Don't optimize early if this is a draft compile, or if there's
only one
+ * permutation.
*/
if (options.getOptimizationLevel() >
OptionOptimize.OPTIMIZE_LEVEL_DRAFT
&& !singlePermutation) {
@@ -830,7 +829,8 @@
numNodes));
/*
- * enum ordinalization
+ * Enum ordinalization.
+ *
* TODO(jbrosenberg): graduate this out of
the 'isAggressivelyOptimize'
* block, over time.
*/
@@ -1048,7 +1048,7 @@
/**
* Generate JavaScript code from the given JavaScript ASTs. Also produces
* information about that transformation.
- *
+ *
* @param options The options this compiler instance is running with
* @param jsProgram The AST to convert to source code
* @param jjsMap A map between the JavaScript AST and the Java AST it
came
@@ -1105,6 +1105,27 @@
ranges[i] = ieXformer.getStatementRanges();
}
}
+
+ /**
+ * This method can be used to fetch the list of referenced classs.
+ *
+ * This method is intended to support compiler metrics in the precompile
+ * phase.
+ */
+ private static String[] getReferencedJavaClasses(JProgram jprogram) {
+ class ClassNameVisitor extends JVisitor {
+ List<String> classNames = new ArrayList<String>();
+
+ @Override
+ public boolean visit(JClassType x, Context ctx) {
+ classNames.add(x.getName());
+ return true;
+ }
+ }
+ ClassNameVisitor v = new ClassNameVisitor();
+ v.accept(jprogram);
+ return v.classNames.toArray(new String[v.classNames.size()]);
+ }
private static UnableToCompleteException logAndTranslateException(
TreeLogger logger, Throwable e) {
@@ -1233,10 +1254,12 @@
e);
}
dashboard.generateForOnePermutation();
- if (moduleMetricsArtifact != null &&
precompilationMetricsArtifact != null
+ if (moduleMetricsArtifact != null
+ && precompilationMetricsArtifact != null
&& compilationMetrics != null) {
-
dashboard.generateCompilerMetricsForOnePermuation(moduleMetricsArtifact,
- precompilationMetricsArtifact, compilationMetrics);
+ dashboard.generateCompilerMetricsForOnePermuation(
+ moduleMetricsArtifact, precompilationMetricsArtifact,
+ compilationMetrics);
}
soycArtifacts.addAll(outDir.getArtifacts());
generateCompileReport.end();
@@ -1249,7 +1272,7 @@
/**
* Create a variable assignment to invoke a call to the statistics
collector.
- *
+ *
* <pre>
* Stats.isStatsAvailable() &&
* Stats.onModuleStart("mainClassName");
@@ -1319,25 +1342,4 @@
deps.endDependencyGraph();
deps.close();
}
-
- /**
- * This method can be used to fetch the list of referenced classs.
- *
- * This method is intended to support compiler metrics in the precompile
- * phase.
- */
- private static String[] getReferencedJavaClasses(JProgram jprogram) {
- class ClassNameVisitor extends JVisitor {
- List<String> classNames = new ArrayList<String>();
-
- @Override
- public boolean visit(JClassType x, Context ctx) {
- classNames.add(x.getName());
- return true;
- }
- }
- ClassNameVisitor v = new ClassNameVisitor();
- v.accept(jprogram);
- return v.classNames.toArray(new String[v.classNames.size()]);
- }
-}
+}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
Wed Jan 26 16:52:13 2011
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
Thu Jan 27 12:46:16 2011
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not
* use this file except in compliance with the License. You may obtain a
copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -219,14 +219,14 @@
* JProgram. By the end of this pass, the produced AST should contain
every
* piece of information we'll ever need about the code. The JDT nodes
should
* never again be referenced after this.
- *
+ *
* This is implemented as a reflective visitor for JDT's AST. The
advantage of
* doing it reflectively is that if we run into any JDT nodes we can't
handle,
* we'll automatically throw an exception. If we had subclassed
* {@link org.eclipse.jdt.internal.compiler.ast.ASTNode} we'd have to
override
* every single method and explicitly throw an exception to get the same
* behavior.
- *
+ *
* NOTE ON JDT FORCED OPTIMIZATIONS - If JDT statically determines that a
* section of code in unreachable, it won't fully resolve that section of
* code. This invalid-state code causes us major problems. As a result,
we
@@ -244,7 +244,7 @@
private Class<? extends Object> childClass;
private String name;
- public MethodKey(String name, Class<? extends Object>childClass) {
+ public MethodKey(String name, Class<? extends Object> childClass) {
this.name = name;
this.childClass = childClass;
}
@@ -253,9 +253,10 @@
public boolean equals(Object obj) {
if (obj instanceof MethodKey) {
MethodKey otherKey = (MethodKey) obj;
- return name.equals(otherKey.name) &&
childClass.equals(otherKey.childClass);
- }
- return super.equals(obj);
+ return name.equals(otherKey.name)
+ && childClass.equals(otherKey.childClass);
+ }
+ return super.equals(obj);
}
@Override
@@ -270,6 +271,7 @@
private static class MethodValue {
private final NoSuchMethodException ex;
private final Method method;
+
public MethodValue(Method method) {
this.method = method;
this.ex = null;
@@ -289,8 +291,8 @@
}
/**
- * The literal for the JLS identifier that represents the length
- * field on an array.
+ * The literal for the JLS identifier that represents the length field
on an
+ * array.
*/
private static final String ARRAY_LENGTH_FIELD = "length";
@@ -363,7 +365,7 @@
* inherits that implements an interface method but that has a
different
* erased signature from the interface method.
* </p>
- *
+ *
* <p>
* The need for these bridges was pointed out in issue 3064. The goal
is
* that virtual method calls through an interface type are translated
to
@@ -378,7 +380,7 @@
* case, a bridge method should be added that overrides the interface
method
* and then calls the implementation method.
* </p>
- *
+ *
* <p>
* This method should only be called once all regular, non-bridge
methods
* have been installed on the GWT types.
@@ -531,7 +533,8 @@
currentClass.getMethods().remove(2);
} else {
tryFindUpRefs(method);
- if (isScript(program) && currentClass ==
program.getIndexedType("Array")) {
+ if (isScript(program)
+ && currentClass == program.getIndexedType("Array")) {
// Special implementation: return this.arrayClass
SourceInfo info = method.getSourceInfo();
implementMethod(
@@ -701,8 +704,8 @@
// May be processing an annotation
SourceInfo info = currentMethod == null ?
currentClass.getSourceInfo()
: currentMethod.getSourceInfo();
- return program.getLiteralString(info.makeChild(
- JavaASTGenerationVisitor.class, "String literal"),
+ return program.getLiteralString(
+ info.makeChild(JavaASTGenerationVisitor.class, "String literal"),
x.stringValue().toCharArray());
}
@@ -715,7 +718,7 @@
* Java that glue code is a semantic error, because a this/super call
must
* be the first statement of your constructor. On the upside,
optimizations
* work the same on our synthetic fields as with any user fields.
- *
+ *
* The order of emulation is: - assign all synthetic fields from
synthetic
* args - call our super constructor emulation method - call our
instance
* initializer emulation method - run user code
@@ -760,8 +763,8 @@
if (arg.matchingField != null) {
JField field = (JField) typeMap.get(arg);
block.addStmt(JProgram.createAssignmentStmt(info,
- createVariableRef(info, field),
createVariableRef(info,
- param)));
+ createVariableRef(info, field),
+ createVariableRef(info, param)));
currentOuterThisRefParams = Maps.put(
currentOuterThisRefParams, field, param);
}
@@ -774,8 +777,8 @@
JParameter param = paramIt.next();
JField field = (JField) typeMap.get(arg);
block.addStmt(JProgram.createAssignmentStmt(info,
- createVariableRef(info, field), createVariableRef(info,
- param)));
+ createVariableRef(info, field),
+ createVariableRef(info, param)));
}
}
}
@@ -1718,9 +1721,11 @@
List<JStatement> initializers = new ArrayList<JStatement>(1);
// Iterator<T> i$iterator = collection.iterator()
- initializers.add(createDeclaration(info, iteratorVar, new
JMethodCall(
- info, dispProcessExpression(x.collection),
- program.getIndexedMethod("Iterable.iterator"))));
+ initializers.add(createDeclaration(
+ info,
+ iteratorVar,
+ new JMethodCall(info, dispProcessExpression(x.collection),
+ program.getIndexedMethod("Iterable.iterator"))));
// i$iterator.hasNext()
JExpression condition = new JMethodCall(info,
createVariableRef(info,
@@ -1941,7 +1946,7 @@
* Got to be one of my params; it would be illegal to use a
this
* ref at this moment-- we would most likely be passing in a
* supertype field that HASN'T BEEN INITIALIZED YET.
- *
+ *
* Unfortunately, my params might not work as-is, so we have
to
* check each one to see if any will make a suitable this
ref.
*/
@@ -2105,7 +2110,7 @@
/**
* Create a bridge method. It calls a same-named method with the same
* arguments, but with a different type signature.
- *
+ *
* @param clazz The class to put the bridge method in
* @param jdtBridgeMethod The corresponding bridge method added in the
JDT
* @param implmeth The implementation method to bridge to
@@ -2215,13 +2220,13 @@
* refs up an arbitrarily big tree of enclosing classes and
* supertypes-with-enclosing-classes until we find something that's the
* right type.
- *
+ *
* We have this implemented as a Breadth-First Search to minimize the
number
* of derefs required, and this seems to be correct. Note that we
explicitly
* prefer the current expression as one of its supertypes over a
synthetic
* this ref rooted off the current expression that happens to be the
correct
* type. We have observed this to be consistent with how Java handles
it.
- *
+ *
* TODO(scottb): could we get this info directly from JDT?
*/
private JExpression createThisRef(JReferenceType qualType,
@@ -2321,7 +2326,8 @@
return typeBinding;
}
- private Method getCachedMethod(String name, Class<? extends Object>
childClass) throws NoSuchMethodException {
+ private Method getCachedMethod(String name,
+ Class<? extends Object> childClass) throws NoSuchMethodException {
MethodKey key = new MethodKey(name, childClass);
MethodValue value = methodCache.get(key);
if (value == null) {
@@ -2459,7 +2465,7 @@
/**
* Check whether the specified type is definitely for an enum class.
- *
+ *
* @param type The type being tested
* @return whether it is certainly an enum
*/
@@ -2506,7 +2512,7 @@
* obvious way to tell, but the clue we can get from JDT is that the
local's
* containing method won't be the same as the method we're currently
* processing.
- *
+ *
* Once we have this clue, we can use getEmulationPath to compute the
* current class's binding for that field.
*/
@@ -2581,8 +2587,8 @@
Object[] array = (Object[]) value;
List<JAnnotationArgument> toReturn = Lists.create();
for (int i = 0, j = array.length; i < j; i++) {
- toReturn = Lists.add(toReturn,
processAnnotationPropertyValue(info,
- array[i]).get(0));
+ toReturn = Lists.add(toReturn,
+ processAnnotationPropertyValue(info, array[i]).get(0));
}
return toReturn;
@@ -2678,7 +2684,7 @@
* innermost type (in other words, a needless qualifier), it must
refer to
* that innermost type, because a class can never be nested inside of
* itself. In this case, we must treat it as if it were not
qualified.
- *
+ *
* In all other cases, the qualified thisref or superref cannot
possibly
* refer to the innermost type (even if the innermost type could be
cast
* to a compatible type), so we must create a reference to some outer
@@ -2850,7 +2856,7 @@
/*
* Make an inner class to hold a lazy-init name-value map. We use a
* class to take advantage of its clinit.
- *
+ *
* class Map { $MAP = Enum.createValueOfMap($VALUES); }
*/
SourceInfo sourceInfo = type.getSourceInfo().makeChild(
@@ -2997,7 +3003,9 @@
*/
if (field.isCompileTimeConstant()) {
if (ctx.isLvalue()) {
- JsniCollector.reportJsniError(info, methodDecl,
+ JsniCollector.reportJsniError(
+ info,
+ methodDecl,
"Cannot change the value of compile-time constant "
+ field.getName());
}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
Tue Dec 14 13:56:04 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
Thu Jan 27 12:46:16 2011
@@ -390,9 +390,10 @@
JClassType intf =
typeOracle.findType(Name.InternalName.toSourceName(intfName));
JClassType jso = typeOracle.getSingleJsoImpl(intf);
for (JMethod method : intf.getMethods()) {
- JClassType implementingJso = findImplementingTypeForMethod(jso,
method);
- assert implementingJso != null
- : "Jso should contain method: " + method.getJsniSignature();
+ JClassType implementingJso = findImplementingTypeForMethod(jso,
+ method);
+ assert implementingJso != null : "Jso should contain method: "
+ + method.getJsniSignature();
add(implementingJso, method);
}
}
@@ -482,8 +483,8 @@
private final SortedSet<String> mangledNames = new TreeSet<String>();
private final Map<String, List<com.google.gwt.dev.asm.commons.Method>>
mangledNamesToDeclarations = new HashMap<String,
List<com.google.gwt.dev.asm.commons.Method>>();
private final Map<String, List<com.google.gwt.dev.asm.commons.Method>>
mangledNamesToImplementations = new HashMap<String,
List<com.google.gwt.dev.asm.commons.Method>>();
- private final SortedSet<String> unmodifiableNames =
Collections.unmodifiableSortedSet(mangledNames);
private final Set<String> unmodifiableIntfNames =
Collections.unmodifiableSet(singleJsoImplTypes);
+ private final SortedSet<String> unmodifiableNames =
Collections.unmodifiableSortedSet(mangledNames);
public MySingleJsoImplData() {
// Loop over all interfaces with JSO implementations
@@ -688,7 +689,7 @@
* The set of classes exposed into user space that actually live in
hosted
* space (thus, they bridge across the spaces).
*/
- private static final Class<?>[] BRIDGE_CLASSES = new Class<?>[] {
+ private static final Class<?>[] BRIDGE_CLASSES = new Class<?>[]{
ShellJavaScriptHost.class, GWTBridge.class};
private static final boolean CLASS_DUMP =
Boolean.getBoolean("gwt.dev.classDump");
@@ -795,8 +796,9 @@
throw new UnableToCompleteException();
}
}
-
- private static JClassType findImplementingTypeForMethod(JClassType type,
JMethod method) {
+
+ private static JClassType findImplementingTypeForMethod(JClassType type,
+ JMethod method) {
JType[] methodParamTypes = method.getErasedParameterTypes();
while (type != null) {
for (JMethod candidate : type.getMethods()) {
@@ -823,24 +825,25 @@
}
}
- private static boolean hasMatchingErasedSignature(JMethod a, JType[]
aParamTypes, JMethod b) {
+ private static boolean hasMatchingErasedSignature(JMethod a,
+ JType[] aParamTypes, JMethod b) {
if (!a.getName().equals(b.getName())) {
return false;
}
-
+
JType[] bParamTypes = b.getErasedParameterTypes();
if (aParamTypes.length != bParamTypes.length) {
return false;
}
-
+
for (int i = 0; i < aParamTypes.length; ++i) {
if (aParamTypes[i] != bParamTypes[i]) {
return false;
}
}
-
+
return true;
- }
+ }
/**
* The set of units whose JSNI has already been injected.
@@ -1289,11 +1292,11 @@
} else {
bridge = new GWTBridgeImpl(shellJavaScriptHost);
}
- final Class<?>[] paramTypes = new Class[] {GWTBridge.class};
+ final Class<?>[] paramTypes = new Class[]{GWTBridge.class};
Method setBridgeMethod = gwtClass.getDeclaredMethod("setBridge",
paramTypes);
setBridgeMethod.setAccessible(true);
- setBridgeMethod.invoke(gwtClass, new Object[] {bridge});
+ setBridgeMethod.invoke(gwtClass, new Object[]{bridge});
return;
} catch (SecurityException e) {
caught = e;
@@ -1321,11 +1324,11 @@
}
Throwable caught;
try {
- final Class<?>[] paramTypes = new Class[]
{ShellJavaScriptHost.class};
+ final Class<?>[] paramTypes = new Class[]{ShellJavaScriptHost.class};
Method setHostMethod = javaScriptHostClass.getMethod("setHost",
paramTypes);
setHostMethod.invoke(javaScriptHostClass,
- new Object[] {shellJavaScriptHost});
+ new Object[]{shellJavaScriptHost});
return;
} catch (SecurityException e) {
caught = e;
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors