Reviewers: rchandia,

Description:
Include enclosing class in generated class name


Please review this at http://gwt-code-reviews.appspot.com/1499804/

Affected files:
  M user/src/com/google/gwt/validation/rebind/AbstractCreator.java


Index: user/src/com/google/gwt/validation/rebind/AbstractCreator.java
===================================================================
--- user/src/com/google/gwt/validation/rebind/AbstractCreator.java (revision 10462) +++ user/src/com/google/gwt/validation/rebind/AbstractCreator.java (working copy)
@@ -1,12 +1,12 @@
 /*
  * Copyright 2010 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
@@ -59,7 +59,8 @@
     return getQualifiedName();
   }

- protected void addImports(ClassSourceFileComposerFactory composerFactory, Class<?>... imports) {
+  protected void addImports(ClassSourceFileComposerFactory composerFactory,
+      Class<?>... imports) {
     for (Class<?> imp : imports) {
       composerFactory.addImport(imp.getCanonicalName());
     }
@@ -108,11 +109,13 @@
   }

   private String getSimpleName() {
-    return validatorType.getSimpleSourceName() + "Impl";
+    final int length = getPackage().length();
+ final String rawName = validatorType.getQualifiedSourceName().substring(
+        length == 0 ? 0 : length + 1);
+    return rawName.replace('.', '_') + "Impl";
   }

-  private SourceWriter getSourceWriter(TreeLogger logger,
-      GeneratorContext ctx) {
+ private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext ctx) {
     String packageName = getPackage();
     String simpleName = getSimpleName();
PrintWriter printWriter = ctx.tryCreate(logger, packageName, simpleName);


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to