Package com.googlecode.gwt.test.exceptions

Examples of com.googlecode.gwt.test.exceptions.GwtTestPatchException


                     addPatchClass(classToPatchName, ctClass);
                  }
               }
            } catch (ClassNotFoundException e) {
               // should never happen
               throw new GwtTestPatchException(e);
            }
         }

         private void addPatchClass(String targetName, CtClass patchClass) {
            Set<CtClass> patchClasses = patchClassMap.get(targetName);
View Full Code Here


         if (classToPatch.subtypeOf(jsoClass) && classToPatch != jsoClass) {
            patcher = new OverlayPatcher(patcher);
         }
      } catch (NotFoundException e) {
         // should never happen
         throw new GwtTestPatchException(e);
      }

      return patcher;

   }
View Full Code Here

      for (CtClass patchClass : patchClasses) {
         for (CtMethod ctMethod : patchClass.getDeclaredMethods()) {
            if (ctMethod.hasAnnotation(InitMethod.class)) {
               if (!Modifier.isStatic(ctMethod.getModifiers())) {
                  throw new GwtTestPatchException("@" + InitMethod.class.getSimpleName()
                           + " has to be static : '" + ctMethod.getLongName() + "'");
               }
               try {
                  if (ctMethod.getParameterTypes().length != 1
                           || ctMethod.getParameterTypes()[0] != GwtClassPool.getCtClass(CtClass.class)) {
                     throw new GwtTestPatchException("@" + InitMethod.class.getName()
                              + " method must have one and only one parameter of type '"
                              + CtClass.class.getName() + "'");
                  }
               } catch (NotFoundException e) {
                  // should never happen
                  throw new GwtTestPatchException(e);
               }
               initMethods.add(ctMethod);
            }
         }
      }
View Full Code Here

   private <T extends Annotation> T getMethodAnnotation(CtMethod ctMethod, Class<T> annotation) {
      try {
         return (T) ctMethod.getAnnotation(annotation);
      } catch (ClassNotFoundException e) {
         // should never happen
         throw new GwtTestPatchException(e);
      }
   }
View Full Code Here

      for (CtMethod method : methods) {
         T annotation = getMethodAnnotation(method, annotationClass);
         if (isOverride(annotation)) {
            if (overrideInitMethod != null) {
               throw new GwtTestPatchException("There are more than one @"
                        + annotationClass.getSimpleName()
                        + " with 'override=true' for the same target : '" + method.getLongName()
                        + "' and '" + overrideInitMethod.getLongName() + "'");
            } else {
               overrideInitMethod = method;
            }
         }
      }

      if (overrideInitMethod == null) {
         StringBuilder sb = new StringBuilder();
         sb.append(methods.size()).append(" @");
         sb.append(annotationClass.getSimpleName());
         sb.append(" methods detected for the same target, but no one is set to override the other. You must use 'override=true' on the one which should be applied : ");

         for (CtMethod method : methods) {
            sb.append("'").append(method.getLongName()).append("'");
            sb.append(" or ");
         }
         throw new GwtTestPatchException(sb.substring(0, sb.length() - 4));
      }

      return overrideInitMethod;
   }
View Full Code Here

      Map<String, List<CtMethod>> temp = new HashMap<String, List<CtMethod>>();
      for (CtClass patchClass : patchClasses) {
         for (CtMethod ctMethod : patchClass.getDeclaredMethods()) {
            if (ctMethod.hasAnnotation(PatchMethod.class)) {
               if (!Modifier.isStatic(ctMethod.getModifiers())) {
                  throw new GwtTestPatchException("@" + PatchMethod.class.getName()
                           + " has to be static : '" + ctMethod.getLongName() + "'");
               }
               String nameAndSignature = ctMethod.getName()
                        + Descriptor.toString(ctMethod.getSignature());
               List<CtMethod> correspondingMethods = temp.get(nameAndSignature);
View Full Code Here

      try {
         clazz = Class.forName("com.google.gwt.safehtml.shared.SafeHtmlString");
         Constructor<?> cons = clazz.getDeclaredConstructor(String.class);
         return (SafeHtml) GwtReflectionUtils.instantiateClass(cons, s);
      } catch (Exception e) {
         throw new GwtTestPatchException("Error while instanciate a SafeHtmlString instance", e);
      }

   }
View Full Code Here

               } else {
                  throw new IllegalArgumentException("Not managed class container " + u);
               }
            }
         } catch (Exception e) {
            throw new GwtTestPatchException("Error while scanning package '" + rootPackage + "'", e);
         }
      }
   }
View Full Code Here

      try {
         addTranslator(cp, new MakeClassPublicTranslator());
      } catch (Exception e) {
         // should never happen
         throw new GwtTestPatchException(
                  "Error while trying to setup the temporary classloader to load GWT generated .java files",
                  e);
      }
   }
View Full Code Here

         } catch (Exception e) {
            if (e instanceof UnableToCompleteException) {
               GwtTreeLogger.get().onUnableToCompleteError();
            }

            throw new GwtTestPatchException("Error while creating instance of '"
                     + classLiteral.getName() + "' through '"
                     + gwtCreateHandler.getClass().getName() + "' instance", e);
         }
      }
View Full Code Here

TOP

Related Classes of com.googlecode.gwt.test.exceptions.GwtTestPatchException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.