001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.internal.compiler.classfmt;
011:
012: import org.eclipse.jdt.internal.compiler.ast.ASTNode;
013:
014: public interface ClassFileConstants {
015:
016: int AccDefault = 0;
017: /*
018: * Modifiers
019: */
020: int AccPublic = 0x0001;
021: int AccPrivate = 0x0002;
022: int AccProtected = 0x0004;
023: int AccStatic = 0x0008;
024: int AccFinal = 0x0010;
025: int AccSynchronized = 0x0020;
026: int AccVolatile = 0x0040;
027: int AccBridge = 0x0040;
028: int AccTransient = 0x0080;
029: int AccVarargs = 0x0080;
030: int AccNative = 0x0100;
031: int AccInterface = 0x0200;
032: int AccAbstract = 0x0400;
033: int AccStrictfp = 0x0800;
034: int AccSynthetic = 0x1000;
035: int AccAnnotation = 0x2000;
036: int AccEnum = 0x4000;
037:
038: /**
039: * Other VM flags.
040: */
041: int AccSuper = 0x0020;
042:
043: /**
044: * Extra flags for types and members attributes.
045: */
046: int AccAnnotationDefault = ASTNode.Bit18; // indicate presence of an attribute "DefaultValue" (annotation method)
047: int AccDeprecated = ASTNode.Bit21; // indicate presence of an attribute "Deprecated"
048:
049: int Utf8Tag = 1;
050: int IntegerTag = 3;
051: int FloatTag = 4;
052: int LongTag = 5;
053: int DoubleTag = 6;
054: int ClassTag = 7;
055: int StringTag = 8;
056: int FieldRefTag = 9;
057: int MethodRefTag = 10;
058: int InterfaceMethodRefTag = 11;
059: int NameAndTypeTag = 12;
060:
061: int ConstantMethodRefFixedSize = 5;
062: int ConstantClassFixedSize = 3;
063: int ConstantDoubleFixedSize = 9;
064: int ConstantFieldRefFixedSize = 5;
065: int ConstantFloatFixedSize = 5;
066: int ConstantIntegerFixedSize = 5;
067: int ConstantInterfaceMethodRefFixedSize = 5;
068: int ConstantLongFixedSize = 9;
069: int ConstantStringFixedSize = 3;
070: int ConstantUtf8FixedSize = 3;
071: int ConstantNameAndTypeFixedSize = 5;
072:
073: int MAJOR_VERSION_1_1 = 45;
074: int MAJOR_VERSION_1_2 = 46;
075: int MAJOR_VERSION_1_3 = 47;
076: int MAJOR_VERSION_1_4 = 48;
077: int MAJOR_VERSION_1_5 = 49;
078: int MAJOR_VERSION_1_6 = 50;
079: int MAJOR_VERSION_1_7 = 51;
080:
081: int MINOR_VERSION_0 = 0;
082: int MINOR_VERSION_1 = 1;
083: int MINOR_VERSION_2 = 2;
084: int MINOR_VERSION_3 = 3;
085: int MINOR_VERSION_4 = 4;
086:
087: // JDK 1.1 -> 1.7, comparable value allowing to check both major/minor version at once 1.4.1 > 1.4.0
088: // 16 unsigned bits for major, then 16 bits for minor
089: long JDK1_1 = ((long) ClassFileConstants.MAJOR_VERSION_1_1 << 16)
090: + ClassFileConstants.MINOR_VERSION_3; // 1.1. is 45.3
091: long JDK1_2 = ((long) ClassFileConstants.MAJOR_VERSION_1_2 << 16)
092: + ClassFileConstants.MINOR_VERSION_0;
093: long JDK1_3 = ((long) ClassFileConstants.MAJOR_VERSION_1_3 << 16)
094: + ClassFileConstants.MINOR_VERSION_0;
095: long JDK1_4 = ((long) ClassFileConstants.MAJOR_VERSION_1_4 << 16)
096: + ClassFileConstants.MINOR_VERSION_0;
097: long JDK1_5 = ((long) ClassFileConstants.MAJOR_VERSION_1_5 << 16)
098: + ClassFileConstants.MINOR_VERSION_0;
099: long JDK1_6 = ((long) ClassFileConstants.MAJOR_VERSION_1_6 << 16)
100: + ClassFileConstants.MINOR_VERSION_0;
101: long JDK1_7 = ((long) ClassFileConstants.MAJOR_VERSION_1_7 << 16)
102: + ClassFileConstants.MINOR_VERSION_0;
103:
104: /*
105: * cldc1.1 is 45.3, but we modify it to be different from JDK1_1.
106: * In the code gen, we will generate the same target value as JDK1_1
107: */
108: long CLDC_1_1 = ((long) ClassFileConstants.MAJOR_VERSION_1_1 << 16)
109: + ClassFileConstants.MINOR_VERSION_4;
110:
111: // jdk level used to denote future releases: optional behavior is not enabled for now, but may become so. In order to enable these,
112: // search for references to this constant, and change it to one of the official JDT constants above.
113: long JDK_DEFERRED = Long.MAX_VALUE;
114:
115: int INT_ARRAY = 10;
116: int BYTE_ARRAY = 8;
117: int BOOLEAN_ARRAY = 4;
118: int SHORT_ARRAY = 9;
119: int CHAR_ARRAY = 5;
120: int LONG_ARRAY = 11;
121: int FLOAT_ARRAY = 6;
122: int DOUBLE_ARRAY = 7;
123:
124: // Debug attributes
125: int ATTR_SOURCE = 0x1; // SourceFileAttribute
126: int ATTR_LINES = 0x2; // LineNumberAttribute
127: int ATTR_VARS = 0x4; // LocalVariableTableAttribute
128: int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
129: int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
130: }
|