use of org.eclipse.ceylon.compiler.java.metadata.Ignore in project ceylon by eclipse.
the class ValueConstructorImpl method getJavaMethod.
// /////////////////////////////////////////
/**
* Gets the getter {@code java.lang.reflect.Method} for the
* given value constructor.
*/
@Ignore
public static Method getJavaMethod(ValueConstructorDeclarationImpl declaration) {
org.eclipse.ceylon.model.typechecker.model.Value decl = (org.eclipse.ceylon.model.typechecker.model.Value) declaration.declaration;
String getterName = "";
try {
if (decl instanceof JavaBeanValue) {
java.lang.Class<?> javaClass = Metamodel.getJavaClass((org.eclipse.ceylon.model.typechecker.model.ClassOrInterface) decl.getContainer());
getterName = ((JavaBeanValue) decl).getGetterName();
java.lang.Class<?>[] params = NO_PARAMS;
boolean isJavaArray = MethodHandleUtil.isJavaArray(javaClass);
if (isJavaArray)
params = MethodHandleUtil.getJavaArrayGetArrayParameterTypes(javaClass, getterName);
// if it is shared we may want to get an inherited getter, but if it's private we need the declared method to return it
Method m = decl.isShared() ? javaClass.getMethod(getterName, params) : javaClass.getDeclaredMethod(getterName, params);
return m;
} else if (decl instanceof LazyValue) {
LazyValue lazyDecl = (LazyValue) decl;
java.lang.Class<?> javaClass = ((ReflectionClass) lazyDecl.classMirror).klass;
// FIXME: we should really save the getter name in the LazyDecl
getterName = NamingBase.getGetterName(lazyDecl);
// toplevels don't have inheritance
Method m = javaClass.getDeclaredMethod(getterName);
return m;
} else if (ModelUtil.isEnumeratedConstructor(decl)) {
java.lang.Class<?> javaClass = Metamodel.getJavaClass((org.eclipse.ceylon.model.typechecker.model.ClassOrInterface) decl.getContainer());
Class constructedClass = ModelUtil.getConstructedClass(decl);
if (constructedClass.isMember()) {
// the getter for member classes is on the enclosing class.
javaClass = javaClass.getEnclosingClass();
} else if (ModelUtil.isLocalNotInitializer(constructedClass))
// local class has no way to get the value
return null;
getterName = NamingBase.getGetterName(decl);
java.lang.Class<?>[] params = NO_PARAMS;
// if it is shared we may want to get an inherited getter, but if it's private we need the declared method to return it
Method m = javaClass.getDeclaredMethod(getterName, params);
return m;
} else {
throw new StorageException("Attribute " + decl.getName() + " is neither captured nor shared so it has no physical storage allocated and cannot be read by the metamodel");
}
} catch (NoSuchMethodException | SecurityException e) {
throw Metamodel.newModelError("Failed to find getter method " + getterName + " for: " + decl, e);
}
}
use of org.eclipse.ceylon.compiler.java.metadata.Ignore in project ceylon by eclipse.
the class Array method instance.
@Ignore
public static <T> Array<T> instance(T[] array) {
if (array == null) {
return null;
}
java.lang.Class<?> componentType = array.getClass().getComponentType();
TypeDescriptor optionalType = TypeDescriptor.union(Null.$TypeDescriptor$, TypeDescriptor.klass(componentType));
return new Array<T>(optionalType, array);
}
use of org.eclipse.ceylon.compiler.java.metadata.Ignore in project ceylon by eclipse.
the class Tuple method $completeInit$.
@Ignore
public void $completeInit$(java.lang.Object first, java.lang.Object rest) {
Lookup lookup = MethodHandles.lookup();
try {
java.lang.Object[] array = makeArray(first, (Sequential) rest);
Util.setter(lookup, "array").invokeExact(this, array);
Rest rest2 = (Rest) makeRest((Sequential) rest);
Util.setter(lookup, "rest").invokeExact(this, rest2);
} catch (java.lang.Throwable t) {
rethrow_.rethrow(t);
}
}
use of org.eclipse.ceylon.compiler.java.metadata.Ignore in project ceylon by eclipse.
the class Tuple method $getType$.
@Override
@Ignore
public TypeDescriptor $getType$() {
SoftReference<TypeDescriptor> cachedType = $cachedType;
TypeDescriptor type = cachedType != null ? cachedType.get() : null;
if (type == null) {
synchronized (this) {
cachedType = $cachedType;
type = cachedType != null ? cachedType.get() : null;
if (type == null) {
type = computeType();
$cachedType = new SoftReference<TypeDescriptor>(type);
}
}
}
return type;
}
Aggregations