Java Code Examples for org.apache.bcel.Constants#ACC_STATIC

The following examples show how to use org.apache.bcel.Constants#ACC_STATIC . These examples are extracted from open source projects. 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 Project: luaj   File: JavaBuilder.java    License: MIT License 6 votes vote down vote up
private String createLuaStringField(LuaString value) {
	String name = PREFIX_CONSTANT+constants.size();
	FieldGen fg = new FieldGen(Constants.ACC_STATIC | Constants.ACC_FINAL, 
			TYPE_LUAVALUE, name, cp);
	cg.addField(fg.getField());
	LuaString ls = value.checkstring();
	if ( ls.isValidUtf8() ) {
		init.append(new PUSH(cp, value.tojstring()));
		init.append(factory.createInvoke(STR_LUASTRING, "valueOf",
				TYPE_LUASTRING, ARG_TYPES_STRING, Constants.INVOKESTATIC));
	} else {
		char[] c = new char[ls.m_length];
		for ( int j=0; j<ls.m_length; j++ ) 
			c[j] = (char) (0xff & (int) (ls.m_bytes[ls.m_offset+j]));
		init.append(new PUSH(cp, new String(c)));
		init.append(factory.createInvoke(STR_STRING, "toCharArray",
				TYPE_CHARARRAY, Type.NO_ARGS,
				Constants.INVOKEVIRTUAL));
		init.append(factory.createInvoke(STR_LUASTRING, "valueOf",
				TYPE_LUASTRING, ARG_TYPES_CHARARRAY,
				Constants.INVOKESTATIC));
	}
	init.append(factory.createPutStatic(classname, name, TYPE_LUAVALUE));			
	return name;
}
 
Example 2
Source Project: luaj   File: JavaBuilder.java    License: MIT License 5 votes vote down vote up
private String createLuaIntegerField(int value) {
	String name = PREFIX_CONSTANT+constants.size();
	FieldGen fg = new FieldGen(Constants.ACC_STATIC | Constants.ACC_FINAL, 
			TYPE_LUAVALUE, name, cp);
	cg.addField(fg.getField());
	init.append(new PUSH(cp, value));
	init.append(factory.createInvoke(STR_LUAVALUE, "valueOf",
			TYPE_LUAINTEGER, ARG_TYPES_INT, Constants.INVOKESTATIC));
	init.append(factory.createPutStatic(classname, name, TYPE_LUAVALUE));
	return name;
}
 
Example 3
Source Project: luaj   File: JavaBuilder.java    License: MIT License 5 votes vote down vote up
private String createLuaDoubleField(double value) {
	String name = PREFIX_CONSTANT+constants.size();
	FieldGen fg = new FieldGen(Constants.ACC_STATIC | Constants.ACC_FINAL, 
			TYPE_LUAVALUE, name, cp);
	cg.addField(fg.getField());
	init.append(new PUSH(cp, value));
	init.append(factory.createInvoke(STR_LUAVALUE, "valueOf",
			TYPE_LUANUMBER, ARG_TYPES_DOUBLE, Constants.INVOKESTATIC));
	init.append(factory.createPutStatic(classname, name, TYPE_LUAVALUE));			
	return name;
}
 
Example 4
Source Project: ApkToolPlus   File: AccessFlags.java    License: Apache License 2.0 4 votes vote down vote up
public final boolean isStatic() {
  return (access_flags & Constants.ACC_STATIC) != 0;
}