in vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureParser.java [1436:1700]
public final void pr__SIMPLE_CLASS_TYPE_SIGNATURE() throws RecognitionException, TokenStreamException {
Token m34 = null;
Token m35 = null;
Token m37 = null;
Token m371 = null;
try { // for error handling
boolean synPredMatched24 = false;
if (((LA(1)==ID))) {
int _m24 = mark();
synPredMatched24 = true;
inputState.guessing++;
try {
{
match(ID);
match(TRIANGLEOPEN_SIGN);
}
}
catch (RecognitionException pe) {
synPredMatched24 = false;
}
rewind(_m24);
inputState.guessing--;
}
if ( synPredMatched24 ) {
m34 = LT(1);
match(ID);
if ( inputState.guessing==0 ) {
prntS(" ===13===");
String ts1 = m34.getText();
int tl = ts1.length();
if (currentStackElem.rawType == null){ // so it's the non-inner class id
prntS(" ===131===");
// create the owner:
currentStackElem.owner = null; // owner is absent for package level class
// grow the gatheredStr:
if(currentStackElem.gatheredStr == null){ // so, we should check the existence of "L" at the begin of ID because it is the begin of the reference
// (for remembering: any "T..." identifier can not be considered as TVAR within
// this being parsered pr__SIMPLE_CLASS_TYPE_SIGNATURE rule, especially, if we are
// within generic parameters declaration parsering, where a TVAR using is prohibited)
if(ts1.charAt(0) != 'L'){
throwGenericSignatureFormatError();
}
addToGatheredStr(currentStackElem, ts1); // so, it's "L"<class ID> here
} else { //so, it is the reference like <package name>/<non-inner class name> (because rawType == null && gatheredStr == null)
addToGatheredStr(currentStackElem, ts1); // so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID> here
}
// grow the signature (like the gatheredStr growing):
if(currentStackElem.sigBegin == -1){
currentStackElem.sigBegin = addToSignature(ts1); // so, it's "L"<class ID> added to CTPTsignature
currentStackElem.sigEnd = currentStackElem.sigBegin + tl;
} else {
currentStackElem.sigEnd = addToSignature(ts1) + tl; // so, it's <class ID> added to CTPTsignature,
// consequently the "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID> is there regarding the current parsered reference
}
// create the raw type:
currentStackElem.rawType = createInterimClassType(currentStackElem.gatheredStr);
// we know "<...>" follows further, so the type becames InterimParameterizedType now:
currentStackElem.typeKind = 1;
} else { // so it's the regular inner class id
prntS(" ===132===");
// create the owner:
if(currentStackElem.typeKind == 0 && currentStackElem.args == null){
prntS(" ===1321===");
//if (currentStackElem.owner != null) {
// // so, we have created InterimClassType some times for the previous parts (IDs)
// // and we should provide that each InterimClassType object should be deleted by GC when the next one is being created
// // because the only last preceding may to be used as owner of the first InterimParameterizedType object which arises
// // while a reference is parsered.
// // So, can/should we do anything special (I don't see such features within JNI) to destroy the previouse InterimClassType
// // object which becames superflouos
// // just when the next one appeares? Or GC will remove such objects because there will not be any references for them
// // within the java code.
// ???<<< (*env)->ReleaseObject(..., currentStackElem.owner, ...); >>>???
//}
currentStackElem.owner = createInterimClassType(/*currentStackElem.rawType*/currentStackElem.gatheredStr);
} else {
//printf(" %s %d %d %d\n", "===1322===", currentStackElem.typeKind, currentStackElem.args);
currentStackElem.typeKind = 1; // at least one args was not equal to null at a previous stage, so we deal with the parameterized type from that time
len = sigInd - currentStackElem.sigBegin/* + 1*/;
currentStackElem.owner = createInterimParameterizedType(CTPTsignature.substring(currentStackElem.sigBegin, currentStackElem.sigBegin+len), currentStackElem);
currentStackElem.args = null;
}
// grow the gatheredStr:
addToGatheredStr(currentStackElem, "$"); // so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$" here
addToGatheredStr(currentStackElem, ts1); // so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$"<class ID> here
// grow the signature (like the gatheredStr growing):
currentStackElem.sigEnd = addToSignature("$") + 1; // so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$" gathered in CTPTsignature
currentStackElem.sigEnd = addToSignature(ts1) + tl; //so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$"<class ID> gathered in CTPTsignature
// create the raw type:
currentStackElem.rawType = createInterimClassType(currentStackElem.gatheredStr);
// we know "<...>" follows further, so the type becames InterimParameterizedType now:
currentStackElem.typeKind = 1;
}
prntSS(" ### 13:", ts1);
}
m35 = LT(1);
match(TRIANGLEOPEN_SIGN);
if ( inputState.guessing==0 ) {
prntS(" ===14===");
// grow the signature:
currentStackElem.sigEnd = addToSignature("<") + 1;
// It's the time to clean the arguments list of including class:
if (currentStackElem.args != null) {
currentStackElem.args = null;
}
currentStackElemCopy = currentStackElem;
currentStackElem = new PTStack();
currentStackElemCopy.nextLevel = currentStackElem;
lexer.stackDepth++; //to reflect a level of argument nesting
currentStackElem.gatheredStr = null;
currentStackElem.gthrdStrLen = 0;
currentStackElem.wrappInWildcard = -1;
currentStackElem.typeKind = 0;
currentStackElem.rawType = null;
currentStackElem.owner = null;
currentStackElem.args = null;
currentStackElem.sigBegin = -1;
currentStackElem.sigEnd = -1;
currentStackElem.dim = 0;
currentStackElem.nextLevel = null;
prntSS(" ### 14:", m35.getText());
}
pr__TYPE_ARGUMENTS();
if ( inputState.guessing==0 ) {
prntSS(" ### 15:", "m36.getText()");
}
m37 = LT(1);
match(TRIANGLECLOSE_SIGN);
if ( inputState.guessing==0 ) {
prntS(" ===15===");
// grow the signature:
currentStackElem.sigEnd = addToSignature(">") + 1;
// find the previous element for the current stack's element:
p1 = stack;
while (p1 != currentStackElem){
p2 = p1;
p1 = p1.nextLevel;
}
p2.nextLevel = null;
lexer.stackDepth--; // to reflect a level of argument nesting
// return to previous stack element:
currentStackElem = p2;
p2 = null;
// in any case, the being finished reference is of InterimParametrizedType because it has "<...>"
currentStackElem.typeKind = 1;
// free memory of the being left stack's element:
p1.gatheredStr = null;
p1 = null;
prntSS(" pr__SIMPLE_CLASS_TYPE_SIGNATURE 1 :", m37.getText());
}
}
else if ((LA(1)==ID)) {
m371 = LT(1);
match(ID);
if ( inputState.guessing==0 ) {
prntS(" ===16===");
String ts1 = m371.getText();
int tl = ts1.length();
if (currentStackElem.rawType == null){ // so it's the non-inner class id
prntSS(" ===160===", ts1);
// create the owner:
currentStackElem.owner = null; // owner is absent for package level class
// grow the gatheredStr:
if(currentStackElem.gatheredStr == null){ // so, we should check the existence of "L" at the begin of ID because it is the begin of the reference
// (for remembering: any "T..." identifier can not be considered as TVAR within
// this being parsered pr__SIMPLE_CLASS_TYPE_SIGNATURE rule, especially, if we are
// within generic parameters declaration parsering, where a TVAR using is prohibited)
if(ts1.charAt(0) != 'L'){
throwGenericSignatureFormatError();
}
addToGatheredStr(currentStackElem, ts1); // so, it's "L"<class ID> here
} else {
addToGatheredStr(currentStackElem, ts1); // so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID> here
}
// grow the signature (like the gatheredStr growing):
if(currentStackElem.sigBegin == -1){
currentStackElem.sigBegin = addToSignature(ts1); // so, it's "L"<class ID> added to CTPTsignature
currentStackElem.sigEnd = currentStackElem.sigBegin + tl;
} else {
currentStackElem.sigEnd = addToSignature(ts1) + tl; // so, it's <class ID> added to CTPTsignature,
// consequently the "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID> is there regarding the current parsered reference
}
// create the raw type:
currentStackElem.rawType = createInterimClassType(currentStackElem.gatheredStr);
} else { //so it's the regular inner class id
prntSS(" ===161===", ts1);
// create the owner:
if(currentStackElem.typeKind == 0 && currentStackElem.args == null){
//if (currentStackElem.owner != null) {
// // so, we have created InterimClassType some times for the previous parts (IDs)
// // and we should provide that each InterimClassType object should be deleted by GC when the next one is being created
// // because the only last preceding may to be used as owner of the first InterimParameterizedType object which arises
// // while a reference is parsered.
// // So, can/should we do anything special (I don't see such features within JNI) to destroy the previouse InterimClassType
// // object which becames superflouos
// // just when the next one appeares? Or GC will remove such objects because there will not be any references for them
// // within the java code.
// ???<<< (*env)->ReleaseObject(..., currentStackElem.owner, ...); >>>???
//}
currentStackElem.owner = createInterimClassType(/*currentStackElem.rawType*/currentStackElem.gatheredStr);
} else {
currentStackElem.typeKind = 1; // at least one args was not equal to null at a previous stage
//len = currentStackElem.sigEnd - currentStackElem.sigBegin + 1;
len = sigInd - currentStackElem.sigBegin/* + 1*/;
currentStackElem.owner = createInterimParameterizedType(CTPTsignature.substring(currentStackElem.sigBegin, currentStackElem.sigBegin + len), currentStackElem);
currentStackElem.args = null;
}
// grow the gatheredStr:
addToGatheredStr(currentStackElem, "$"); //so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$" here
addToGatheredStr(currentStackElem, ts1); //so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$"<class ID> here
// grow the signature (like the gatheredStr growing):
currentStackElem.sigEnd = addToSignature("$") + 1; //so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$" gathered in CTPTsignature
currentStackElem.sigEnd = addToSignature(ts1) + tl; //so, it's "L"[A-Za-z][A-Za-z0-9"/"]*"/"<class ID>{"$"<class ID>}"$"<class ID> gathered in CTPTsignature
// create the raw type:
currentStackElem.rawType = createInterimClassType(currentStackElem.gatheredStr);
}
prntSS(" pr__SIMPLE_CLASS_TYPE_SIGNATURE 2:", ts1);
}
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_9);
} else {
throw ex;
}
}
}