List of usage examples for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding sourceName
@Override public char[] sourceName()
From source file:com.codenvy.ide.ext.java.server.TypeBindingConvector.java
License:Open Source License
public static String toJsonBinaryType(SourceTypeBinding binding) { JsonObject object = new JsonObject(); if (!binding.isAnnotationType()) { object.add("annotations", toJsonAnnotations(binding.getAnnotations())); } else {//from w w w .j a v a2 s .co m object.add("annotations", JsonNull.INSTANCE); } object.add("enclosingMethod", null); object.add("enclosingTypeName", binding.enclosingType() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(binding.enclosingType().constantPoolName()))); object.add("fields", toJsonFields(binding.fields())); object.add("genericSignature", binding.genericSignature() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(binding.genericSignature()))); object.add("interfaceNames", toJsonInterfaces(binding.superInterfaces())); object.add("memberTypes", toJsonMemberTypes(binding.memberTypes())); object.add("methods", toJsonMethods(binding.methods())); object.add("missingTypeNames", null); object.add("name", binding.constantPoolName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(binding.constantPoolName()))); object.add("sourceName", binding.sourceName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(binding.sourceName()))); object.add("superclassName", binding.superclass() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(binding.superclass().constantPoolName()))); long annotationTagBits = binding.getAnnotationTagBits(); //remove AreMethodsComplete bit tag from type annotationTagBits &= ~TagBits.AreMethodsComplete; object.add("tagBits", new JsonPrimitive(String.valueOf(annotationTagBits))); object.add("anonymous", new JsonPrimitive(binding.isAnonymousType())); object.add("local", new JsonPrimitive(binding.isLocalType())); object.add("member", new JsonPrimitive(binding.isMemberType())); object.add("sourceFileName", binding.sourceName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(binding.sourceName()))); object.add("modifiers", new JsonPrimitive(binding.modifiers)); object.add("binaryType", new JsonPrimitive(true)); object.add("fileName", null); return gson.toJson(object); }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.SyntheticRoleBridgeMethodBinding.java
License:Open Source License
public SyntheticRoleBridgeMethodBinding(SourceTypeBinding declaringRole, ReferenceBinding originalRole, MethodBinding targetMethod, int bridgeKind) { super(declaringRole, AccPublic | AccSynthetic, targetMethod.selector, originalParameters(targetMethod), originalReturnType(targetMethod)); this.purpose = bridgeKind; switch (bridgeKind) { case RoleMethodBridgeOuter: // correction: this method sits in the team not the role: this.declaringClass = declaringRole.enclosingType(); // perform two adjustments of the first parameter passing the role instance: // - weakening (using originalRole) // - use ifc-part: inner field accessor uses role class, don't expose it at this level int len = this.parameters.length; if (len > 0) { // accessor to static field has no argument System.arraycopy(this.parameters, 0, this.parameters = new TypeBinding[len], 0, len); this.parameters[0] = originalRole.getRealType(); // may also be weakened }//from w w w . j ava 2 s.c om break; case RoleMethodBridgeInner: // correction: add role as first parameter: len = this.parameters.length; int offset = targetMethod.isStatic() ? 2 : 0; TypeBinding[] newParameters = new TypeBinding[len + 1 + offset]; newParameters[0] = originalRole.getRealType(); if (offset > 0) { newParameters[1] = TypeBinding.INT; // dummy int newParameters[2] = originalRole.enclosingType(); // team arg } System.arraycopy(this.parameters, 0, newParameters, 1 + offset, len); this.parameters = newParameters; // correction: this bridge is static: this.modifiers |= AccStatic; // correction: generate the bridge method name: this.selector = SyntheticRoleBridgeMethodBinding.getPrivateBridgeSelector(targetMethod.selector, declaringRole.sourceName()); break; } this.targetMethod = targetMethod; this.thrownExceptions = targetMethod.thrownExceptions; this.typeVariables = targetMethod.typeVariables; SyntheticMethodBinding[] knownAccessMethods = ((SourceTypeBinding) this.declaringClass).syntheticMethods(); int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length; this.index = methodId; }