List of usage examples for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding isEnum
@Override public boolean isEnum()
From source file:com.google.gwt.dev.jjs.impl.GwtAstBuilder.java
License:Apache License
private void createTypes(TypeDeclaration x) { SourceInfo info = makeSourceInfo(x); try {//from w w w . ja va 2 s . c o m SourceTypeBinding binding = x.binding; String name; if (binding instanceof LocalTypeBinding) { char[] localName = binding.constantPoolName(); name = new String(localName).replace('/', '.'); } else { name = JdtUtil.asDottedString(binding.compoundName); } name = intern(name); JDeclaredType type; String jsPrototype = JsInteropUtil.maybeGetJsTypePrototype(x); JsInteropType interopType = JsInteropUtil.maybeGetJsInteropType(x, jsPrototype); if (binding.isClass()) { type = new JClassType(info, name, binding.isAbstract(), binding.isFinal(), interopType); JsInteropUtil.maybeSetJsPrototypeFlag(x, (JClassType) type); } else if (binding.isInterface() || binding.isAnnotationType()) { type = new JInterfaceType(info, name, interopType, jsPrototype); } else if (binding.isEnum()) { if (binding.isAnonymousType()) { // Don't model an enum subclass as a JEnumType. type = new JClassType(info, name, false, true, interopType); } else { type = new JEnumType(info, name, binding.isAbstract(), interopType); } } else { throw new InternalCompilerException("ReferenceBinding is not a class, interface, or enum."); } typeMap.setSourceType(binding, type); newTypes.add(type); if (x.memberTypes != null) { for (TypeDeclaration memberType : x.memberTypes) { createTypes(memberType); } } } catch (Throwable e) { InternalCompilerException ice = translateException(null, e); StringBuffer sb = new StringBuffer(); x.printHeader(0, sb); ice.addNode(x.getClass().getName(), sb.toString(), info); throw ice; } }