Ejemplo n.º 1
0
    public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
      // require an owner type if the raw type needs it
      if (rawType instanceof Class<?>) {
        Class<?> rawTypeAsClass = (Class<?>) rawType;
        try {
          Assert.isTrue(ownerType != null || rawTypeAsClass.getEnclosingClass() == null);
          Assert.isTrue(ownerType == null || rawTypeAsClass.getEnclosingClass() != null);
        } catch (RuntimeException e) {
          // R][2011-09-27 21:08:14,570] [ORM._log] ownerType:null
          // [ERROR][2011-09-27 21:08:14,572] [ORM._log]
          // rawTypeAsClass:interface java.util.Map$Entry
          // [ERROR][2011-09-27 21:08:14,573] [ORM._log]
          // getEnclosingClass:interface java.util.Map

          LogUtil.error("ownerType:" + ownerType);
          LogUtil.error("rawTypeAsClass:" + rawTypeAsClass);
          LogUtil.error("getEnclosingClass:" + rawTypeAsClass.getEnclosingClass());
          throw e;
        }
      }

      this.ownerType = ownerType == null ? null : canonicalize(ownerType);
      this.rawType = canonicalize(rawType);
      this.typeArguments = typeArguments.clone();
      for (int t = 0; t < this.typeArguments.length; t++) {
        Assert.notNull(this.typeArguments[t]);
        checkNotPrimitive(this.typeArguments[t]);
        this.typeArguments[t] = canonicalize(this.typeArguments[t]);
      }
    }
  public static void fixAsEJB(ILaunchConfiguration config) {
    try {
      LaunchConfigurationInfo info =
          (LaunchConfigurationInfo) BeanUtils.invokeMethod(config, "getInfo");
      Map map = (Map) BeanUtils.getFieldValue(info, "fAttributes");

      String projectName = (String) map.get(ATTR_PROJECT_NAME);
      IJavaModel jModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
      IJavaProject jp = jModel.getJavaProject(projectName);
      Assert.notNull(jp);

      File root = jp.getProject().getLocation().toFile();
      map.put("org.eclipse.jdt.launching.MAIN_TYPE", "jef.database.JefClassLoader");

      String arg = (String) map.get(ATTR_PROGRAM_ARGUMENTS);
      if (arg == null) {
        File openEjbFolder = findOpenEjbFolder();
        String projectPath = root.getAbsolutePath();
        String openEjbPath = openEjbFolder.getAbsolutePath();
        map.put(
            ATTR_PROGRAM_ARGUMENTS,
            "jef.ejb.server.OpenejbServer " + projectPath + " " + openEjbPath);
      }

    } catch (ReflectionException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 3
0
    public WildcardTypeImpl(Type[] upperBounds, Type[] lowerBounds) {
      Assert.isTrue(lowerBounds.length <= 1);
      Assert.isTrue(upperBounds.length == 1);

      if (lowerBounds.length == 1) {
        Assert.notNull(lowerBounds[0]);
        checkNotPrimitive(lowerBounds[0]);
        Assert.isTrue(upperBounds[0] == Object.class);
        this.lowerBound = canonicalize(lowerBounds[0]);
        this.upperBound = Object.class;

      } else {
        Assert.notNull(upperBounds[0]);
        checkNotPrimitive(upperBounds[0]);
        this.lowerBound = null;
        this.upperBound = canonicalize(upperBounds[0]);
      }
    }
Ejemplo n.º 4
0
 private static void checkNotPrimitive(Type type) {
   Assert.isTrue(!(type instanceof Class<?>) || !((Class<?>) type).isPrimitive());
 }