Java Code Examples for jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind#PROPERTY
The following examples show how to use
jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind#PROPERTY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassGenerator.java From nashorn with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 2
Source File: ClassGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 3
Source File: ClassGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 4
Source File: ClassGenerator.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 5
Source File: ClassGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 6
Source File: ClassGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 7
Source File: ClassGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 8
Source File: ClassGenerator.java From nashorn with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 9
Source File: ClassGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 10
Source File: ClassGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 11
Source File: ClassGenerator.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 12
Source File: ClassGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 13
Source File: ClassGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 14
Source File: ClassGenerator.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = GETTER_PREFIX + memInfo.getJavaName(); final String desc = getterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnValue(); mi.computeMaxs(); mi.visitEnd(); }
Example 15
Source File: ClassGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) { final int access = ACC_PUBLIC; final String name = SETTER_PREFIX + memInfo.getJavaName(); final String desc = setterDesc(memInfo); final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); final MethodGenerator mi = new MethodGenerator(mv, access, name, desc); mi.visitCode(); if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) { mi.loadLocal(1); mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } else { mi.loadLocal(0); mi.loadLocal(1); mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc()); } mi.returnVoid(); mi.computeMaxs(); mi.visitEnd(); }
Example 16
Source File: ScriptClassInstrumentor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) { final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess); if (memInfo != null && memInfo.getKind() == Kind.PROPERTY && memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) { // non-instance @Property fields - these have to go elsewhere unless 'static final' return null; } final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value); return new FieldVisitor(Opcodes.ASM4, delegateFV) { @Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore script field annotations return null; } return fv.visitAnnotation(desc, visible); } @Override public void visitAttribute(final Attribute attr) { fv.visitAttribute(attr); } @Override public void visitEnd() { fv.visitEnd(); } }; }
Example 17
Source File: ScriptClassInstrumentor.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) { final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess); if (memInfo != null && memInfo.getKind() == Kind.PROPERTY && memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) { // non-instance @Property fields - these have to go elsewhere unless 'static final' return null; } final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value); return new FieldVisitor(Opcodes.ASM4, delegateFV) { @Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore script field annotations return null; } return fv.visitAnnotation(desc, visible); } @Override public void visitAttribute(final Attribute attr) { fv.visitAttribute(attr); } @Override public void visitEnd() { fv.visitEnd(); } }; }
Example 18
Source File: ScriptClassInstrumentor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) { final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess); if (memInfo != null && memInfo.getKind() == Kind.PROPERTY && memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) { // non-instance @Property fields - these have to go elsewhere unless 'static final' return null; } final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value); return new FieldVisitor(Opcodes.ASM4, delegateFV) { @Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore script field annotations return null; } return fv.visitAnnotation(desc, visible); } @Override public void visitAttribute(final Attribute attr) { fv.visitAttribute(attr); } @Override public void visitEnd() { fv.visitEnd(); } }; }
Example 19
Source File: ScriptClassInstrumentor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) { final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess); if (memInfo != null && memInfo.getKind() == Kind.PROPERTY && memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) { // non-instance @Property fields - these have to go elsewhere unless 'static final' return null; } final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value); return new FieldVisitor(Opcodes.ASM4, delegateFV) { @Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore script field annotations return null; } return fv.visitAnnotation(desc, visible); } @Override public void visitAttribute(final Attribute attr) { fv.visitAttribute(attr); } @Override public void visitEnd() { fv.visitEnd(); } }; }
Example 20
Source File: ScriptClassInstrumentor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) { final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess); if (memInfo != null && memInfo.getKind() == Kind.PROPERTY && memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) { // non-instance @Property fields - these have to go elsewhere unless 'static final' return null; } final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value); return new FieldVisitor(Opcodes.ASM4, delegateFV) { @Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (ScriptClassInfo.annotations.containsKey(desc)) { // ignore script field annotations return null; } return fv.visitAnnotation(desc, visible); } @Override public void visitAttribute(final Attribute attr) { fv.visitAttribute(attr); } @Override public void visitEnd() { fv.visitEnd(); } }; }