diff --git a/Assignment-1/ExprLexer.interp b/Assignment-1/ExprLexer.interp new file mode 100644 index 0000000..21429f8 --- /dev/null +++ b/Assignment-1/ExprLexer.interp @@ -0,0 +1,363 @@ +token literal names: +null +null +null +'abstract' +'assert' +'boolean' +'break' +'byte' +'case' +'catch' +'char' +'class' +'const' +'continue' +'default' +'do' +'double' +'else' +'extends' +'final' +'finally' +'float' +'for' +'goto' +'if' +'implements' +'import' +'instanceof' +'int' +'interface' +'long' +'native' +'new' +'package' +'private' +'protected' +'public' +'return' +'short' +'static' +'strictfp' +'super' +'switch' +'synchronized' +'this' +'throw' +'throws' +'transient' +'try' +'void' +'volatile' +'while' +'.' +null +null +null +null +null +'null' +'(' +')' +'{' +'}' +'[' +']' +';' +',' +'>>>=' +'==' +'!=' +'<=' +'>=' +'&&' +'||' +'++' +'--' +'<<' +'>>' +'>>>' +'+=' +'-=' +'*=' +'/=' +'&=' +'|=' +'^=' +'%=' +'<<=' +'>>=' +'=' +'~' +'<' +'>' +'!' +'?' +':' +'+' +'-' +'*' +'/' +'&' +'|' +'^' +'%' +null + +token symbolic names: +null +WhiteSpace +Comment +Abstract +Assert +Boolean +Break +Byte +Case +Catch +Char +Class +Const +Continue +Default +Do +Double +Else +Extends +Final +Finally +Float +For +Goto +If +Implements +Import +InstanceOf +Int +Interface +Long +Native +New +Package +Private +Protected +Public +Return +Short +Static +Strictfp +Super +Switch +Synchronized +This +Throw +Throws +Transient +Try +Void +Volatile +While +Dot +IntegerLiteral +FloatingPointLiteral +CharacterLiteral +StringLiteral +BooleanLiteral +NullLiteral +ParenthesesLeft +ParenthesesRight +CurlyBracketLeft +CurlyBracketRight +SquareBracketLeft +SquareBracketRight +Semicolon +Comma +UnsignedRightShiftAssign +EqualTo +NotEqualTo +LessThanEqualTo +GreaterThanEqualTo +ConditionalAND +ConditionalOR +Increment +Decrement +LeftShift +SignedRightShift +UnsignedRightShift +AddAssign +SubtractAssign +MultiplyAssign +DivideAssign +BitwiseANDAssign +BitwiseORAssign +BitwiseXORAssign +RemainderAssign +LeftShiftAssign +SignedRightShiftAssign +Assignment +BitwiseComplement +LessThan +GreaterThan +LogicalComplement +Question +Colon +Addition +Subtraction +Multiplication +Division +BitwiseAND +BitwiseOR +BitwiseXOR +Remainder +IDENTIFIER + +rule names: +LineTerminator +WhiteSpace +EndOfLineComment +Comment +TraditionalComment +CommentTail +CommentTailStar +NotStar +NotStarNotSlash +Abstract +Assert +Boolean +Break +Byte +Case +Catch +Char +Class +Const +Continue +Default +Do +Double +Else +Extends +Final +Finally +Float +For +Goto +If +Implements +Import +InstanceOf +Int +Interface +Long +Native +New +Package +Private +Protected +Public +Return +Short +Static +Strictfp +Super +Switch +Synchronized +This +Throw +Throws +Transient +Try +Void +Volatile +While +Dot +IntegerLiteral +DecimalIntegerLiteral +HexIntegerLiteral +OctalIntegerLiteral +IntegerTypeSuffix +DecimalNumeral +HexNumeral +HexDigits +HexDigit +FloatingPointLiteral +ExponentPart +ExponentIndicator +SignedInteger +Digits +Digit +NonZeroDigit +Sign +FloatTypeSuffix +CharacterLiteral +SingleCharacter +StringLiteral +StringCharacters +StringCharacter +EscapeSequence +OctalEscape +OctalNumeral +OctalDigits +OctalDigit +ZeroToThree +BooleanLiteral +NullLiteral +ParenthesesLeft +ParenthesesRight +CurlyBracketLeft +CurlyBracketRight +SquareBracketLeft +SquareBracketRight +Semicolon +Comma +UnsignedRightShiftAssign +EqualTo +NotEqualTo +LessThanEqualTo +GreaterThanEqualTo +ConditionalAND +ConditionalOR +Increment +Decrement +LeftShift +SignedRightShift +UnsignedRightShift +AddAssign +SubtractAssign +MultiplyAssign +DivideAssign +BitwiseANDAssign +BitwiseORAssign +BitwiseXORAssign +RemainderAssign +LeftShiftAssign +SignedRightShiftAssign +Assignment +BitwiseComplement +LessThan +GreaterThan +LogicalComplement +Question +Colon +Addition +Subtraction +Multiplication +Division +BitwiseAND +BitwiseOR +BitwiseXOR +Remainder +IDENTIFIER +JavaLetter +JavaLetterOrDigit + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 104, 1007, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 1, 0, 1, 0, 3, 0, 280, 8, 0, 1, 0, 3, 0, 283, 8, 0, 1, 1, 1, 1, 3, 1, 287, 8, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 295, 8, 2, 10, 2, 12, 2, 298, 9, 2, 1, 2, 3, 2, 301, 8, 2, 1, 3, 1, 3, 3, 3, 305, 8, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 3, 5, 318, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 326, 8, 6, 1, 7, 1, 7, 3, 7, 330, 8, 7, 1, 8, 1, 8, 3, 8, 334, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 3, 59, 675, 8, 59, 1, 60, 1, 60, 3, 60, 679, 8, 60, 1, 61, 1, 61, 3, 61, 683, 8, 61, 1, 62, 1, 62, 3, 62, 687, 8, 62, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 694, 8, 64, 3, 64, 696, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 3, 65, 704, 8, 65, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 710, 8, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 3, 68, 717, 8, 68, 1, 68, 3, 68, 720, 8, 68, 1, 68, 3, 68, 723, 8, 68, 1, 68, 1, 68, 1, 68, 3, 68, 728, 8, 68, 1, 68, 3, 68, 731, 8, 68, 1, 68, 1, 68, 1, 68, 3, 68, 736, 8, 68, 1, 68, 1, 68, 3, 68, 740, 8, 68, 1, 68, 1, 68, 3, 68, 744, 8, 68, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 3, 71, 752, 8, 71, 1, 71, 1, 71, 1, 72, 4, 72, 757, 8, 72, 11, 72, 12, 72, 758, 1, 73, 1, 73, 3, 73, 763, 8, 73, 1, 74, 1, 74, 1, 75, 1, 75, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 779, 8, 77, 1, 78, 1, 78, 1, 79, 1, 79, 3, 79, 785, 8, 79, 1, 79, 1, 79, 1, 80, 4, 80, 790, 8, 80, 11, 80, 12, 80, 791, 1, 81, 1, 81, 3, 81, 796, 8, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 3, 82, 840, 8, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 3, 83, 853, 8, 83, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 3, 88, 873, 8, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 96, 1, 96, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 121, 1, 121, 1, 122, 1, 122, 1, 123, 1, 123, 1, 124, 1, 124, 1, 125, 1, 125, 1, 126, 1, 126, 1, 127, 1, 127, 1, 128, 1, 128, 1, 129, 1, 129, 1, 130, 1, 130, 1, 131, 1, 131, 1, 132, 1, 132, 1, 133, 1, 133, 1, 134, 1, 134, 1, 135, 1, 135, 5, 135, 999, 8, 135, 10, 135, 12, 135, 1002, 9, 135, 1, 136, 1, 136, 1, 137, 1, 137, 0, 0, 138, 1, 0, 3, 1, 5, 0, 7, 2, 9, 0, 11, 0, 13, 0, 15, 0, 17, 0, 19, 3, 21, 4, 23, 5, 25, 6, 27, 7, 29, 8, 31, 9, 33, 10, 35, 11, 37, 12, 39, 13, 41, 14, 43, 15, 45, 16, 47, 17, 49, 18, 51, 19, 53, 20, 55, 21, 57, 22, 59, 23, 61, 24, 63, 25, 65, 26, 67, 27, 69, 28, 71, 29, 73, 30, 75, 31, 77, 32, 79, 33, 81, 34, 83, 35, 85, 36, 87, 37, 89, 38, 91, 39, 93, 40, 95, 41, 97, 42, 99, 43, 101, 44, 103, 45, 105, 46, 107, 47, 109, 48, 111, 49, 113, 50, 115, 51, 117, 52, 119, 53, 121, 0, 123, 0, 125, 0, 127, 0, 129, 0, 131, 0, 133, 0, 135, 0, 137, 54, 139, 0, 141, 0, 143, 0, 145, 0, 147, 0, 149, 0, 151, 0, 153, 0, 155, 55, 157, 0, 159, 56, 161, 0, 163, 0, 165, 0, 167, 0, 169, 0, 171, 0, 173, 0, 175, 0, 177, 57, 179, 58, 181, 59, 183, 60, 185, 61, 187, 62, 189, 63, 191, 64, 193, 65, 195, 66, 197, 67, 199, 68, 201, 69, 203, 70, 205, 71, 207, 72, 209, 73, 211, 74, 213, 75, 215, 76, 217, 77, 219, 78, 221, 79, 223, 80, 225, 81, 227, 82, 229, 83, 231, 84, 233, 85, 235, 86, 237, 87, 239, 88, 241, 89, 243, 90, 245, 91, 247, 92, 249, 93, 251, 94, 253, 95, 255, 96, 257, 97, 259, 98, 261, 99, 263, 100, 265, 101, 267, 102, 269, 103, 271, 104, 273, 0, 275, 0, 1, 0, 15, 3, 0, 9, 9, 12, 12, 32, 32, 2, 0, 10, 10, 13, 13, 2, 0, 42, 42, 94, 94, 3, 0, 42, 42, 47, 47, 94, 94, 2, 0, 76, 76, 108, 108, 3, 0, 48, 57, 65, 70, 97, 102, 2, 0, 69, 69, 101, 101, 1, 0, 49, 57, 2, 0, 43, 43, 45, 45, 4, 0, 68, 68, 70, 70, 100, 100, 102, 102, 3, 0, 39, 39, 92, 92, 94, 94, 1, 0, 48, 55, 1, 0, 48, 51, 4, 0, 36, 36, 65, 90, 95, 95, 97, 122, 5, 0, 36, 36, 48, 57, 65, 90, 95, 95, 97, 122, 1021, 0, 3, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 1, 282, 1, 0, 0, 0, 3, 286, 1, 0, 0, 0, 5, 290, 1, 0, 0, 0, 7, 304, 1, 0, 0, 0, 9, 308, 1, 0, 0, 0, 11, 317, 1, 0, 0, 0, 13, 325, 1, 0, 0, 0, 15, 329, 1, 0, 0, 0, 17, 333, 1, 0, 0, 0, 19, 335, 1, 0, 0, 0, 21, 344, 1, 0, 0, 0, 23, 351, 1, 0, 0, 0, 25, 359, 1, 0, 0, 0, 27, 365, 1, 0, 0, 0, 29, 370, 1, 0, 0, 0, 31, 375, 1, 0, 0, 0, 33, 381, 1, 0, 0, 0, 35, 386, 1, 0, 0, 0, 37, 392, 1, 0, 0, 0, 39, 398, 1, 0, 0, 0, 41, 407, 1, 0, 0, 0, 43, 415, 1, 0, 0, 0, 45, 418, 1, 0, 0, 0, 47, 425, 1, 0, 0, 0, 49, 430, 1, 0, 0, 0, 51, 438, 1, 0, 0, 0, 53, 444, 1, 0, 0, 0, 55, 452, 1, 0, 0, 0, 57, 458, 1, 0, 0, 0, 59, 462, 1, 0, 0, 0, 61, 467, 1, 0, 0, 0, 63, 470, 1, 0, 0, 0, 65, 481, 1, 0, 0, 0, 67, 488, 1, 0, 0, 0, 69, 499, 1, 0, 0, 0, 71, 503, 1, 0, 0, 0, 73, 513, 1, 0, 0, 0, 75, 518, 1, 0, 0, 0, 77, 525, 1, 0, 0, 0, 79, 529, 1, 0, 0, 0, 81, 537, 1, 0, 0, 0, 83, 545, 1, 0, 0, 0, 85, 555, 1, 0, 0, 0, 87, 562, 1, 0, 0, 0, 89, 569, 1, 0, 0, 0, 91, 575, 1, 0, 0, 0, 93, 582, 1, 0, 0, 0, 95, 591, 1, 0, 0, 0, 97, 597, 1, 0, 0, 0, 99, 604, 1, 0, 0, 0, 101, 617, 1, 0, 0, 0, 103, 622, 1, 0, 0, 0, 105, 628, 1, 0, 0, 0, 107, 635, 1, 0, 0, 0, 109, 645, 1, 0, 0, 0, 111, 649, 1, 0, 0, 0, 113, 654, 1, 0, 0, 0, 115, 663, 1, 0, 0, 0, 117, 669, 1, 0, 0, 0, 119, 674, 1, 0, 0, 0, 121, 676, 1, 0, 0, 0, 123, 680, 1, 0, 0, 0, 125, 684, 1, 0, 0, 0, 127, 688, 1, 0, 0, 0, 129, 695, 1, 0, 0, 0, 131, 703, 1, 0, 0, 0, 133, 709, 1, 0, 0, 0, 135, 711, 1, 0, 0, 0, 137, 743, 1, 0, 0, 0, 139, 745, 1, 0, 0, 0, 141, 748, 1, 0, 0, 0, 143, 751, 1, 0, 0, 0, 145, 756, 1, 0, 0, 0, 147, 762, 1, 0, 0, 0, 149, 764, 1, 0, 0, 0, 151, 766, 1, 0, 0, 0, 153, 768, 1, 0, 0, 0, 155, 778, 1, 0, 0, 0, 157, 780, 1, 0, 0, 0, 159, 782, 1, 0, 0, 0, 161, 789, 1, 0, 0, 0, 163, 795, 1, 0, 0, 0, 165, 797, 1, 0, 0, 0, 167, 852, 1, 0, 0, 0, 169, 854, 1, 0, 0, 0, 171, 857, 1, 0, 0, 0, 173, 859, 1, 0, 0, 0, 175, 861, 1, 0, 0, 0, 177, 872, 1, 0, 0, 0, 179, 874, 1, 0, 0, 0, 181, 879, 1, 0, 0, 0, 183, 881, 1, 0, 0, 0, 185, 883, 1, 0, 0, 0, 187, 885, 1, 0, 0, 0, 189, 887, 1, 0, 0, 0, 191, 889, 1, 0, 0, 0, 193, 891, 1, 0, 0, 0, 195, 893, 1, 0, 0, 0, 197, 895, 1, 0, 0, 0, 199, 900, 1, 0, 0, 0, 201, 903, 1, 0, 0, 0, 203, 906, 1, 0, 0, 0, 205, 909, 1, 0, 0, 0, 207, 912, 1, 0, 0, 0, 209, 915, 1, 0, 0, 0, 211, 918, 1, 0, 0, 0, 213, 921, 1, 0, 0, 0, 215, 924, 1, 0, 0, 0, 217, 927, 1, 0, 0, 0, 219, 930, 1, 0, 0, 0, 221, 934, 1, 0, 0, 0, 223, 937, 1, 0, 0, 0, 225, 940, 1, 0, 0, 0, 227, 943, 1, 0, 0, 0, 229, 946, 1, 0, 0, 0, 231, 949, 1, 0, 0, 0, 233, 952, 1, 0, 0, 0, 235, 955, 1, 0, 0, 0, 237, 958, 1, 0, 0, 0, 239, 962, 1, 0, 0, 0, 241, 966, 1, 0, 0, 0, 243, 968, 1, 0, 0, 0, 245, 970, 1, 0, 0, 0, 247, 972, 1, 0, 0, 0, 249, 974, 1, 0, 0, 0, 251, 976, 1, 0, 0, 0, 253, 978, 1, 0, 0, 0, 255, 980, 1, 0, 0, 0, 257, 982, 1, 0, 0, 0, 259, 984, 1, 0, 0, 0, 261, 986, 1, 0, 0, 0, 263, 988, 1, 0, 0, 0, 265, 990, 1, 0, 0, 0, 267, 992, 1, 0, 0, 0, 269, 994, 1, 0, 0, 0, 271, 996, 1, 0, 0, 0, 273, 1003, 1, 0, 0, 0, 275, 1005, 1, 0, 0, 0, 277, 279, 5, 13, 0, 0, 278, 280, 5, 10, 0, 0, 279, 278, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, 283, 1, 0, 0, 0, 281, 283, 5, 10, 0, 0, 282, 277, 1, 0, 0, 0, 282, 281, 1, 0, 0, 0, 283, 2, 1, 0, 0, 0, 284, 287, 7, 0, 0, 0, 285, 287, 3, 1, 0, 0, 286, 284, 1, 0, 0, 0, 286, 285, 1, 0, 0, 0, 287, 288, 1, 0, 0, 0, 288, 289, 6, 1, 0, 0, 289, 4, 1, 0, 0, 0, 290, 291, 5, 47, 0, 0, 291, 292, 5, 47, 0, 0, 292, 296, 1, 0, 0, 0, 293, 295, 8, 1, 0, 0, 294, 293, 1, 0, 0, 0, 295, 298, 1, 0, 0, 0, 296, 294, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 300, 1, 0, 0, 0, 298, 296, 1, 0, 0, 0, 299, 301, 3, 1, 0, 0, 300, 299, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 6, 1, 0, 0, 0, 302, 305, 3, 9, 4, 0, 303, 305, 3, 5, 2, 0, 304, 302, 1, 0, 0, 0, 304, 303, 1, 0, 0, 0, 305, 306, 1, 0, 0, 0, 306, 307, 6, 3, 0, 0, 307, 8, 1, 0, 0, 0, 308, 309, 5, 47, 0, 0, 309, 310, 5, 42, 0, 0, 310, 311, 1, 0, 0, 0, 311, 312, 3, 15, 7, 0, 312, 313, 3, 11, 5, 0, 313, 10, 1, 0, 0, 0, 314, 315, 5, 42, 0, 0, 315, 318, 3, 13, 6, 0, 316, 318, 3, 15, 7, 0, 317, 314, 1, 0, 0, 0, 317, 316, 1, 0, 0, 0, 318, 12, 1, 0, 0, 0, 319, 326, 5, 47, 0, 0, 320, 321, 5, 42, 0, 0, 321, 326, 3, 13, 6, 0, 322, 323, 3, 17, 8, 0, 323, 324, 3, 11, 5, 0, 324, 326, 1, 0, 0, 0, 325, 319, 1, 0, 0, 0, 325, 320, 1, 0, 0, 0, 325, 322, 1, 0, 0, 0, 326, 14, 1, 0, 0, 0, 327, 330, 7, 2, 0, 0, 328, 330, 3, 1, 0, 0, 329, 327, 1, 0, 0, 0, 329, 328, 1, 0, 0, 0, 330, 16, 1, 0, 0, 0, 331, 334, 7, 3, 0, 0, 332, 334, 3, 1, 0, 0, 333, 331, 1, 0, 0, 0, 333, 332, 1, 0, 0, 0, 334, 18, 1, 0, 0, 0, 335, 336, 5, 97, 0, 0, 336, 337, 5, 98, 0, 0, 337, 338, 5, 115, 0, 0, 338, 339, 5, 116, 0, 0, 339, 340, 5, 114, 0, 0, 340, 341, 5, 97, 0, 0, 341, 342, 5, 99, 0, 0, 342, 343, 5, 116, 0, 0, 343, 20, 1, 0, 0, 0, 344, 345, 5, 97, 0, 0, 345, 346, 5, 115, 0, 0, 346, 347, 5, 115, 0, 0, 347, 348, 5, 101, 0, 0, 348, 349, 5, 114, 0, 0, 349, 350, 5, 116, 0, 0, 350, 22, 1, 0, 0, 0, 351, 352, 5, 98, 0, 0, 352, 353, 5, 111, 0, 0, 353, 354, 5, 111, 0, 0, 354, 355, 5, 108, 0, 0, 355, 356, 5, 101, 0, 0, 356, 357, 5, 97, 0, 0, 357, 358, 5, 110, 0, 0, 358, 24, 1, 0, 0, 0, 359, 360, 5, 98, 0, 0, 360, 361, 5, 114, 0, 0, 361, 362, 5, 101, 0, 0, 362, 363, 5, 97, 0, 0, 363, 364, 5, 107, 0, 0, 364, 26, 1, 0, 0, 0, 365, 366, 5, 98, 0, 0, 366, 367, 5, 121, 0, 0, 367, 368, 5, 116, 0, 0, 368, 369, 5, 101, 0, 0, 369, 28, 1, 0, 0, 0, 370, 371, 5, 99, 0, 0, 371, 372, 5, 97, 0, 0, 372, 373, 5, 115, 0, 0, 373, 374, 5, 101, 0, 0, 374, 30, 1, 0, 0, 0, 375, 376, 5, 99, 0, 0, 376, 377, 5, 97, 0, 0, 377, 378, 5, 116, 0, 0, 378, 379, 5, 99, 0, 0, 379, 380, 5, 104, 0, 0, 380, 32, 1, 0, 0, 0, 381, 382, 5, 99, 0, 0, 382, 383, 5, 104, 0, 0, 383, 384, 5, 97, 0, 0, 384, 385, 5, 114, 0, 0, 385, 34, 1, 0, 0, 0, 386, 387, 5, 99, 0, 0, 387, 388, 5, 108, 0, 0, 388, 389, 5, 97, 0, 0, 389, 390, 5, 115, 0, 0, 390, 391, 5, 115, 0, 0, 391, 36, 1, 0, 0, 0, 392, 393, 5, 99, 0, 0, 393, 394, 5, 111, 0, 0, 394, 395, 5, 110, 0, 0, 395, 396, 5, 115, 0, 0, 396, 397, 5, 116, 0, 0, 397, 38, 1, 0, 0, 0, 398, 399, 5, 99, 0, 0, 399, 400, 5, 111, 0, 0, 400, 401, 5, 110, 0, 0, 401, 402, 5, 116, 0, 0, 402, 403, 5, 105, 0, 0, 403, 404, 5, 110, 0, 0, 404, 405, 5, 117, 0, 0, 405, 406, 5, 101, 0, 0, 406, 40, 1, 0, 0, 0, 407, 408, 5, 100, 0, 0, 408, 409, 5, 101, 0, 0, 409, 410, 5, 102, 0, 0, 410, 411, 5, 97, 0, 0, 411, 412, 5, 117, 0, 0, 412, 413, 5, 108, 0, 0, 413, 414, 5, 116, 0, 0, 414, 42, 1, 0, 0, 0, 415, 416, 5, 100, 0, 0, 416, 417, 5, 111, 0, 0, 417, 44, 1, 0, 0, 0, 418, 419, 5, 100, 0, 0, 419, 420, 5, 111, 0, 0, 420, 421, 5, 117, 0, 0, 421, 422, 5, 98, 0, 0, 422, 423, 5, 108, 0, 0, 423, 424, 5, 101, 0, 0, 424, 46, 1, 0, 0, 0, 425, 426, 5, 101, 0, 0, 426, 427, 5, 108, 0, 0, 427, 428, 5, 115, 0, 0, 428, 429, 5, 101, 0, 0, 429, 48, 1, 0, 0, 0, 430, 431, 5, 101, 0, 0, 431, 432, 5, 120, 0, 0, 432, 433, 5, 116, 0, 0, 433, 434, 5, 101, 0, 0, 434, 435, 5, 110, 0, 0, 435, 436, 5, 100, 0, 0, 436, 437, 5, 115, 0, 0, 437, 50, 1, 0, 0, 0, 438, 439, 5, 102, 0, 0, 439, 440, 5, 105, 0, 0, 440, 441, 5, 110, 0, 0, 441, 442, 5, 97, 0, 0, 442, 443, 5, 108, 0, 0, 443, 52, 1, 0, 0, 0, 444, 445, 5, 102, 0, 0, 445, 446, 5, 105, 0, 0, 446, 447, 5, 110, 0, 0, 447, 448, 5, 97, 0, 0, 448, 449, 5, 108, 0, 0, 449, 450, 5, 108, 0, 0, 450, 451, 5, 121, 0, 0, 451, 54, 1, 0, 0, 0, 452, 453, 5, 102, 0, 0, 453, 454, 5, 108, 0, 0, 454, 455, 5, 111, 0, 0, 455, 456, 5, 97, 0, 0, 456, 457, 5, 116, 0, 0, 457, 56, 1, 0, 0, 0, 458, 459, 5, 102, 0, 0, 459, 460, 5, 111, 0, 0, 460, 461, 5, 114, 0, 0, 461, 58, 1, 0, 0, 0, 462, 463, 5, 103, 0, 0, 463, 464, 5, 111, 0, 0, 464, 465, 5, 116, 0, 0, 465, 466, 5, 111, 0, 0, 466, 60, 1, 0, 0, 0, 467, 468, 5, 105, 0, 0, 468, 469, 5, 102, 0, 0, 469, 62, 1, 0, 0, 0, 470, 471, 5, 105, 0, 0, 471, 472, 5, 109, 0, 0, 472, 473, 5, 112, 0, 0, 473, 474, 5, 108, 0, 0, 474, 475, 5, 101, 0, 0, 475, 476, 5, 109, 0, 0, 476, 477, 5, 101, 0, 0, 477, 478, 5, 110, 0, 0, 478, 479, 5, 116, 0, 0, 479, 480, 5, 115, 0, 0, 480, 64, 1, 0, 0, 0, 481, 482, 5, 105, 0, 0, 482, 483, 5, 109, 0, 0, 483, 484, 5, 112, 0, 0, 484, 485, 5, 111, 0, 0, 485, 486, 5, 114, 0, 0, 486, 487, 5, 116, 0, 0, 487, 66, 1, 0, 0, 0, 488, 489, 5, 105, 0, 0, 489, 490, 5, 110, 0, 0, 490, 491, 5, 115, 0, 0, 491, 492, 5, 116, 0, 0, 492, 493, 5, 97, 0, 0, 493, 494, 5, 110, 0, 0, 494, 495, 5, 99, 0, 0, 495, 496, 5, 101, 0, 0, 496, 497, 5, 111, 0, 0, 497, 498, 5, 102, 0, 0, 498, 68, 1, 0, 0, 0, 499, 500, 5, 105, 0, 0, 500, 501, 5, 110, 0, 0, 501, 502, 5, 116, 0, 0, 502, 70, 1, 0, 0, 0, 503, 504, 5, 105, 0, 0, 504, 505, 5, 110, 0, 0, 505, 506, 5, 116, 0, 0, 506, 507, 5, 101, 0, 0, 507, 508, 5, 114, 0, 0, 508, 509, 5, 102, 0, 0, 509, 510, 5, 97, 0, 0, 510, 511, 5, 99, 0, 0, 511, 512, 5, 101, 0, 0, 512, 72, 1, 0, 0, 0, 513, 514, 5, 108, 0, 0, 514, 515, 5, 111, 0, 0, 515, 516, 5, 110, 0, 0, 516, 517, 5, 103, 0, 0, 517, 74, 1, 0, 0, 0, 518, 519, 5, 110, 0, 0, 519, 520, 5, 97, 0, 0, 520, 521, 5, 116, 0, 0, 521, 522, 5, 105, 0, 0, 522, 523, 5, 118, 0, 0, 523, 524, 5, 101, 0, 0, 524, 76, 1, 0, 0, 0, 525, 526, 5, 110, 0, 0, 526, 527, 5, 101, 0, 0, 527, 528, 5, 119, 0, 0, 528, 78, 1, 0, 0, 0, 529, 530, 5, 112, 0, 0, 530, 531, 5, 97, 0, 0, 531, 532, 5, 99, 0, 0, 532, 533, 5, 107, 0, 0, 533, 534, 5, 97, 0, 0, 534, 535, 5, 103, 0, 0, 535, 536, 5, 101, 0, 0, 536, 80, 1, 0, 0, 0, 537, 538, 5, 112, 0, 0, 538, 539, 5, 114, 0, 0, 539, 540, 5, 105, 0, 0, 540, 541, 5, 118, 0, 0, 541, 542, 5, 97, 0, 0, 542, 543, 5, 116, 0, 0, 543, 544, 5, 101, 0, 0, 544, 82, 1, 0, 0, 0, 545, 546, 5, 112, 0, 0, 546, 547, 5, 114, 0, 0, 547, 548, 5, 111, 0, 0, 548, 549, 5, 116, 0, 0, 549, 550, 5, 101, 0, 0, 550, 551, 5, 99, 0, 0, 551, 552, 5, 116, 0, 0, 552, 553, 5, 101, 0, 0, 553, 554, 5, 100, 0, 0, 554, 84, 1, 0, 0, 0, 555, 556, 5, 112, 0, 0, 556, 557, 5, 117, 0, 0, 557, 558, 5, 98, 0, 0, 558, 559, 5, 108, 0, 0, 559, 560, 5, 105, 0, 0, 560, 561, 5, 99, 0, 0, 561, 86, 1, 0, 0, 0, 562, 563, 5, 114, 0, 0, 563, 564, 5, 101, 0, 0, 564, 565, 5, 116, 0, 0, 565, 566, 5, 117, 0, 0, 566, 567, 5, 114, 0, 0, 567, 568, 5, 110, 0, 0, 568, 88, 1, 0, 0, 0, 569, 570, 5, 115, 0, 0, 570, 571, 5, 104, 0, 0, 571, 572, 5, 111, 0, 0, 572, 573, 5, 114, 0, 0, 573, 574, 5, 116, 0, 0, 574, 90, 1, 0, 0, 0, 575, 576, 5, 115, 0, 0, 576, 577, 5, 116, 0, 0, 577, 578, 5, 97, 0, 0, 578, 579, 5, 116, 0, 0, 579, 580, 5, 105, 0, 0, 580, 581, 5, 99, 0, 0, 581, 92, 1, 0, 0, 0, 582, 583, 5, 115, 0, 0, 583, 584, 5, 116, 0, 0, 584, 585, 5, 114, 0, 0, 585, 586, 5, 105, 0, 0, 586, 587, 5, 99, 0, 0, 587, 588, 5, 116, 0, 0, 588, 589, 5, 102, 0, 0, 589, 590, 5, 112, 0, 0, 590, 94, 1, 0, 0, 0, 591, 592, 5, 115, 0, 0, 592, 593, 5, 117, 0, 0, 593, 594, 5, 112, 0, 0, 594, 595, 5, 101, 0, 0, 595, 596, 5, 114, 0, 0, 596, 96, 1, 0, 0, 0, 597, 598, 5, 115, 0, 0, 598, 599, 5, 119, 0, 0, 599, 600, 5, 105, 0, 0, 600, 601, 5, 116, 0, 0, 601, 602, 5, 99, 0, 0, 602, 603, 5, 104, 0, 0, 603, 98, 1, 0, 0, 0, 604, 605, 5, 115, 0, 0, 605, 606, 5, 121, 0, 0, 606, 607, 5, 110, 0, 0, 607, 608, 5, 99, 0, 0, 608, 609, 5, 104, 0, 0, 609, 610, 5, 114, 0, 0, 610, 611, 5, 111, 0, 0, 611, 612, 5, 110, 0, 0, 612, 613, 5, 105, 0, 0, 613, 614, 5, 122, 0, 0, 614, 615, 5, 101, 0, 0, 615, 616, 5, 100, 0, 0, 616, 100, 1, 0, 0, 0, 617, 618, 5, 116, 0, 0, 618, 619, 5, 104, 0, 0, 619, 620, 5, 105, 0, 0, 620, 621, 5, 115, 0, 0, 621, 102, 1, 0, 0, 0, 622, 623, 5, 116, 0, 0, 623, 624, 5, 104, 0, 0, 624, 625, 5, 114, 0, 0, 625, 626, 5, 111, 0, 0, 626, 627, 5, 119, 0, 0, 627, 104, 1, 0, 0, 0, 628, 629, 5, 116, 0, 0, 629, 630, 5, 104, 0, 0, 630, 631, 5, 114, 0, 0, 631, 632, 5, 111, 0, 0, 632, 633, 5, 119, 0, 0, 633, 634, 5, 115, 0, 0, 634, 106, 1, 0, 0, 0, 635, 636, 5, 116, 0, 0, 636, 637, 5, 114, 0, 0, 637, 638, 5, 97, 0, 0, 638, 639, 5, 110, 0, 0, 639, 640, 5, 115, 0, 0, 640, 641, 5, 105, 0, 0, 641, 642, 5, 101, 0, 0, 642, 643, 5, 110, 0, 0, 643, 644, 5, 116, 0, 0, 644, 108, 1, 0, 0, 0, 645, 646, 5, 116, 0, 0, 646, 647, 5, 114, 0, 0, 647, 648, 5, 121, 0, 0, 648, 110, 1, 0, 0, 0, 649, 650, 5, 118, 0, 0, 650, 651, 5, 111, 0, 0, 651, 652, 5, 105, 0, 0, 652, 653, 5, 100, 0, 0, 653, 112, 1, 0, 0, 0, 654, 655, 5, 118, 0, 0, 655, 656, 5, 111, 0, 0, 656, 657, 5, 108, 0, 0, 657, 658, 5, 97, 0, 0, 658, 659, 5, 116, 0, 0, 659, 660, 5, 105, 0, 0, 660, 661, 5, 108, 0, 0, 661, 662, 5, 101, 0, 0, 662, 114, 1, 0, 0, 0, 663, 664, 5, 119, 0, 0, 664, 665, 5, 104, 0, 0, 665, 666, 5, 105, 0, 0, 666, 667, 5, 108, 0, 0, 667, 668, 5, 101, 0, 0, 668, 116, 1, 0, 0, 0, 669, 670, 5, 46, 0, 0, 670, 118, 1, 0, 0, 0, 671, 675, 3, 121, 60, 0, 672, 675, 3, 123, 61, 0, 673, 675, 3, 125, 62, 0, 674, 671, 1, 0, 0, 0, 674, 672, 1, 0, 0, 0, 674, 673, 1, 0, 0, 0, 675, 120, 1, 0, 0, 0, 676, 678, 3, 129, 64, 0, 677, 679, 3, 127, 63, 0, 678, 677, 1, 0, 0, 0, 678, 679, 1, 0, 0, 0, 679, 122, 1, 0, 0, 0, 680, 682, 3, 131, 65, 0, 681, 683, 3, 127, 63, 0, 682, 681, 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 124, 1, 0, 0, 0, 684, 686, 3, 169, 84, 0, 685, 687, 3, 127, 63, 0, 686, 685, 1, 0, 0, 0, 686, 687, 1, 0, 0, 0, 687, 126, 1, 0, 0, 0, 688, 689, 7, 4, 0, 0, 689, 128, 1, 0, 0, 0, 690, 696, 5, 48, 0, 0, 691, 693, 3, 149, 74, 0, 692, 694, 3, 145, 72, 0, 693, 692, 1, 0, 0, 0, 693, 694, 1, 0, 0, 0, 694, 696, 1, 0, 0, 0, 695, 690, 1, 0, 0, 0, 695, 691, 1, 0, 0, 0, 696, 130, 1, 0, 0, 0, 697, 698, 5, 48, 0, 0, 698, 699, 5, 120, 0, 0, 699, 704, 3, 133, 66, 0, 700, 701, 5, 48, 0, 0, 701, 702, 5, 88, 0, 0, 702, 704, 3, 133, 66, 0, 703, 697, 1, 0, 0, 0, 703, 700, 1, 0, 0, 0, 704, 132, 1, 0, 0, 0, 705, 710, 3, 135, 67, 0, 706, 707, 3, 135, 67, 0, 707, 708, 3, 133, 66, 0, 708, 710, 1, 0, 0, 0, 709, 705, 1, 0, 0, 0, 709, 706, 1, 0, 0, 0, 710, 134, 1, 0, 0, 0, 711, 712, 7, 5, 0, 0, 712, 136, 1, 0, 0, 0, 713, 714, 3, 145, 72, 0, 714, 716, 5, 46, 0, 0, 715, 717, 3, 145, 72, 0, 716, 715, 1, 0, 0, 0, 716, 717, 1, 0, 0, 0, 717, 719, 1, 0, 0, 0, 718, 720, 3, 139, 69, 0, 719, 718, 1, 0, 0, 0, 719, 720, 1, 0, 0, 0, 720, 722, 1, 0, 0, 0, 721, 723, 3, 153, 76, 0, 722, 721, 1, 0, 0, 0, 722, 723, 1, 0, 0, 0, 723, 744, 1, 0, 0, 0, 724, 725, 5, 46, 0, 0, 725, 727, 3, 145, 72, 0, 726, 728, 3, 139, 69, 0, 727, 726, 1, 0, 0, 0, 727, 728, 1, 0, 0, 0, 728, 730, 1, 0, 0, 0, 729, 731, 3, 153, 76, 0, 730, 729, 1, 0, 0, 0, 730, 731, 1, 0, 0, 0, 731, 744, 1, 0, 0, 0, 732, 733, 3, 145, 72, 0, 733, 735, 3, 139, 69, 0, 734, 736, 3, 153, 76, 0, 735, 734, 1, 0, 0, 0, 735, 736, 1, 0, 0, 0, 736, 744, 1, 0, 0, 0, 737, 739, 3, 145, 72, 0, 738, 740, 3, 139, 69, 0, 739, 738, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 742, 3, 153, 76, 0, 742, 744, 1, 0, 0, 0, 743, 713, 1, 0, 0, 0, 743, 724, 1, 0, 0, 0, 743, 732, 1, 0, 0, 0, 743, 737, 1, 0, 0, 0, 744, 138, 1, 0, 0, 0, 745, 746, 3, 141, 70, 0, 746, 747, 3, 143, 71, 0, 747, 140, 1, 0, 0, 0, 748, 749, 7, 6, 0, 0, 749, 142, 1, 0, 0, 0, 750, 752, 3, 151, 75, 0, 751, 750, 1, 0, 0, 0, 751, 752, 1, 0, 0, 0, 752, 753, 1, 0, 0, 0, 753, 754, 3, 145, 72, 0, 754, 144, 1, 0, 0, 0, 755, 757, 3, 147, 73, 0, 756, 755, 1, 0, 0, 0, 757, 758, 1, 0, 0, 0, 758, 756, 1, 0, 0, 0, 758, 759, 1, 0, 0, 0, 759, 146, 1, 0, 0, 0, 760, 763, 5, 48, 0, 0, 761, 763, 3, 149, 74, 0, 762, 760, 1, 0, 0, 0, 762, 761, 1, 0, 0, 0, 763, 148, 1, 0, 0, 0, 764, 765, 7, 7, 0, 0, 765, 150, 1, 0, 0, 0, 766, 767, 7, 8, 0, 0, 767, 152, 1, 0, 0, 0, 768, 769, 7, 9, 0, 0, 769, 154, 1, 0, 0, 0, 770, 771, 5, 39, 0, 0, 771, 772, 3, 157, 78, 0, 772, 773, 5, 39, 0, 0, 773, 779, 1, 0, 0, 0, 774, 775, 5, 39, 0, 0, 775, 776, 3, 165, 82, 0, 776, 777, 5, 39, 0, 0, 777, 779, 1, 0, 0, 0, 778, 770, 1, 0, 0, 0, 778, 774, 1, 0, 0, 0, 779, 156, 1, 0, 0, 0, 780, 781, 7, 10, 0, 0, 781, 158, 1, 0, 0, 0, 782, 784, 5, 34, 0, 0, 783, 785, 3, 161, 80, 0, 784, 783, 1, 0, 0, 0, 784, 785, 1, 0, 0, 0, 785, 786, 1, 0, 0, 0, 786, 787, 5, 34, 0, 0, 787, 160, 1, 0, 0, 0, 788, 790, 3, 163, 81, 0, 789, 788, 1, 0, 0, 0, 790, 791, 1, 0, 0, 0, 791, 789, 1, 0, 0, 0, 791, 792, 1, 0, 0, 0, 792, 162, 1, 0, 0, 0, 793, 796, 3, 157, 78, 0, 794, 796, 3, 165, 82, 0, 795, 793, 1, 0, 0, 0, 795, 794, 1, 0, 0, 0, 796, 164, 1, 0, 0, 0, 797, 839, 5, 92, 0, 0, 798, 799, 5, 117, 0, 0, 799, 800, 5, 48, 0, 0, 800, 801, 5, 48, 0, 0, 801, 802, 5, 48, 0, 0, 802, 840, 5, 56, 0, 0, 803, 804, 5, 117, 0, 0, 804, 805, 5, 48, 0, 0, 805, 806, 5, 48, 0, 0, 806, 807, 5, 48, 0, 0, 807, 840, 5, 57, 0, 0, 808, 809, 5, 117, 0, 0, 809, 810, 5, 48, 0, 0, 810, 811, 5, 48, 0, 0, 811, 812, 5, 48, 0, 0, 812, 840, 5, 97, 0, 0, 813, 814, 5, 117, 0, 0, 814, 815, 5, 48, 0, 0, 815, 816, 5, 48, 0, 0, 816, 817, 5, 48, 0, 0, 817, 840, 5, 99, 0, 0, 818, 819, 5, 117, 0, 0, 819, 820, 5, 48, 0, 0, 820, 821, 5, 48, 0, 0, 821, 822, 5, 48, 0, 0, 822, 840, 5, 100, 0, 0, 823, 824, 5, 117, 0, 0, 824, 825, 5, 48, 0, 0, 825, 826, 5, 48, 0, 0, 826, 827, 5, 50, 0, 0, 827, 840, 5, 50, 0, 0, 828, 829, 5, 117, 0, 0, 829, 830, 5, 48, 0, 0, 830, 831, 5, 48, 0, 0, 831, 832, 5, 50, 0, 0, 832, 840, 5, 55, 0, 0, 833, 834, 5, 117, 0, 0, 834, 835, 5, 48, 0, 0, 835, 836, 5, 48, 0, 0, 836, 837, 5, 53, 0, 0, 837, 840, 5, 99, 0, 0, 838, 840, 3, 167, 83, 0, 839, 798, 1, 0, 0, 0, 839, 803, 1, 0, 0, 0, 839, 808, 1, 0, 0, 0, 839, 813, 1, 0, 0, 0, 839, 818, 1, 0, 0, 0, 839, 823, 1, 0, 0, 0, 839, 828, 1, 0, 0, 0, 839, 833, 1, 0, 0, 0, 839, 838, 1, 0, 0, 0, 840, 166, 1, 0, 0, 0, 841, 842, 5, 92, 0, 0, 842, 853, 3, 173, 86, 0, 843, 844, 5, 92, 0, 0, 844, 845, 3, 173, 86, 0, 845, 846, 3, 173, 86, 0, 846, 853, 1, 0, 0, 0, 847, 848, 5, 92, 0, 0, 848, 849, 3, 175, 87, 0, 849, 850, 3, 173, 86, 0, 850, 851, 3, 173, 86, 0, 851, 853, 1, 0, 0, 0, 852, 841, 1, 0, 0, 0, 852, 843, 1, 0, 0, 0, 852, 847, 1, 0, 0, 0, 853, 168, 1, 0, 0, 0, 854, 855, 5, 48, 0, 0, 855, 856, 3, 171, 85, 0, 856, 170, 1, 0, 0, 0, 857, 858, 3, 173, 86, 0, 858, 172, 1, 0, 0, 0, 859, 860, 7, 11, 0, 0, 860, 174, 1, 0, 0, 0, 861, 862, 7, 12, 0, 0, 862, 176, 1, 0, 0, 0, 863, 864, 5, 116, 0, 0, 864, 865, 5, 114, 0, 0, 865, 866, 5, 117, 0, 0, 866, 873, 5, 101, 0, 0, 867, 868, 5, 102, 0, 0, 868, 869, 5, 97, 0, 0, 869, 870, 5, 108, 0, 0, 870, 871, 5, 115, 0, 0, 871, 873, 5, 101, 0, 0, 872, 863, 1, 0, 0, 0, 872, 867, 1, 0, 0, 0, 873, 178, 1, 0, 0, 0, 874, 875, 5, 110, 0, 0, 875, 876, 5, 117, 0, 0, 876, 877, 5, 108, 0, 0, 877, 878, 5, 108, 0, 0, 878, 180, 1, 0, 0, 0, 879, 880, 5, 40, 0, 0, 880, 182, 1, 0, 0, 0, 881, 882, 5, 41, 0, 0, 882, 184, 1, 0, 0, 0, 883, 884, 5, 123, 0, 0, 884, 186, 1, 0, 0, 0, 885, 886, 5, 125, 0, 0, 886, 188, 1, 0, 0, 0, 887, 888, 5, 91, 0, 0, 888, 190, 1, 0, 0, 0, 889, 890, 5, 93, 0, 0, 890, 192, 1, 0, 0, 0, 891, 892, 5, 59, 0, 0, 892, 194, 1, 0, 0, 0, 893, 894, 5, 44, 0, 0, 894, 196, 1, 0, 0, 0, 895, 896, 5, 62, 0, 0, 896, 897, 5, 62, 0, 0, 897, 898, 5, 62, 0, 0, 898, 899, 5, 61, 0, 0, 899, 198, 1, 0, 0, 0, 900, 901, 5, 61, 0, 0, 901, 902, 5, 61, 0, 0, 902, 200, 1, 0, 0, 0, 903, 904, 5, 33, 0, 0, 904, 905, 5, 61, 0, 0, 905, 202, 1, 0, 0, 0, 906, 907, 5, 60, 0, 0, 907, 908, 5, 61, 0, 0, 908, 204, 1, 0, 0, 0, 909, 910, 5, 62, 0, 0, 910, 911, 5, 61, 0, 0, 911, 206, 1, 0, 0, 0, 912, 913, 5, 38, 0, 0, 913, 914, 5, 38, 0, 0, 914, 208, 1, 0, 0, 0, 915, 916, 5, 124, 0, 0, 916, 917, 5, 124, 0, 0, 917, 210, 1, 0, 0, 0, 918, 919, 5, 43, 0, 0, 919, 920, 5, 43, 0, 0, 920, 212, 1, 0, 0, 0, 921, 922, 5, 45, 0, 0, 922, 923, 5, 45, 0, 0, 923, 214, 1, 0, 0, 0, 924, 925, 5, 60, 0, 0, 925, 926, 5, 60, 0, 0, 926, 216, 1, 0, 0, 0, 927, 928, 5, 62, 0, 0, 928, 929, 5, 62, 0, 0, 929, 218, 1, 0, 0, 0, 930, 931, 5, 62, 0, 0, 931, 932, 5, 62, 0, 0, 932, 933, 5, 62, 0, 0, 933, 220, 1, 0, 0, 0, 934, 935, 5, 43, 0, 0, 935, 936, 5, 61, 0, 0, 936, 222, 1, 0, 0, 0, 937, 938, 5, 45, 0, 0, 938, 939, 5, 61, 0, 0, 939, 224, 1, 0, 0, 0, 940, 941, 5, 42, 0, 0, 941, 942, 5, 61, 0, 0, 942, 226, 1, 0, 0, 0, 943, 944, 5, 47, 0, 0, 944, 945, 5, 61, 0, 0, 945, 228, 1, 0, 0, 0, 946, 947, 5, 38, 0, 0, 947, 948, 5, 61, 0, 0, 948, 230, 1, 0, 0, 0, 949, 950, 5, 124, 0, 0, 950, 951, 5, 61, 0, 0, 951, 232, 1, 0, 0, 0, 952, 953, 5, 94, 0, 0, 953, 954, 5, 61, 0, 0, 954, 234, 1, 0, 0, 0, 955, 956, 5, 37, 0, 0, 956, 957, 5, 61, 0, 0, 957, 236, 1, 0, 0, 0, 958, 959, 5, 60, 0, 0, 959, 960, 5, 60, 0, 0, 960, 961, 5, 61, 0, 0, 961, 238, 1, 0, 0, 0, 962, 963, 5, 62, 0, 0, 963, 964, 5, 62, 0, 0, 964, 965, 5, 61, 0, 0, 965, 240, 1, 0, 0, 0, 966, 967, 5, 61, 0, 0, 967, 242, 1, 0, 0, 0, 968, 969, 5, 126, 0, 0, 969, 244, 1, 0, 0, 0, 970, 971, 5, 60, 0, 0, 971, 246, 1, 0, 0, 0, 972, 973, 5, 62, 0, 0, 973, 248, 1, 0, 0, 0, 974, 975, 5, 33, 0, 0, 975, 250, 1, 0, 0, 0, 976, 977, 5, 63, 0, 0, 977, 252, 1, 0, 0, 0, 978, 979, 5, 58, 0, 0, 979, 254, 1, 0, 0, 0, 980, 981, 5, 43, 0, 0, 981, 256, 1, 0, 0, 0, 982, 983, 5, 45, 0, 0, 983, 258, 1, 0, 0, 0, 984, 985, 5, 42, 0, 0, 985, 260, 1, 0, 0, 0, 986, 987, 5, 47, 0, 0, 987, 262, 1, 0, 0, 0, 988, 989, 5, 38, 0, 0, 989, 264, 1, 0, 0, 0, 990, 991, 5, 124, 0, 0, 991, 266, 1, 0, 0, 0, 992, 993, 5, 94, 0, 0, 993, 268, 1, 0, 0, 0, 994, 995, 5, 37, 0, 0, 995, 270, 1, 0, 0, 0, 996, 1000, 3, 273, 136, 0, 997, 999, 3, 275, 137, 0, 998, 997, 1, 0, 0, 0, 999, 1002, 1, 0, 0, 0, 1000, 998, 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 272, 1, 0, 0, 0, 1002, 1000, 1, 0, 0, 0, 1003, 1004, 7, 13, 0, 0, 1004, 274, 1, 0, 0, 0, 1005, 1006, 7, 14, 0, 0, 1006, 276, 1, 0, 0, 0, 38, 0, 279, 282, 286, 296, 300, 304, 317, 325, 329, 333, 674, 678, 682, 686, 693, 695, 703, 709, 716, 719, 722, 727, 730, 735, 739, 743, 751, 758, 762, 778, 784, 791, 795, 839, 852, 872, 1000, 1, 6, 0, 0] \ No newline at end of file diff --git a/Assignment-1/ExprLexer.java b/Assignment-1/ExprLexer.java new file mode 100644 index 0000000..1c08baa --- /dev/null +++ b/Assignment-1/ExprLexer.java @@ -0,0 +1,795 @@ +// Generated from ExprLexer.g4 by ANTLR 4.13.2 +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) +public class ExprLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + WhiteSpace=1, Comment=2, Abstract=3, Assert=4, Boolean=5, Break=6, Byte=7, + Case=8, Catch=9, Char=10, Class=11, Const=12, Continue=13, Default=14, + Do=15, Double=16, Else=17, Extends=18, Final=19, Finally=20, Float=21, + For=22, Goto=23, If=24, Implements=25, Import=26, InstanceOf=27, Int=28, + Interface=29, Long=30, Native=31, New=32, Package=33, Private=34, Protected=35, + Public=36, Return=37, Short=38, Static=39, Strictfp=40, Super=41, Switch=42, + Synchronized=43, This=44, Throw=45, Throws=46, Transient=47, Try=48, Void=49, + Volatile=50, While=51, Dot=52, IntegerLiteral=53, FloatingPointLiteral=54, + CharacterLiteral=55, StringLiteral=56, BooleanLiteral=57, NullLiteral=58, + ParenthesesLeft=59, ParenthesesRight=60, CurlyBracketLeft=61, CurlyBracketRight=62, + SquareBracketLeft=63, SquareBracketRight=64, Semicolon=65, Comma=66, UnsignedRightShiftAssign=67, + EqualTo=68, NotEqualTo=69, LessThanEqualTo=70, GreaterThanEqualTo=71, + ConditionalAND=72, ConditionalOR=73, Increment=74, Decrement=75, LeftShift=76, + SignedRightShift=77, UnsignedRightShift=78, AddAssign=79, SubtractAssign=80, + MultiplyAssign=81, DivideAssign=82, BitwiseANDAssign=83, BitwiseORAssign=84, + BitwiseXORAssign=85, RemainderAssign=86, LeftShiftAssign=87, SignedRightShiftAssign=88, + Assignment=89, BitwiseComplement=90, LessThan=91, GreaterThan=92, LogicalComplement=93, + Question=94, Colon=95, Addition=96, Subtraction=97, Multiplication=98, + Division=99, BitwiseAND=100, BitwiseOR=101, BitwiseXOR=102, Remainder=103, + IDENTIFIER=104; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "LineTerminator", "WhiteSpace", "EndOfLineComment", "Comment", "TraditionalComment", + "CommentTail", "CommentTailStar", "NotStar", "NotStarNotSlash", "Abstract", + "Assert", "Boolean", "Break", "Byte", "Case", "Catch", "Char", "Class", + "Const", "Continue", "Default", "Do", "Double", "Else", "Extends", "Final", + "Finally", "Float", "For", "Goto", "If", "Implements", "Import", "InstanceOf", + "Int", "Interface", "Long", "Native", "New", "Package", "Private", "Protected", + "Public", "Return", "Short", "Static", "Strictfp", "Super", "Switch", + "Synchronized", "This", "Throw", "Throws", "Transient", "Try", "Void", + "Volatile", "While", "Dot", "IntegerLiteral", "DecimalIntegerLiteral", + "HexIntegerLiteral", "OctalIntegerLiteral", "IntegerTypeSuffix", "DecimalNumeral", + "HexNumeral", "HexDigits", "HexDigit", "FloatingPointLiteral", "ExponentPart", + "ExponentIndicator", "SignedInteger", "Digits", "Digit", "NonZeroDigit", + "Sign", "FloatTypeSuffix", "CharacterLiteral", "SingleCharacter", "StringLiteral", + "StringCharacters", "StringCharacter", "EscapeSequence", "OctalEscape", + "OctalNumeral", "OctalDigits", "OctalDigit", "ZeroToThree", "BooleanLiteral", + "NullLiteral", "ParenthesesLeft", "ParenthesesRight", "CurlyBracketLeft", + "CurlyBracketRight", "SquareBracketLeft", "SquareBracketRight", "Semicolon", + "Comma", "UnsignedRightShiftAssign", "EqualTo", "NotEqualTo", "LessThanEqualTo", + "GreaterThanEqualTo", "ConditionalAND", "ConditionalOR", "Increment", + "Decrement", "LeftShift", "SignedRightShift", "UnsignedRightShift", "AddAssign", + "SubtractAssign", "MultiplyAssign", "DivideAssign", "BitwiseANDAssign", + "BitwiseORAssign", "BitwiseXORAssign", "RemainderAssign", "LeftShiftAssign", + "SignedRightShiftAssign", "Assignment", "BitwiseComplement", "LessThan", + "GreaterThan", "LogicalComplement", "Question", "Colon", "Addition", + "Subtraction", "Multiplication", "Division", "BitwiseAND", "BitwiseOR", + "BitwiseXOR", "Remainder", "IDENTIFIER", "JavaLetter", "JavaLetterOrDigit" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, null, null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", + "'case'", "'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'", + "'do'", "'double'", "'else'", "'extends'", "'final'", "'finally'", "'float'", + "'for'", "'goto'", "'if'", "'implements'", "'import'", "'instanceof'", + "'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'", + "'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'", + "'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'", + "'transient'", "'try'", "'void'", "'volatile'", "'while'", "'.'", null, + null, null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", + "']'", "';'", "','", "'>>>='", "'=='", "'!='", "'<='", "'>='", "'&&'", + "'||'", "'++'", "'--'", "'<<'", "'>>'", "'>>>'", "'+='", "'-='", "'*='", + "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='", "'='", "'~'", + "'<'", "'>'", "'!'", "'?'", "':'", "'+'", "'-'", "'*'", "'/'", "'&'", + "'|'", "'^'", "'%'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "WhiteSpace", "Comment", "Abstract", "Assert", "Boolean", "Break", + "Byte", "Case", "Catch", "Char", "Class", "Const", "Continue", "Default", + "Do", "Double", "Else", "Extends", "Final", "Finally", "Float", "For", + "Goto", "If", "Implements", "Import", "InstanceOf", "Int", "Interface", + "Long", "Native", "New", "Package", "Private", "Protected", "Public", + "Return", "Short", "Static", "Strictfp", "Super", "Switch", "Synchronized", + "This", "Throw", "Throws", "Transient", "Try", "Void", "Volatile", "While", + "Dot", "IntegerLiteral", "FloatingPointLiteral", "CharacterLiteral", + "StringLiteral", "BooleanLiteral", "NullLiteral", "ParenthesesLeft", + "ParenthesesRight", "CurlyBracketLeft", "CurlyBracketRight", "SquareBracketLeft", + "SquareBracketRight", "Semicolon", "Comma", "UnsignedRightShiftAssign", + "EqualTo", "NotEqualTo", "LessThanEqualTo", "GreaterThanEqualTo", "ConditionalAND", + "ConditionalOR", "Increment", "Decrement", "LeftShift", "SignedRightShift", + "UnsignedRightShift", "AddAssign", "SubtractAssign", "MultiplyAssign", + "DivideAssign", "BitwiseANDAssign", "BitwiseORAssign", "BitwiseXORAssign", + "RemainderAssign", "LeftShiftAssign", "SignedRightShiftAssign", "Assignment", + "BitwiseComplement", "LessThan", "GreaterThan", "LogicalComplement", + "Question", "Colon", "Addition", "Subtraction", "Multiplication", "Division", + "BitwiseAND", "BitwiseOR", "BitwiseXOR", "Remainder", "IDENTIFIER" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public ExprLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "ExprLexer.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\u0004\u0000h\u03ef\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+ + "\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+ + "\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+ + "\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+ + "\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002"+ + "\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002"+ + "\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002"+ + "\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002"+ + "\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+ + "\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+ + "\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+ + "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007"+ + "&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007"+ + "+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u0007"+ + "0\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u0007"+ + "5\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0002:\u0007"+ + ":\u0002;\u0007;\u0002<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007"+ + "?\u0002@\u0007@\u0002A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007"+ + "D\u0002E\u0007E\u0002F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007"+ + "I\u0002J\u0007J\u0002K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007"+ + "N\u0002O\u0007O\u0002P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007"+ + "S\u0002T\u0007T\u0002U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002X\u0007"+ + "X\u0002Y\u0007Y\u0002Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002]\u0007"+ + "]\u0002^\u0007^\u0002_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002b\u0007"+ + "b\u0002c\u0007c\u0002d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002g\u0007"+ + "g\u0002h\u0007h\u0002i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002l\u0007"+ + "l\u0002m\u0007m\u0002n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002q\u0007"+ + "q\u0002r\u0007r\u0002s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002v\u0007"+ + "v\u0002w\u0007w\u0002x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002{\u0007"+ + "{\u0002|\u0007|\u0002}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f\u0002"+ + "\u0080\u0007\u0080\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082\u0002"+ + "\u0083\u0007\u0083\u0002\u0084\u0007\u0084\u0002\u0085\u0007\u0085\u0002"+ + "\u0086\u0007\u0086\u0002\u0087\u0007\u0087\u0002\u0088\u0007\u0088\u0002"+ + "\u0089\u0007\u0089\u0001\u0000\u0001\u0000\u0003\u0000\u0118\b\u0000\u0001"+ + "\u0000\u0003\u0000\u011b\b\u0000\u0001\u0001\u0001\u0001\u0003\u0001\u011f"+ + "\b\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001"+ + "\u0002\u0005\u0002\u0127\b\u0002\n\u0002\f\u0002\u012a\t\u0002\u0001\u0002"+ + "\u0003\u0002\u012d\b\u0002\u0001\u0003\u0001\u0003\u0003\u0003\u0131\b"+ + "\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001"+ + "\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0003"+ + "\u0005\u013e\b\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ + "\u0006\u0001\u0006\u0003\u0006\u0146\b\u0006\u0001\u0007\u0001\u0007\u0003"+ + "\u0007\u014a\b\u0007\u0001\b\u0001\b\u0003\b\u014e\b\b\u0001\t\u0001\t"+ + "\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001"+ + "\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001"+ + "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+ + "\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ + "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011"+ + "\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012"+ + "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013"+ + "\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013"+ + "\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014"+ + "\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+ + "\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016"+ + "\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017"+ + "\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018"+ + "\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019"+ + "\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001a"+ + "\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b"+ + "\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001c"+ + "\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001d"+ + "\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001f"+ + "\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f"+ + "\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001 "+ + "\u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001!\u0001!\u0001!\u0001"+ + "!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001\"\u0001\"\u0001\"\u0001\"\u0001"+ + "#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001"+ + "$\u0001$\u0001$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001%\u0001%\u0001"+ + "%\u0001%\u0001&\u0001&\u0001&\u0001&\u0001\'\u0001\'\u0001\'\u0001\'\u0001"+ + "\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001(\u0001(\u0001(\u0001"+ + "(\u0001(\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001"+ + ")\u0001)\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001+\u0001"+ + "+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001,\u0001,\u0001"+ + ",\u0001,\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001.\u0001"+ + ".\u0001.\u0001.\u0001.\u0001.\u0001.\u0001.\u0001.\u0001/\u0001/\u0001"+ + "/\u0001/\u0001/\u0001/\u00010\u00010\u00010\u00010\u00010\u00010\u0001"+ + "0\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u0001"+ + "1\u00011\u00011\u00011\u00012\u00012\u00012\u00012\u00012\u00013\u0001"+ + "3\u00013\u00013\u00013\u00013\u00014\u00014\u00014\u00014\u00014\u0001"+ + "4\u00014\u00015\u00015\u00015\u00015\u00015\u00015\u00015\u00015\u0001"+ + "5\u00015\u00016\u00016\u00016\u00016\u00017\u00017\u00017\u00017\u0001"+ + "7\u00018\u00018\u00018\u00018\u00018\u00018\u00018\u00018\u00018\u0001"+ + "9\u00019\u00019\u00019\u00019\u00019\u0001:\u0001:\u0001;\u0001;\u0001"+ + ";\u0003;\u02a3\b;\u0001<\u0001<\u0003<\u02a7\b<\u0001=\u0001=\u0003=\u02ab"+ + "\b=\u0001>\u0001>\u0003>\u02af\b>\u0001?\u0001?\u0001@\u0001@\u0001@\u0003"+ + "@\u02b6\b@\u0003@\u02b8\b@\u0001A\u0001A\u0001A\u0001A\u0001A\u0001A\u0003"+ + "A\u02c0\bA\u0001B\u0001B\u0001B\u0001B\u0003B\u02c6\bB\u0001C\u0001C\u0001"+ + "D\u0001D\u0001D\u0003D\u02cd\bD\u0001D\u0003D\u02d0\bD\u0001D\u0003D\u02d3"+ + "\bD\u0001D\u0001D\u0001D\u0003D\u02d8\bD\u0001D\u0003D\u02db\bD\u0001"+ + "D\u0001D\u0001D\u0003D\u02e0\bD\u0001D\u0001D\u0003D\u02e4\bD\u0001D\u0001"+ + "D\u0003D\u02e8\bD\u0001E\u0001E\u0001E\u0001F\u0001F\u0001G\u0003G\u02f0"+ + "\bG\u0001G\u0001G\u0001H\u0004H\u02f5\bH\u000bH\fH\u02f6\u0001I\u0001"+ + "I\u0003I\u02fb\bI\u0001J\u0001J\u0001K\u0001K\u0001L\u0001L\u0001M\u0001"+ + "M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0003M\u030b\bM\u0001N\u0001"+ + "N\u0001O\u0001O\u0003O\u0311\bO\u0001O\u0001O\u0001P\u0004P\u0316\bP\u000b"+ + "P\fP\u0317\u0001Q\u0001Q\u0003Q\u031c\bQ\u0001R\u0001R\u0001R\u0001R\u0001"+ + "R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001"+ + "R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001"+ + "R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001"+ + "R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0003R\u0348\bR\u0001"+ + "S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001"+ + "S\u0003S\u0355\bS\u0001T\u0001T\u0001T\u0001U\u0001U\u0001V\u0001V\u0001"+ + "W\u0001W\u0001X\u0001X\u0001X\u0001X\u0001X\u0001X\u0001X\u0001X\u0001"+ + "X\u0003X\u0369\bX\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Z\u0001Z\u0001"+ + "[\u0001[\u0001\\\u0001\\\u0001]\u0001]\u0001^\u0001^\u0001_\u0001_\u0001"+ + "`\u0001`\u0001a\u0001a\u0001b\u0001b\u0001b\u0001b\u0001b\u0001c\u0001"+ + "c\u0001c\u0001d\u0001d\u0001d\u0001e\u0001e\u0001e\u0001f\u0001f\u0001"+ + "f\u0001g\u0001g\u0001g\u0001h\u0001h\u0001h\u0001i\u0001i\u0001i\u0001"+ + "j\u0001j\u0001j\u0001k\u0001k\u0001k\u0001l\u0001l\u0001l\u0001m\u0001"+ + "m\u0001m\u0001m\u0001n\u0001n\u0001n\u0001o\u0001o\u0001o\u0001p\u0001"+ + "p\u0001p\u0001q\u0001q\u0001q\u0001r\u0001r\u0001r\u0001s\u0001s\u0001"+ + "s\u0001t\u0001t\u0001t\u0001u\u0001u\u0001u\u0001v\u0001v\u0001v\u0001"+ + "v\u0001w\u0001w\u0001w\u0001w\u0001x\u0001x\u0001y\u0001y\u0001z\u0001"+ + "z\u0001{\u0001{\u0001|\u0001|\u0001}\u0001}\u0001~\u0001~\u0001\u007f"+ + "\u0001\u007f\u0001\u0080\u0001\u0080\u0001\u0081\u0001\u0081\u0001\u0082"+ + "\u0001\u0082\u0001\u0083\u0001\u0083\u0001\u0084\u0001\u0084\u0001\u0085"+ + "\u0001\u0085\u0001\u0086\u0001\u0086\u0001\u0087\u0001\u0087\u0005\u0087"+ + "\u03e7\b\u0087\n\u0087\f\u0087\u03ea\t\u0087\u0001\u0088\u0001\u0088\u0001"+ + "\u0089\u0001\u0089\u0000\u0000\u008a\u0001\u0000\u0003\u0001\u0005\u0000"+ + "\u0007\u0002\t\u0000\u000b\u0000\r\u0000\u000f\u0000\u0011\u0000\u0013"+ + "\u0003\u0015\u0004\u0017\u0005\u0019\u0006\u001b\u0007\u001d\b\u001f\t"+ + "!\n#\u000b%\f\'\r)\u000e+\u000f-\u0010/\u00111\u00123\u00135\u00147\u0015"+ + "9\u0016;\u0017=\u0018?\u0019A\u001aC\u001bE\u001cG\u001dI\u001eK\u001f"+ + "M O!Q\"S#U$W%Y&[\'](_)a*c+e,g-i.k/m0o1q2s3u4w5y\u0000{\u0000}\u0000\u007f"+ + "\u0000\u0081\u0000\u0083\u0000\u0085\u0000\u0087\u0000\u00896\u008b\u0000"+ + "\u008d\u0000\u008f\u0000\u0091\u0000\u0093\u0000\u0095\u0000\u0097\u0000"+ + "\u0099\u0000\u009b7\u009d\u0000\u009f8\u00a1\u0000\u00a3\u0000\u00a5\u0000"+ + "\u00a7\u0000\u00a9\u0000\u00ab\u0000\u00ad\u0000\u00af\u0000\u00b19\u00b3"+ + ":\u00b5;\u00b7<\u00b9=\u00bb>\u00bd?\u00bf@\u00c1A\u00c3B\u00c5C\u00c7"+ + "D\u00c9E\u00cbF\u00cdG\u00cfH\u00d1I\u00d3J\u00d5K\u00d7L\u00d9M\u00db"+ + "N\u00ddO\u00dfP\u00e1Q\u00e3R\u00e5S\u00e7T\u00e9U\u00ebV\u00edW\u00ef"+ + "X\u00f1Y\u00f3Z\u00f5[\u00f7\\\u00f9]\u00fb^\u00fd_\u00ff`\u0101a\u0103"+ + "b\u0105c\u0107d\u0109e\u010bf\u010dg\u010fh\u0111\u0000\u0113\u0000\u0001"+ + "\u0000\u000f\u0003\u0000\t\t\f\f \u0002\u0000\n\n\r\r\u0002\u0000**^"+ + "^\u0003\u0000**//^^\u0002\u0000LLll\u0003\u000009AFaf\u0002\u0000EEee"+ + "\u0001\u000019\u0002\u0000++--\u0004\u0000DDFFddff\u0003\u0000\'\'\\\\"+ + "^^\u0001\u000007\u0001\u000003\u0004\u0000$$AZ__az\u0005\u0000$$09AZ_"+ + "_az\u03fd\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000"+ + "\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000"+ + "\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000"+ + "\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000"+ + "\u0000\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000"+ + "\u0000\u0000#\u0001\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000"+ + "\'\u0001\u0000\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001"+ + "\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000"+ + "\u0000\u00001\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u0000"+ + "5\u0001\u0000\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001"+ + "\u0000\u0000\u0000\u0000;\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000"+ + "\u0000\u0000?\u0001\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000"+ + "C\u0001\u0000\u0000\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001"+ + "\u0000\u0000\u0000\u0000I\u0001\u0000\u0000\u0000\u0000K\u0001\u0000\u0000"+ + "\u0000\u0000M\u0001\u0000\u0000\u0000\u0000O\u0001\u0000\u0000\u0000\u0000"+ + "Q\u0001\u0000\u0000\u0000\u0000S\u0001\u0000\u0000\u0000\u0000U\u0001"+ + "\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000Y\u0001\u0000\u0000"+ + "\u0000\u0000[\u0001\u0000\u0000\u0000\u0000]\u0001\u0000\u0000\u0000\u0000"+ + "_\u0001\u0000\u0000\u0000\u0000a\u0001\u0000\u0000\u0000\u0000c\u0001"+ + "\u0000\u0000\u0000\u0000e\u0001\u0000\u0000\u0000\u0000g\u0001\u0000\u0000"+ + "\u0000\u0000i\u0001\u0000\u0000\u0000\u0000k\u0001\u0000\u0000\u0000\u0000"+ + "m\u0001\u0000\u0000\u0000\u0000o\u0001\u0000\u0000\u0000\u0000q\u0001"+ + "\u0000\u0000\u0000\u0000s\u0001\u0000\u0000\u0000\u0000u\u0001\u0000\u0000"+ + "\u0000\u0000w\u0001\u0000\u0000\u0000\u0000\u0089\u0001\u0000\u0000\u0000"+ + "\u0000\u009b\u0001\u0000\u0000\u0000\u0000\u009f\u0001\u0000\u0000\u0000"+ + "\u0000\u00b1\u0001\u0000\u0000\u0000\u0000\u00b3\u0001\u0000\u0000\u0000"+ + "\u0000\u00b5\u0001\u0000\u0000\u0000\u0000\u00b7\u0001\u0000\u0000\u0000"+ + "\u0000\u00b9\u0001\u0000\u0000\u0000\u0000\u00bb\u0001\u0000\u0000\u0000"+ + "\u0000\u00bd\u0001\u0000\u0000\u0000\u0000\u00bf\u0001\u0000\u0000\u0000"+ + "\u0000\u00c1\u0001\u0000\u0000\u0000\u0000\u00c3\u0001\u0000\u0000\u0000"+ + "\u0000\u00c5\u0001\u0000\u0000\u0000\u0000\u00c7\u0001\u0000\u0000\u0000"+ + "\u0000\u00c9\u0001\u0000\u0000\u0000\u0000\u00cb\u0001\u0000\u0000\u0000"+ + "\u0000\u00cd\u0001\u0000\u0000\u0000\u0000\u00cf\u0001\u0000\u0000\u0000"+ + "\u0000\u00d1\u0001\u0000\u0000\u0000\u0000\u00d3\u0001\u0000\u0000\u0000"+ + "\u0000\u00d5\u0001\u0000\u0000\u0000\u0000\u00d7\u0001\u0000\u0000\u0000"+ + "\u0000\u00d9\u0001\u0000\u0000\u0000\u0000\u00db\u0001\u0000\u0000\u0000"+ + "\u0000\u00dd\u0001\u0000\u0000\u0000\u0000\u00df\u0001\u0000\u0000\u0000"+ + "\u0000\u00e1\u0001\u0000\u0000\u0000\u0000\u00e3\u0001\u0000\u0000\u0000"+ + "\u0000\u00e5\u0001\u0000\u0000\u0000\u0000\u00e7\u0001\u0000\u0000\u0000"+ + "\u0000\u00e9\u0001\u0000\u0000\u0000\u0000\u00eb\u0001\u0000\u0000\u0000"+ + "\u0000\u00ed\u0001\u0000\u0000\u0000\u0000\u00ef\u0001\u0000\u0000\u0000"+ + "\u0000\u00f1\u0001\u0000\u0000\u0000\u0000\u00f3\u0001\u0000\u0000\u0000"+ + "\u0000\u00f5\u0001\u0000\u0000\u0000\u0000\u00f7\u0001\u0000\u0000\u0000"+ + "\u0000\u00f9\u0001\u0000\u0000\u0000\u0000\u00fb\u0001\u0000\u0000\u0000"+ + "\u0000\u00fd\u0001\u0000\u0000\u0000\u0000\u00ff\u0001\u0000\u0000\u0000"+ + "\u0000\u0101\u0001\u0000\u0000\u0000\u0000\u0103\u0001\u0000\u0000\u0000"+ + "\u0000\u0105\u0001\u0000\u0000\u0000\u0000\u0107\u0001\u0000\u0000\u0000"+ + "\u0000\u0109\u0001\u0000\u0000\u0000\u0000\u010b\u0001\u0000\u0000\u0000"+ + "\u0000\u010d\u0001\u0000\u0000\u0000\u0000\u010f\u0001\u0000\u0000\u0000"+ + "\u0001\u011a\u0001\u0000\u0000\u0000\u0003\u011e\u0001\u0000\u0000\u0000"+ + "\u0005\u0122\u0001\u0000\u0000\u0000\u0007\u0130\u0001\u0000\u0000\u0000"+ + "\t\u0134\u0001\u0000\u0000\u0000\u000b\u013d\u0001\u0000\u0000\u0000\r"+ + "\u0145\u0001\u0000\u0000\u0000\u000f\u0149\u0001\u0000\u0000\u0000\u0011"+ + "\u014d\u0001\u0000\u0000\u0000\u0013\u014f\u0001\u0000\u0000\u0000\u0015"+ + "\u0158\u0001\u0000\u0000\u0000\u0017\u015f\u0001\u0000\u0000\u0000\u0019"+ + "\u0167\u0001\u0000\u0000\u0000\u001b\u016d\u0001\u0000\u0000\u0000\u001d"+ + "\u0172\u0001\u0000\u0000\u0000\u001f\u0177\u0001\u0000\u0000\u0000!\u017d"+ + "\u0001\u0000\u0000\u0000#\u0182\u0001\u0000\u0000\u0000%\u0188\u0001\u0000"+ + "\u0000\u0000\'\u018e\u0001\u0000\u0000\u0000)\u0197\u0001\u0000\u0000"+ + "\u0000+\u019f\u0001\u0000\u0000\u0000-\u01a2\u0001\u0000\u0000\u0000/"+ + "\u01a9\u0001\u0000\u0000\u00001\u01ae\u0001\u0000\u0000\u00003\u01b6\u0001"+ + "\u0000\u0000\u00005\u01bc\u0001\u0000\u0000\u00007\u01c4\u0001\u0000\u0000"+ + "\u00009\u01ca\u0001\u0000\u0000\u0000;\u01ce\u0001\u0000\u0000\u0000="+ + "\u01d3\u0001\u0000\u0000\u0000?\u01d6\u0001\u0000\u0000\u0000A\u01e1\u0001"+ + "\u0000\u0000\u0000C\u01e8\u0001\u0000\u0000\u0000E\u01f3\u0001\u0000\u0000"+ + "\u0000G\u01f7\u0001\u0000\u0000\u0000I\u0201\u0001\u0000\u0000\u0000K"+ + "\u0206\u0001\u0000\u0000\u0000M\u020d\u0001\u0000\u0000\u0000O\u0211\u0001"+ + "\u0000\u0000\u0000Q\u0219\u0001\u0000\u0000\u0000S\u0221\u0001\u0000\u0000"+ + "\u0000U\u022b\u0001\u0000\u0000\u0000W\u0232\u0001\u0000\u0000\u0000Y"+ + "\u0239\u0001\u0000\u0000\u0000[\u023f\u0001\u0000\u0000\u0000]\u0246\u0001"+ + "\u0000\u0000\u0000_\u024f\u0001\u0000\u0000\u0000a\u0255\u0001\u0000\u0000"+ + "\u0000c\u025c\u0001\u0000\u0000\u0000e\u0269\u0001\u0000\u0000\u0000g"+ + "\u026e\u0001\u0000\u0000\u0000i\u0274\u0001\u0000\u0000\u0000k\u027b\u0001"+ + "\u0000\u0000\u0000m\u0285\u0001\u0000\u0000\u0000o\u0289\u0001\u0000\u0000"+ + "\u0000q\u028e\u0001\u0000\u0000\u0000s\u0297\u0001\u0000\u0000\u0000u"+ + "\u029d\u0001\u0000\u0000\u0000w\u02a2\u0001\u0000\u0000\u0000y\u02a4\u0001"+ + "\u0000\u0000\u0000{\u02a8\u0001\u0000\u0000\u0000}\u02ac\u0001\u0000\u0000"+ + "\u0000\u007f\u02b0\u0001\u0000\u0000\u0000\u0081\u02b7\u0001\u0000\u0000"+ + "\u0000\u0083\u02bf\u0001\u0000\u0000\u0000\u0085\u02c5\u0001\u0000\u0000"+ + "\u0000\u0087\u02c7\u0001\u0000\u0000\u0000\u0089\u02e7\u0001\u0000\u0000"+ + "\u0000\u008b\u02e9\u0001\u0000\u0000\u0000\u008d\u02ec\u0001\u0000\u0000"+ + "\u0000\u008f\u02ef\u0001\u0000\u0000\u0000\u0091\u02f4\u0001\u0000\u0000"+ + "\u0000\u0093\u02fa\u0001\u0000\u0000\u0000\u0095\u02fc\u0001\u0000\u0000"+ + "\u0000\u0097\u02fe\u0001\u0000\u0000\u0000\u0099\u0300\u0001\u0000\u0000"+ + "\u0000\u009b\u030a\u0001\u0000\u0000\u0000\u009d\u030c\u0001\u0000\u0000"+ + "\u0000\u009f\u030e\u0001\u0000\u0000\u0000\u00a1\u0315\u0001\u0000\u0000"+ + "\u0000\u00a3\u031b\u0001\u0000\u0000\u0000\u00a5\u031d\u0001\u0000\u0000"+ + "\u0000\u00a7\u0354\u0001\u0000\u0000\u0000\u00a9\u0356\u0001\u0000\u0000"+ + "\u0000\u00ab\u0359\u0001\u0000\u0000\u0000\u00ad\u035b\u0001\u0000\u0000"+ + "\u0000\u00af\u035d\u0001\u0000\u0000\u0000\u00b1\u0368\u0001\u0000\u0000"+ + "\u0000\u00b3\u036a\u0001\u0000\u0000\u0000\u00b5\u036f\u0001\u0000\u0000"+ + "\u0000\u00b7\u0371\u0001\u0000\u0000\u0000\u00b9\u0373\u0001\u0000\u0000"+ + "\u0000\u00bb\u0375\u0001\u0000\u0000\u0000\u00bd\u0377\u0001\u0000\u0000"+ + "\u0000\u00bf\u0379\u0001\u0000\u0000\u0000\u00c1\u037b\u0001\u0000\u0000"+ + "\u0000\u00c3\u037d\u0001\u0000\u0000\u0000\u00c5\u037f\u0001\u0000\u0000"+ + "\u0000\u00c7\u0384\u0001\u0000\u0000\u0000\u00c9\u0387\u0001\u0000\u0000"+ + "\u0000\u00cb\u038a\u0001\u0000\u0000\u0000\u00cd\u038d\u0001\u0000\u0000"+ + "\u0000\u00cf\u0390\u0001\u0000\u0000\u0000\u00d1\u0393\u0001\u0000\u0000"+ + "\u0000\u00d3\u0396\u0001\u0000\u0000\u0000\u00d5\u0399\u0001\u0000\u0000"+ + "\u0000\u00d7\u039c\u0001\u0000\u0000\u0000\u00d9\u039f\u0001\u0000\u0000"+ + "\u0000\u00db\u03a2\u0001\u0000\u0000\u0000\u00dd\u03a6\u0001\u0000\u0000"+ + "\u0000\u00df\u03a9\u0001\u0000\u0000\u0000\u00e1\u03ac\u0001\u0000\u0000"+ + "\u0000\u00e3\u03af\u0001\u0000\u0000\u0000\u00e5\u03b2\u0001\u0000\u0000"+ + "\u0000\u00e7\u03b5\u0001\u0000\u0000\u0000\u00e9\u03b8\u0001\u0000\u0000"+ + "\u0000\u00eb\u03bb\u0001\u0000\u0000\u0000\u00ed\u03be\u0001\u0000\u0000"+ + "\u0000\u00ef\u03c2\u0001\u0000\u0000\u0000\u00f1\u03c6\u0001\u0000\u0000"+ + "\u0000\u00f3\u03c8\u0001\u0000\u0000\u0000\u00f5\u03ca\u0001\u0000\u0000"+ + "\u0000\u00f7\u03cc\u0001\u0000\u0000\u0000\u00f9\u03ce\u0001\u0000\u0000"+ + "\u0000\u00fb\u03d0\u0001\u0000\u0000\u0000\u00fd\u03d2\u0001\u0000\u0000"+ + "\u0000\u00ff\u03d4\u0001\u0000\u0000\u0000\u0101\u03d6\u0001\u0000\u0000"+ + "\u0000\u0103\u03d8\u0001\u0000\u0000\u0000\u0105\u03da\u0001\u0000\u0000"+ + "\u0000\u0107\u03dc\u0001\u0000\u0000\u0000\u0109\u03de\u0001\u0000\u0000"+ + "\u0000\u010b\u03e0\u0001\u0000\u0000\u0000\u010d\u03e2\u0001\u0000\u0000"+ + "\u0000\u010f\u03e4\u0001\u0000\u0000\u0000\u0111\u03eb\u0001\u0000\u0000"+ + "\u0000\u0113\u03ed\u0001\u0000\u0000\u0000\u0115\u0117\u0005\r\u0000\u0000"+ + "\u0116\u0118\u0005\n\u0000\u0000\u0117\u0116\u0001\u0000\u0000\u0000\u0117"+ + "\u0118\u0001\u0000\u0000\u0000\u0118\u011b\u0001\u0000\u0000\u0000\u0119"+ + "\u011b\u0005\n\u0000\u0000\u011a\u0115\u0001\u0000\u0000\u0000\u011a\u0119"+ + "\u0001\u0000\u0000\u0000\u011b\u0002\u0001\u0000\u0000\u0000\u011c\u011f"+ + "\u0007\u0000\u0000\u0000\u011d\u011f\u0003\u0001\u0000\u0000\u011e\u011c"+ + "\u0001\u0000\u0000\u0000\u011e\u011d\u0001\u0000\u0000\u0000\u011f\u0120"+ + "\u0001\u0000\u0000\u0000\u0120\u0121\u0006\u0001\u0000\u0000\u0121\u0004"+ + "\u0001\u0000\u0000\u0000\u0122\u0123\u0005/\u0000\u0000\u0123\u0124\u0005"+ + "/\u0000\u0000\u0124\u0128\u0001\u0000\u0000\u0000\u0125\u0127\b\u0001"+ + "\u0000\u0000\u0126\u0125\u0001\u0000\u0000\u0000\u0127\u012a\u0001\u0000"+ + "\u0000\u0000\u0128\u0126\u0001\u0000\u0000\u0000\u0128\u0129\u0001\u0000"+ + "\u0000\u0000\u0129\u012c\u0001\u0000\u0000\u0000\u012a\u0128\u0001\u0000"+ + "\u0000\u0000\u012b\u012d\u0003\u0001\u0000\u0000\u012c\u012b\u0001\u0000"+ + "\u0000\u0000\u012c\u012d\u0001\u0000\u0000\u0000\u012d\u0006\u0001\u0000"+ + "\u0000\u0000\u012e\u0131\u0003\t\u0004\u0000\u012f\u0131\u0003\u0005\u0002"+ + "\u0000\u0130\u012e\u0001\u0000\u0000\u0000\u0130\u012f\u0001\u0000\u0000"+ + "\u0000\u0131\u0132\u0001\u0000\u0000\u0000\u0132\u0133\u0006\u0003\u0000"+ + "\u0000\u0133\b\u0001\u0000\u0000\u0000\u0134\u0135\u0005/\u0000\u0000"+ + "\u0135\u0136\u0005*\u0000\u0000\u0136\u0137\u0001\u0000\u0000\u0000\u0137"+ + "\u0138\u0003\u000f\u0007\u0000\u0138\u0139\u0003\u000b\u0005\u0000\u0139"+ + "\n\u0001\u0000\u0000\u0000\u013a\u013b\u0005*\u0000\u0000\u013b\u013e"+ + "\u0003\r\u0006\u0000\u013c\u013e\u0003\u000f\u0007\u0000\u013d\u013a\u0001"+ + "\u0000\u0000\u0000\u013d\u013c\u0001\u0000\u0000\u0000\u013e\f\u0001\u0000"+ + "\u0000\u0000\u013f\u0146\u0005/\u0000\u0000\u0140\u0141\u0005*\u0000\u0000"+ + "\u0141\u0146\u0003\r\u0006\u0000\u0142\u0143\u0003\u0011\b\u0000\u0143"+ + "\u0144\u0003\u000b\u0005\u0000\u0144\u0146\u0001\u0000\u0000\u0000\u0145"+ + "\u013f\u0001\u0000\u0000\u0000\u0145\u0140\u0001\u0000\u0000\u0000\u0145"+ + "\u0142\u0001\u0000\u0000\u0000\u0146\u000e\u0001\u0000\u0000\u0000\u0147"+ + "\u014a\u0007\u0002\u0000\u0000\u0148\u014a\u0003\u0001\u0000\u0000\u0149"+ + "\u0147\u0001\u0000\u0000\u0000\u0149\u0148\u0001\u0000\u0000\u0000\u014a"+ + "\u0010\u0001\u0000\u0000\u0000\u014b\u014e\u0007\u0003\u0000\u0000\u014c"+ + "\u014e\u0003\u0001\u0000\u0000\u014d\u014b\u0001\u0000\u0000\u0000\u014d"+ + "\u014c\u0001\u0000\u0000\u0000\u014e\u0012\u0001\u0000\u0000\u0000\u014f"+ + "\u0150\u0005a\u0000\u0000\u0150\u0151\u0005b\u0000\u0000\u0151\u0152\u0005"+ + "s\u0000\u0000\u0152\u0153\u0005t\u0000\u0000\u0153\u0154\u0005r\u0000"+ + "\u0000\u0154\u0155\u0005a\u0000\u0000\u0155\u0156\u0005c\u0000\u0000\u0156"+ + "\u0157\u0005t\u0000\u0000\u0157\u0014\u0001\u0000\u0000\u0000\u0158\u0159"+ + "\u0005a\u0000\u0000\u0159\u015a\u0005s\u0000\u0000\u015a\u015b\u0005s"+ + "\u0000\u0000\u015b\u015c\u0005e\u0000\u0000\u015c\u015d\u0005r\u0000\u0000"+ + "\u015d\u015e\u0005t\u0000\u0000\u015e\u0016\u0001\u0000\u0000\u0000\u015f"+ + "\u0160\u0005b\u0000\u0000\u0160\u0161\u0005o\u0000\u0000\u0161\u0162\u0005"+ + "o\u0000\u0000\u0162\u0163\u0005l\u0000\u0000\u0163\u0164\u0005e\u0000"+ + "\u0000\u0164\u0165\u0005a\u0000\u0000\u0165\u0166\u0005n\u0000\u0000\u0166"+ + "\u0018\u0001\u0000\u0000\u0000\u0167\u0168\u0005b\u0000\u0000\u0168\u0169"+ + "\u0005r\u0000\u0000\u0169\u016a\u0005e\u0000\u0000\u016a\u016b\u0005a"+ + "\u0000\u0000\u016b\u016c\u0005k\u0000\u0000\u016c\u001a\u0001\u0000\u0000"+ + "\u0000\u016d\u016e\u0005b\u0000\u0000\u016e\u016f\u0005y\u0000\u0000\u016f"+ + "\u0170\u0005t\u0000\u0000\u0170\u0171\u0005e\u0000\u0000\u0171\u001c\u0001"+ + "\u0000\u0000\u0000\u0172\u0173\u0005c\u0000\u0000\u0173\u0174\u0005a\u0000"+ + "\u0000\u0174\u0175\u0005s\u0000\u0000\u0175\u0176\u0005e\u0000\u0000\u0176"+ + "\u001e\u0001\u0000\u0000\u0000\u0177\u0178\u0005c\u0000\u0000\u0178\u0179"+ + "\u0005a\u0000\u0000\u0179\u017a\u0005t\u0000\u0000\u017a\u017b\u0005c"+ + "\u0000\u0000\u017b\u017c\u0005h\u0000\u0000\u017c \u0001\u0000\u0000\u0000"+ + "\u017d\u017e\u0005c\u0000\u0000\u017e\u017f\u0005h\u0000\u0000\u017f\u0180"+ + "\u0005a\u0000\u0000\u0180\u0181\u0005r\u0000\u0000\u0181\"\u0001\u0000"+ + "\u0000\u0000\u0182\u0183\u0005c\u0000\u0000\u0183\u0184\u0005l\u0000\u0000"+ + "\u0184\u0185\u0005a\u0000\u0000\u0185\u0186\u0005s\u0000\u0000\u0186\u0187"+ + "\u0005s\u0000\u0000\u0187$\u0001\u0000\u0000\u0000\u0188\u0189\u0005c"+ + "\u0000\u0000\u0189\u018a\u0005o\u0000\u0000\u018a\u018b\u0005n\u0000\u0000"+ + "\u018b\u018c\u0005s\u0000\u0000\u018c\u018d\u0005t\u0000\u0000\u018d&"+ + "\u0001\u0000\u0000\u0000\u018e\u018f\u0005c\u0000\u0000\u018f\u0190\u0005"+ + "o\u0000\u0000\u0190\u0191\u0005n\u0000\u0000\u0191\u0192\u0005t\u0000"+ + "\u0000\u0192\u0193\u0005i\u0000\u0000\u0193\u0194\u0005n\u0000\u0000\u0194"+ + "\u0195\u0005u\u0000\u0000\u0195\u0196\u0005e\u0000\u0000\u0196(\u0001"+ + "\u0000\u0000\u0000\u0197\u0198\u0005d\u0000\u0000\u0198\u0199\u0005e\u0000"+ + "\u0000\u0199\u019a\u0005f\u0000\u0000\u019a\u019b\u0005a\u0000\u0000\u019b"+ + "\u019c\u0005u\u0000\u0000\u019c\u019d\u0005l\u0000\u0000\u019d\u019e\u0005"+ + "t\u0000\u0000\u019e*\u0001\u0000\u0000\u0000\u019f\u01a0\u0005d\u0000"+ + "\u0000\u01a0\u01a1\u0005o\u0000\u0000\u01a1,\u0001\u0000\u0000\u0000\u01a2"+ + "\u01a3\u0005d\u0000\u0000\u01a3\u01a4\u0005o\u0000\u0000\u01a4\u01a5\u0005"+ + "u\u0000\u0000\u01a5\u01a6\u0005b\u0000\u0000\u01a6\u01a7\u0005l\u0000"+ + "\u0000\u01a7\u01a8\u0005e\u0000\u0000\u01a8.\u0001\u0000\u0000\u0000\u01a9"+ + "\u01aa\u0005e\u0000\u0000\u01aa\u01ab\u0005l\u0000\u0000\u01ab\u01ac\u0005"+ + "s\u0000\u0000\u01ac\u01ad\u0005e\u0000\u0000\u01ad0\u0001\u0000\u0000"+ + "\u0000\u01ae\u01af\u0005e\u0000\u0000\u01af\u01b0\u0005x\u0000\u0000\u01b0"+ + "\u01b1\u0005t\u0000\u0000\u01b1\u01b2\u0005e\u0000\u0000\u01b2\u01b3\u0005"+ + "n\u0000\u0000\u01b3\u01b4\u0005d\u0000\u0000\u01b4\u01b5\u0005s\u0000"+ + "\u0000\u01b52\u0001\u0000\u0000\u0000\u01b6\u01b7\u0005f\u0000\u0000\u01b7"+ + "\u01b8\u0005i\u0000\u0000\u01b8\u01b9\u0005n\u0000\u0000\u01b9\u01ba\u0005"+ + "a\u0000\u0000\u01ba\u01bb\u0005l\u0000\u0000\u01bb4\u0001\u0000\u0000"+ + "\u0000\u01bc\u01bd\u0005f\u0000\u0000\u01bd\u01be\u0005i\u0000\u0000\u01be"+ + "\u01bf\u0005n\u0000\u0000\u01bf\u01c0\u0005a\u0000\u0000\u01c0\u01c1\u0005"+ + "l\u0000\u0000\u01c1\u01c2\u0005l\u0000\u0000\u01c2\u01c3\u0005y\u0000"+ + "\u0000\u01c36\u0001\u0000\u0000\u0000\u01c4\u01c5\u0005f\u0000\u0000\u01c5"+ + "\u01c6\u0005l\u0000\u0000\u01c6\u01c7\u0005o\u0000\u0000\u01c7\u01c8\u0005"+ + "a\u0000\u0000\u01c8\u01c9\u0005t\u0000\u0000\u01c98\u0001\u0000\u0000"+ + "\u0000\u01ca\u01cb\u0005f\u0000\u0000\u01cb\u01cc\u0005o\u0000\u0000\u01cc"+ + "\u01cd\u0005r\u0000\u0000\u01cd:\u0001\u0000\u0000\u0000\u01ce\u01cf\u0005"+ + "g\u0000\u0000\u01cf\u01d0\u0005o\u0000\u0000\u01d0\u01d1\u0005t\u0000"+ + "\u0000\u01d1\u01d2\u0005o\u0000\u0000\u01d2<\u0001\u0000\u0000\u0000\u01d3"+ + "\u01d4\u0005i\u0000\u0000\u01d4\u01d5\u0005f\u0000\u0000\u01d5>\u0001"+ + "\u0000\u0000\u0000\u01d6\u01d7\u0005i\u0000\u0000\u01d7\u01d8\u0005m\u0000"+ + "\u0000\u01d8\u01d9\u0005p\u0000\u0000\u01d9\u01da\u0005l\u0000\u0000\u01da"+ + "\u01db\u0005e\u0000\u0000\u01db\u01dc\u0005m\u0000\u0000\u01dc\u01dd\u0005"+ + "e\u0000\u0000\u01dd\u01de\u0005n\u0000\u0000\u01de\u01df\u0005t\u0000"+ + "\u0000\u01df\u01e0\u0005s\u0000\u0000\u01e0@\u0001\u0000\u0000\u0000\u01e1"+ + "\u01e2\u0005i\u0000\u0000\u01e2\u01e3\u0005m\u0000\u0000\u01e3\u01e4\u0005"+ + "p\u0000\u0000\u01e4\u01e5\u0005o\u0000\u0000\u01e5\u01e6\u0005r\u0000"+ + "\u0000\u01e6\u01e7\u0005t\u0000\u0000\u01e7B\u0001\u0000\u0000\u0000\u01e8"+ + "\u01e9\u0005i\u0000\u0000\u01e9\u01ea\u0005n\u0000\u0000\u01ea\u01eb\u0005"+ + "s\u0000\u0000\u01eb\u01ec\u0005t\u0000\u0000\u01ec\u01ed\u0005a\u0000"+ + "\u0000\u01ed\u01ee\u0005n\u0000\u0000\u01ee\u01ef\u0005c\u0000\u0000\u01ef"+ + "\u01f0\u0005e\u0000\u0000\u01f0\u01f1\u0005o\u0000\u0000\u01f1\u01f2\u0005"+ + "f\u0000\u0000\u01f2D\u0001\u0000\u0000\u0000\u01f3\u01f4\u0005i\u0000"+ + "\u0000\u01f4\u01f5\u0005n\u0000\u0000\u01f5\u01f6\u0005t\u0000\u0000\u01f6"+ + "F\u0001\u0000\u0000\u0000\u01f7\u01f8\u0005i\u0000\u0000\u01f8\u01f9\u0005"+ + "n\u0000\u0000\u01f9\u01fa\u0005t\u0000\u0000\u01fa\u01fb\u0005e\u0000"+ + "\u0000\u01fb\u01fc\u0005r\u0000\u0000\u01fc\u01fd\u0005f\u0000\u0000\u01fd"+ + "\u01fe\u0005a\u0000\u0000\u01fe\u01ff\u0005c\u0000\u0000\u01ff\u0200\u0005"+ + "e\u0000\u0000\u0200H\u0001\u0000\u0000\u0000\u0201\u0202\u0005l\u0000"+ + "\u0000\u0202\u0203\u0005o\u0000\u0000\u0203\u0204\u0005n\u0000\u0000\u0204"+ + "\u0205\u0005g\u0000\u0000\u0205J\u0001\u0000\u0000\u0000\u0206\u0207\u0005"+ + "n\u0000\u0000\u0207\u0208\u0005a\u0000\u0000\u0208\u0209\u0005t\u0000"+ + "\u0000\u0209\u020a\u0005i\u0000\u0000\u020a\u020b\u0005v\u0000\u0000\u020b"+ + "\u020c\u0005e\u0000\u0000\u020cL\u0001\u0000\u0000\u0000\u020d\u020e\u0005"+ + "n\u0000\u0000\u020e\u020f\u0005e\u0000\u0000\u020f\u0210\u0005w\u0000"+ + "\u0000\u0210N\u0001\u0000\u0000\u0000\u0211\u0212\u0005p\u0000\u0000\u0212"+ + "\u0213\u0005a\u0000\u0000\u0213\u0214\u0005c\u0000\u0000\u0214\u0215\u0005"+ + "k\u0000\u0000\u0215\u0216\u0005a\u0000\u0000\u0216\u0217\u0005g\u0000"+ + "\u0000\u0217\u0218\u0005e\u0000\u0000\u0218P\u0001\u0000\u0000\u0000\u0219"+ + "\u021a\u0005p\u0000\u0000\u021a\u021b\u0005r\u0000\u0000\u021b\u021c\u0005"+ + "i\u0000\u0000\u021c\u021d\u0005v\u0000\u0000\u021d\u021e\u0005a\u0000"+ + "\u0000\u021e\u021f\u0005t\u0000\u0000\u021f\u0220\u0005e\u0000\u0000\u0220"+ + "R\u0001\u0000\u0000\u0000\u0221\u0222\u0005p\u0000\u0000\u0222\u0223\u0005"+ + "r\u0000\u0000\u0223\u0224\u0005o\u0000\u0000\u0224\u0225\u0005t\u0000"+ + "\u0000\u0225\u0226\u0005e\u0000\u0000\u0226\u0227\u0005c\u0000\u0000\u0227"+ + "\u0228\u0005t\u0000\u0000\u0228\u0229\u0005e\u0000\u0000\u0229\u022a\u0005"+ + "d\u0000\u0000\u022aT\u0001\u0000\u0000\u0000\u022b\u022c\u0005p\u0000"+ + "\u0000\u022c\u022d\u0005u\u0000\u0000\u022d\u022e\u0005b\u0000\u0000\u022e"+ + "\u022f\u0005l\u0000\u0000\u022f\u0230\u0005i\u0000\u0000\u0230\u0231\u0005"+ + "c\u0000\u0000\u0231V\u0001\u0000\u0000\u0000\u0232\u0233\u0005r\u0000"+ + "\u0000\u0233\u0234\u0005e\u0000\u0000\u0234\u0235\u0005t\u0000\u0000\u0235"+ + "\u0236\u0005u\u0000\u0000\u0236\u0237\u0005r\u0000\u0000\u0237\u0238\u0005"+ + "n\u0000\u0000\u0238X\u0001\u0000\u0000\u0000\u0239\u023a\u0005s\u0000"+ + "\u0000\u023a\u023b\u0005h\u0000\u0000\u023b\u023c\u0005o\u0000\u0000\u023c"+ + "\u023d\u0005r\u0000\u0000\u023d\u023e\u0005t\u0000\u0000\u023eZ\u0001"+ + "\u0000\u0000\u0000\u023f\u0240\u0005s\u0000\u0000\u0240\u0241\u0005t\u0000"+ + "\u0000\u0241\u0242\u0005a\u0000\u0000\u0242\u0243\u0005t\u0000\u0000\u0243"+ + "\u0244\u0005i\u0000\u0000\u0244\u0245\u0005c\u0000\u0000\u0245\\\u0001"+ + "\u0000\u0000\u0000\u0246\u0247\u0005s\u0000\u0000\u0247\u0248\u0005t\u0000"+ + "\u0000\u0248\u0249\u0005r\u0000\u0000\u0249\u024a\u0005i\u0000\u0000\u024a"+ + "\u024b\u0005c\u0000\u0000\u024b\u024c\u0005t\u0000\u0000\u024c\u024d\u0005"+ + "f\u0000\u0000\u024d\u024e\u0005p\u0000\u0000\u024e^\u0001\u0000\u0000"+ + "\u0000\u024f\u0250\u0005s\u0000\u0000\u0250\u0251\u0005u\u0000\u0000\u0251"+ + "\u0252\u0005p\u0000\u0000\u0252\u0253\u0005e\u0000\u0000\u0253\u0254\u0005"+ + "r\u0000\u0000\u0254`\u0001\u0000\u0000\u0000\u0255\u0256\u0005s\u0000"+ + "\u0000\u0256\u0257\u0005w\u0000\u0000\u0257\u0258\u0005i\u0000\u0000\u0258"+ + "\u0259\u0005t\u0000\u0000\u0259\u025a\u0005c\u0000\u0000\u025a\u025b\u0005"+ + "h\u0000\u0000\u025bb\u0001\u0000\u0000\u0000\u025c\u025d\u0005s\u0000"+ + "\u0000\u025d\u025e\u0005y\u0000\u0000\u025e\u025f\u0005n\u0000\u0000\u025f"+ + "\u0260\u0005c\u0000\u0000\u0260\u0261\u0005h\u0000\u0000\u0261\u0262\u0005"+ + "r\u0000\u0000\u0262\u0263\u0005o\u0000\u0000\u0263\u0264\u0005n\u0000"+ + "\u0000\u0264\u0265\u0005i\u0000\u0000\u0265\u0266\u0005z\u0000\u0000\u0266"+ + "\u0267\u0005e\u0000\u0000\u0267\u0268\u0005d\u0000\u0000\u0268d\u0001"+ + "\u0000\u0000\u0000\u0269\u026a\u0005t\u0000\u0000\u026a\u026b\u0005h\u0000"+ + "\u0000\u026b\u026c\u0005i\u0000\u0000\u026c\u026d\u0005s\u0000\u0000\u026d"+ + "f\u0001\u0000\u0000\u0000\u026e\u026f\u0005t\u0000\u0000\u026f\u0270\u0005"+ + "h\u0000\u0000\u0270\u0271\u0005r\u0000\u0000\u0271\u0272\u0005o\u0000"+ + "\u0000\u0272\u0273\u0005w\u0000\u0000\u0273h\u0001\u0000\u0000\u0000\u0274"+ + "\u0275\u0005t\u0000\u0000\u0275\u0276\u0005h\u0000\u0000\u0276\u0277\u0005"+ + "r\u0000\u0000\u0277\u0278\u0005o\u0000\u0000\u0278\u0279\u0005w\u0000"+ + "\u0000\u0279\u027a\u0005s\u0000\u0000\u027aj\u0001\u0000\u0000\u0000\u027b"+ + "\u027c\u0005t\u0000\u0000\u027c\u027d\u0005r\u0000\u0000\u027d\u027e\u0005"+ + "a\u0000\u0000\u027e\u027f\u0005n\u0000\u0000\u027f\u0280\u0005s\u0000"+ + "\u0000\u0280\u0281\u0005i\u0000\u0000\u0281\u0282\u0005e\u0000\u0000\u0282"+ + "\u0283\u0005n\u0000\u0000\u0283\u0284\u0005t\u0000\u0000\u0284l\u0001"+ + "\u0000\u0000\u0000\u0285\u0286\u0005t\u0000\u0000\u0286\u0287\u0005r\u0000"+ + "\u0000\u0287\u0288\u0005y\u0000\u0000\u0288n\u0001\u0000\u0000\u0000\u0289"+ + "\u028a\u0005v\u0000\u0000\u028a\u028b\u0005o\u0000\u0000\u028b\u028c\u0005"+ + "i\u0000\u0000\u028c\u028d\u0005d\u0000\u0000\u028dp\u0001\u0000\u0000"+ + "\u0000\u028e\u028f\u0005v\u0000\u0000\u028f\u0290\u0005o\u0000\u0000\u0290"+ + "\u0291\u0005l\u0000\u0000\u0291\u0292\u0005a\u0000\u0000\u0292\u0293\u0005"+ + "t\u0000\u0000\u0293\u0294\u0005i\u0000\u0000\u0294\u0295\u0005l\u0000"+ + "\u0000\u0295\u0296\u0005e\u0000\u0000\u0296r\u0001\u0000\u0000\u0000\u0297"+ + "\u0298\u0005w\u0000\u0000\u0298\u0299\u0005h\u0000\u0000\u0299\u029a\u0005"+ + "i\u0000\u0000\u029a\u029b\u0005l\u0000\u0000\u029b\u029c\u0005e\u0000"+ + "\u0000\u029ct\u0001\u0000\u0000\u0000\u029d\u029e\u0005.\u0000\u0000\u029e"+ + "v\u0001\u0000\u0000\u0000\u029f\u02a3\u0003y<\u0000\u02a0\u02a3\u0003"+ + "{=\u0000\u02a1\u02a3\u0003}>\u0000\u02a2\u029f\u0001\u0000\u0000\u0000"+ + "\u02a2\u02a0\u0001\u0000\u0000\u0000\u02a2\u02a1\u0001\u0000\u0000\u0000"+ + "\u02a3x\u0001\u0000\u0000\u0000\u02a4\u02a6\u0003\u0081@\u0000\u02a5\u02a7"+ + "\u0003\u007f?\u0000\u02a6\u02a5\u0001\u0000\u0000\u0000\u02a6\u02a7\u0001"+ + "\u0000\u0000\u0000\u02a7z\u0001\u0000\u0000\u0000\u02a8\u02aa\u0003\u0083"+ + "A\u0000\u02a9\u02ab\u0003\u007f?\u0000\u02aa\u02a9\u0001\u0000\u0000\u0000"+ + "\u02aa\u02ab\u0001\u0000\u0000\u0000\u02ab|\u0001\u0000\u0000\u0000\u02ac"+ + "\u02ae\u0003\u00a9T\u0000\u02ad\u02af\u0003\u007f?\u0000\u02ae\u02ad\u0001"+ + "\u0000\u0000\u0000\u02ae\u02af\u0001\u0000\u0000\u0000\u02af~\u0001\u0000"+ + "\u0000\u0000\u02b0\u02b1\u0007\u0004\u0000\u0000\u02b1\u0080\u0001\u0000"+ + "\u0000\u0000\u02b2\u02b8\u00050\u0000\u0000\u02b3\u02b5\u0003\u0095J\u0000"+ + "\u02b4\u02b6\u0003\u0091H\u0000\u02b5\u02b4\u0001\u0000\u0000\u0000\u02b5"+ + "\u02b6\u0001\u0000\u0000\u0000\u02b6\u02b8\u0001\u0000\u0000\u0000\u02b7"+ + "\u02b2\u0001\u0000\u0000\u0000\u02b7\u02b3\u0001\u0000\u0000\u0000\u02b8"+ + "\u0082\u0001\u0000\u0000\u0000\u02b9\u02ba\u00050\u0000\u0000\u02ba\u02bb"+ + "\u0005x\u0000\u0000\u02bb\u02c0\u0003\u0085B\u0000\u02bc\u02bd\u00050"+ + "\u0000\u0000\u02bd\u02be\u0005X\u0000\u0000\u02be\u02c0\u0003\u0085B\u0000"+ + "\u02bf\u02b9\u0001\u0000\u0000\u0000\u02bf\u02bc\u0001\u0000\u0000\u0000"+ + "\u02c0\u0084\u0001\u0000\u0000\u0000\u02c1\u02c6\u0003\u0087C\u0000\u02c2"+ + "\u02c3\u0003\u0087C\u0000\u02c3\u02c4\u0003\u0085B\u0000\u02c4\u02c6\u0001"+ + "\u0000\u0000\u0000\u02c5\u02c1\u0001\u0000\u0000\u0000\u02c5\u02c2\u0001"+ + "\u0000\u0000\u0000\u02c6\u0086\u0001\u0000\u0000\u0000\u02c7\u02c8\u0007"+ + "\u0005\u0000\u0000\u02c8\u0088\u0001\u0000\u0000\u0000\u02c9\u02ca\u0003"+ + "\u0091H\u0000\u02ca\u02cc\u0005.\u0000\u0000\u02cb\u02cd\u0003\u0091H"+ + "\u0000\u02cc\u02cb\u0001\u0000\u0000\u0000\u02cc\u02cd\u0001\u0000\u0000"+ + "\u0000\u02cd\u02cf\u0001\u0000\u0000\u0000\u02ce\u02d0\u0003\u008bE\u0000"+ + "\u02cf\u02ce\u0001\u0000\u0000\u0000\u02cf\u02d0\u0001\u0000\u0000\u0000"+ + "\u02d0\u02d2\u0001\u0000\u0000\u0000\u02d1\u02d3\u0003\u0099L\u0000\u02d2"+ + "\u02d1\u0001\u0000\u0000\u0000\u02d2\u02d3\u0001\u0000\u0000\u0000\u02d3"+ + "\u02e8\u0001\u0000\u0000\u0000\u02d4\u02d5\u0005.\u0000\u0000\u02d5\u02d7"+ + "\u0003\u0091H\u0000\u02d6\u02d8\u0003\u008bE\u0000\u02d7\u02d6\u0001\u0000"+ + "\u0000\u0000\u02d7\u02d8\u0001\u0000\u0000\u0000\u02d8\u02da\u0001\u0000"+ + "\u0000\u0000\u02d9\u02db\u0003\u0099L\u0000\u02da\u02d9\u0001\u0000\u0000"+ + "\u0000\u02da\u02db\u0001\u0000\u0000\u0000\u02db\u02e8\u0001\u0000\u0000"+ + "\u0000\u02dc\u02dd\u0003\u0091H\u0000\u02dd\u02df\u0003\u008bE\u0000\u02de"+ + "\u02e0\u0003\u0099L\u0000\u02df\u02de\u0001\u0000\u0000\u0000\u02df\u02e0"+ + "\u0001\u0000\u0000\u0000\u02e0\u02e8\u0001\u0000\u0000\u0000\u02e1\u02e3"+ + "\u0003\u0091H\u0000\u02e2\u02e4\u0003\u008bE\u0000\u02e3\u02e2\u0001\u0000"+ + "\u0000\u0000\u02e3\u02e4\u0001\u0000\u0000\u0000\u02e4\u02e5\u0001\u0000"+ + "\u0000\u0000\u02e5\u02e6\u0003\u0099L\u0000\u02e6\u02e8\u0001\u0000\u0000"+ + "\u0000\u02e7\u02c9\u0001\u0000\u0000\u0000\u02e7\u02d4\u0001\u0000\u0000"+ + "\u0000\u02e7\u02dc\u0001\u0000\u0000\u0000\u02e7\u02e1\u0001\u0000\u0000"+ + "\u0000\u02e8\u008a\u0001\u0000\u0000\u0000\u02e9\u02ea\u0003\u008dF\u0000"+ + "\u02ea\u02eb\u0003\u008fG\u0000\u02eb\u008c\u0001\u0000\u0000\u0000\u02ec"+ + "\u02ed\u0007\u0006\u0000\u0000\u02ed\u008e\u0001\u0000\u0000\u0000\u02ee"+ + "\u02f0\u0003\u0097K\u0000\u02ef\u02ee\u0001\u0000\u0000\u0000\u02ef\u02f0"+ + "\u0001\u0000\u0000\u0000\u02f0\u02f1\u0001\u0000\u0000\u0000\u02f1\u02f2"+ + "\u0003\u0091H\u0000\u02f2\u0090\u0001\u0000\u0000\u0000\u02f3\u02f5\u0003"+ + "\u0093I\u0000\u02f4\u02f3\u0001\u0000\u0000\u0000\u02f5\u02f6\u0001\u0000"+ + "\u0000\u0000\u02f6\u02f4\u0001\u0000\u0000\u0000\u02f6\u02f7\u0001\u0000"+ + "\u0000\u0000\u02f7\u0092\u0001\u0000\u0000\u0000\u02f8\u02fb\u00050\u0000"+ + "\u0000\u02f9\u02fb\u0003\u0095J\u0000\u02fa\u02f8\u0001\u0000\u0000\u0000"+ + "\u02fa\u02f9\u0001\u0000\u0000\u0000\u02fb\u0094\u0001\u0000\u0000\u0000"+ + "\u02fc\u02fd\u0007\u0007\u0000\u0000\u02fd\u0096\u0001\u0000\u0000\u0000"+ + "\u02fe\u02ff\u0007\b\u0000\u0000\u02ff\u0098\u0001\u0000\u0000\u0000\u0300"+ + "\u0301\u0007\t\u0000\u0000\u0301\u009a\u0001\u0000\u0000\u0000\u0302\u0303"+ + "\u0005\'\u0000\u0000\u0303\u0304\u0003\u009dN\u0000\u0304\u0305\u0005"+ + "\'\u0000\u0000\u0305\u030b\u0001\u0000\u0000\u0000\u0306\u0307\u0005\'"+ + "\u0000\u0000\u0307\u0308\u0003\u00a5R\u0000\u0308\u0309\u0005\'\u0000"+ + "\u0000\u0309\u030b\u0001\u0000\u0000\u0000\u030a\u0302\u0001\u0000\u0000"+ + "\u0000\u030a\u0306\u0001\u0000\u0000\u0000\u030b\u009c\u0001\u0000\u0000"+ + "\u0000\u030c\u030d\u0007\n\u0000\u0000\u030d\u009e\u0001\u0000\u0000\u0000"+ + "\u030e\u0310\u0005\"\u0000\u0000\u030f\u0311\u0003\u00a1P\u0000\u0310"+ + "\u030f\u0001\u0000\u0000\u0000\u0310\u0311\u0001\u0000\u0000\u0000\u0311"+ + "\u0312\u0001\u0000\u0000\u0000\u0312\u0313\u0005\"\u0000\u0000\u0313\u00a0"+ + "\u0001\u0000\u0000\u0000\u0314\u0316\u0003\u00a3Q\u0000\u0315\u0314\u0001"+ + "\u0000\u0000\u0000\u0316\u0317\u0001\u0000\u0000\u0000\u0317\u0315\u0001"+ + "\u0000\u0000\u0000\u0317\u0318\u0001\u0000\u0000\u0000\u0318\u00a2\u0001"+ + "\u0000\u0000\u0000\u0319\u031c\u0003\u009dN\u0000\u031a\u031c\u0003\u00a5"+ + "R\u0000\u031b\u0319\u0001\u0000\u0000\u0000\u031b\u031a\u0001\u0000\u0000"+ + "\u0000\u031c\u00a4\u0001\u0000\u0000\u0000\u031d\u0347\u0005\\\u0000\u0000"+ + "\u031e\u031f\u0005u\u0000\u0000\u031f\u0320\u00050\u0000\u0000\u0320\u0321"+ + "\u00050\u0000\u0000\u0321\u0322\u00050\u0000\u0000\u0322\u0348\u00058"+ + "\u0000\u0000\u0323\u0324\u0005u\u0000\u0000\u0324\u0325\u00050\u0000\u0000"+ + "\u0325\u0326\u00050\u0000\u0000\u0326\u0327\u00050\u0000\u0000\u0327\u0348"+ + "\u00059\u0000\u0000\u0328\u0329\u0005u\u0000\u0000\u0329\u032a\u00050"+ + "\u0000\u0000\u032a\u032b\u00050\u0000\u0000\u032b\u032c\u00050\u0000\u0000"+ + "\u032c\u0348\u0005a\u0000\u0000\u032d\u032e\u0005u\u0000\u0000\u032e\u032f"+ + "\u00050\u0000\u0000\u032f\u0330\u00050\u0000\u0000\u0330\u0331\u00050"+ + "\u0000\u0000\u0331\u0348\u0005c\u0000\u0000\u0332\u0333\u0005u\u0000\u0000"+ + "\u0333\u0334\u00050\u0000\u0000\u0334\u0335\u00050\u0000\u0000\u0335\u0336"+ + "\u00050\u0000\u0000\u0336\u0348\u0005d\u0000\u0000\u0337\u0338\u0005u"+ + "\u0000\u0000\u0338\u0339\u00050\u0000\u0000\u0339\u033a\u00050\u0000\u0000"+ + "\u033a\u033b\u00052\u0000\u0000\u033b\u0348\u00052\u0000\u0000\u033c\u033d"+ + "\u0005u\u0000\u0000\u033d\u033e\u00050\u0000\u0000\u033e\u033f\u00050"+ + "\u0000\u0000\u033f\u0340\u00052\u0000\u0000\u0340\u0348\u00057\u0000\u0000"+ + "\u0341\u0342\u0005u\u0000\u0000\u0342\u0343\u00050\u0000\u0000\u0343\u0344"+ + "\u00050\u0000\u0000\u0344\u0345\u00055\u0000\u0000\u0345\u0348\u0005c"+ + "\u0000\u0000\u0346\u0348\u0003\u00a7S\u0000\u0347\u031e\u0001\u0000\u0000"+ + "\u0000\u0347\u0323\u0001\u0000\u0000\u0000\u0347\u0328\u0001\u0000\u0000"+ + "\u0000\u0347\u032d\u0001\u0000\u0000\u0000\u0347\u0332\u0001\u0000\u0000"+ + "\u0000\u0347\u0337\u0001\u0000\u0000\u0000\u0347\u033c\u0001\u0000\u0000"+ + "\u0000\u0347\u0341\u0001\u0000\u0000\u0000\u0347\u0346\u0001\u0000\u0000"+ + "\u0000\u0348\u00a6\u0001\u0000\u0000\u0000\u0349\u034a\u0005\\\u0000\u0000"+ + "\u034a\u0355\u0003\u00adV\u0000\u034b\u034c\u0005\\\u0000\u0000\u034c"+ + "\u034d\u0003\u00adV\u0000\u034d\u034e\u0003\u00adV\u0000\u034e\u0355\u0001"+ + "\u0000\u0000\u0000\u034f\u0350\u0005\\\u0000\u0000\u0350\u0351\u0003\u00af"+ + "W\u0000\u0351\u0352\u0003\u00adV\u0000\u0352\u0353\u0003\u00adV\u0000"+ + "\u0353\u0355\u0001\u0000\u0000\u0000\u0354\u0349\u0001\u0000\u0000\u0000"+ + "\u0354\u034b\u0001\u0000\u0000\u0000\u0354\u034f\u0001\u0000\u0000\u0000"+ + "\u0355\u00a8\u0001\u0000\u0000\u0000\u0356\u0357\u00050\u0000\u0000\u0357"+ + "\u0358\u0003\u00abU\u0000\u0358\u00aa\u0001\u0000\u0000\u0000\u0359\u035a"+ + "\u0003\u00adV\u0000\u035a\u00ac\u0001\u0000\u0000\u0000\u035b\u035c\u0007"+ + "\u000b\u0000\u0000\u035c\u00ae\u0001\u0000\u0000\u0000\u035d\u035e\u0007"+ + "\f\u0000\u0000\u035e\u00b0\u0001\u0000\u0000\u0000\u035f\u0360\u0005t"+ + "\u0000\u0000\u0360\u0361\u0005r\u0000\u0000\u0361\u0362\u0005u\u0000\u0000"+ + "\u0362\u0369\u0005e\u0000\u0000\u0363\u0364\u0005f\u0000\u0000\u0364\u0365"+ + "\u0005a\u0000\u0000\u0365\u0366\u0005l\u0000\u0000\u0366\u0367\u0005s"+ + "\u0000\u0000\u0367\u0369\u0005e\u0000\u0000\u0368\u035f\u0001\u0000\u0000"+ + "\u0000\u0368\u0363\u0001\u0000\u0000\u0000\u0369\u00b2\u0001\u0000\u0000"+ + "\u0000\u036a\u036b\u0005n\u0000\u0000\u036b\u036c\u0005u\u0000\u0000\u036c"+ + "\u036d\u0005l\u0000\u0000\u036d\u036e\u0005l\u0000\u0000\u036e\u00b4\u0001"+ + "\u0000\u0000\u0000\u036f\u0370\u0005(\u0000\u0000\u0370\u00b6\u0001\u0000"+ + "\u0000\u0000\u0371\u0372\u0005)\u0000\u0000\u0372\u00b8\u0001\u0000\u0000"+ + "\u0000\u0373\u0374\u0005{\u0000\u0000\u0374\u00ba\u0001\u0000\u0000\u0000"+ + "\u0375\u0376\u0005}\u0000\u0000\u0376\u00bc\u0001\u0000\u0000\u0000\u0377"+ + "\u0378\u0005[\u0000\u0000\u0378\u00be\u0001\u0000\u0000\u0000\u0379\u037a"+ + "\u0005]\u0000\u0000\u037a\u00c0\u0001\u0000\u0000\u0000\u037b\u037c\u0005"+ + ";\u0000\u0000\u037c\u00c2\u0001\u0000\u0000\u0000\u037d\u037e\u0005,\u0000"+ + "\u0000\u037e\u00c4\u0001\u0000\u0000\u0000\u037f\u0380\u0005>\u0000\u0000"+ + "\u0380\u0381\u0005>\u0000\u0000\u0381\u0382\u0005>\u0000\u0000\u0382\u0383"+ + "\u0005=\u0000\u0000\u0383\u00c6\u0001\u0000\u0000\u0000\u0384\u0385\u0005"+ + "=\u0000\u0000\u0385\u0386\u0005=\u0000\u0000\u0386\u00c8\u0001\u0000\u0000"+ + "\u0000\u0387\u0388\u0005!\u0000\u0000\u0388\u0389\u0005=\u0000\u0000\u0389"+ + "\u00ca\u0001\u0000\u0000\u0000\u038a\u038b\u0005<\u0000\u0000\u038b\u038c"+ + "\u0005=\u0000\u0000\u038c\u00cc\u0001\u0000\u0000\u0000\u038d\u038e\u0005"+ + ">\u0000\u0000\u038e\u038f\u0005=\u0000\u0000\u038f\u00ce\u0001\u0000\u0000"+ + "\u0000\u0390\u0391\u0005&\u0000\u0000\u0391\u0392\u0005&\u0000\u0000\u0392"+ + "\u00d0\u0001\u0000\u0000\u0000\u0393\u0394\u0005|\u0000\u0000\u0394\u0395"+ + "\u0005|\u0000\u0000\u0395\u00d2\u0001\u0000\u0000\u0000\u0396\u0397\u0005"+ + "+\u0000\u0000\u0397\u0398\u0005+\u0000\u0000\u0398\u00d4\u0001\u0000\u0000"+ + "\u0000\u0399\u039a\u0005-\u0000\u0000\u039a\u039b\u0005-\u0000\u0000\u039b"+ + "\u00d6\u0001\u0000\u0000\u0000\u039c\u039d\u0005<\u0000\u0000\u039d\u039e"+ + "\u0005<\u0000\u0000\u039e\u00d8\u0001\u0000\u0000\u0000\u039f\u03a0\u0005"+ + ">\u0000\u0000\u03a0\u03a1\u0005>\u0000\u0000\u03a1\u00da\u0001\u0000\u0000"+ + "\u0000\u03a2\u03a3\u0005>\u0000\u0000\u03a3\u03a4\u0005>\u0000\u0000\u03a4"+ + "\u03a5\u0005>\u0000\u0000\u03a5\u00dc\u0001\u0000\u0000\u0000\u03a6\u03a7"+ + "\u0005+\u0000\u0000\u03a7\u03a8\u0005=\u0000\u0000\u03a8\u00de\u0001\u0000"+ + "\u0000\u0000\u03a9\u03aa\u0005-\u0000\u0000\u03aa\u03ab\u0005=\u0000\u0000"+ + "\u03ab\u00e0\u0001\u0000\u0000\u0000\u03ac\u03ad\u0005*\u0000\u0000\u03ad"+ + "\u03ae\u0005=\u0000\u0000\u03ae\u00e2\u0001\u0000\u0000\u0000\u03af\u03b0"+ + "\u0005/\u0000\u0000\u03b0\u03b1\u0005=\u0000\u0000\u03b1\u00e4\u0001\u0000"+ + "\u0000\u0000\u03b2\u03b3\u0005&\u0000\u0000\u03b3\u03b4\u0005=\u0000\u0000"+ + "\u03b4\u00e6\u0001\u0000\u0000\u0000\u03b5\u03b6\u0005|\u0000\u0000\u03b6"+ + "\u03b7\u0005=\u0000\u0000\u03b7\u00e8\u0001\u0000\u0000\u0000\u03b8\u03b9"+ + "\u0005^\u0000\u0000\u03b9\u03ba\u0005=\u0000\u0000\u03ba\u00ea\u0001\u0000"+ + "\u0000\u0000\u03bb\u03bc\u0005%\u0000\u0000\u03bc\u03bd\u0005=\u0000\u0000"+ + "\u03bd\u00ec\u0001\u0000\u0000\u0000\u03be\u03bf\u0005<\u0000\u0000\u03bf"+ + "\u03c0\u0005<\u0000\u0000\u03c0\u03c1\u0005=\u0000\u0000\u03c1\u00ee\u0001"+ + "\u0000\u0000\u0000\u03c2\u03c3\u0005>\u0000\u0000\u03c3\u03c4\u0005>\u0000"+ + "\u0000\u03c4\u03c5\u0005=\u0000\u0000\u03c5\u00f0\u0001\u0000\u0000\u0000"+ + "\u03c6\u03c7\u0005=\u0000\u0000\u03c7\u00f2\u0001\u0000\u0000\u0000\u03c8"+ + "\u03c9\u0005~\u0000\u0000\u03c9\u00f4\u0001\u0000\u0000\u0000\u03ca\u03cb"+ + "\u0005<\u0000\u0000\u03cb\u00f6\u0001\u0000\u0000\u0000\u03cc\u03cd\u0005"+ + ">\u0000\u0000\u03cd\u00f8\u0001\u0000\u0000\u0000\u03ce\u03cf\u0005!\u0000"+ + "\u0000\u03cf\u00fa\u0001\u0000\u0000\u0000\u03d0\u03d1\u0005?\u0000\u0000"+ + "\u03d1\u00fc\u0001\u0000\u0000\u0000\u03d2\u03d3\u0005:\u0000\u0000\u03d3"+ + "\u00fe\u0001\u0000\u0000\u0000\u03d4\u03d5\u0005+\u0000\u0000\u03d5\u0100"+ + "\u0001\u0000\u0000\u0000\u03d6\u03d7\u0005-\u0000\u0000\u03d7\u0102\u0001"+ + "\u0000\u0000\u0000\u03d8\u03d9\u0005*\u0000\u0000\u03d9\u0104\u0001\u0000"+ + "\u0000\u0000\u03da\u03db\u0005/\u0000\u0000\u03db\u0106\u0001\u0000\u0000"+ + "\u0000\u03dc\u03dd\u0005&\u0000\u0000\u03dd\u0108\u0001\u0000\u0000\u0000"+ + "\u03de\u03df\u0005|\u0000\u0000\u03df\u010a\u0001\u0000\u0000\u0000\u03e0"+ + "\u03e1\u0005^\u0000\u0000\u03e1\u010c\u0001\u0000\u0000\u0000\u03e2\u03e3"+ + "\u0005%\u0000\u0000\u03e3\u010e\u0001\u0000\u0000\u0000\u03e4\u03e8\u0003"+ + "\u0111\u0088\u0000\u03e5\u03e7\u0003\u0113\u0089\u0000\u03e6\u03e5\u0001"+ + "\u0000\u0000\u0000\u03e7\u03ea\u0001\u0000\u0000\u0000\u03e8\u03e6\u0001"+ + "\u0000\u0000\u0000\u03e8\u03e9\u0001\u0000\u0000\u0000\u03e9\u0110\u0001"+ + "\u0000\u0000\u0000\u03ea\u03e8\u0001\u0000\u0000\u0000\u03eb\u03ec\u0007"+ + "\r\u0000\u0000\u03ec\u0112\u0001\u0000\u0000\u0000\u03ed\u03ee\u0007\u000e"+ + "\u0000\u0000\u03ee\u0114\u0001\u0000\u0000\u0000&\u0000\u0117\u011a\u011e"+ + "\u0128\u012c\u0130\u013d\u0145\u0149\u014d\u02a2\u02a6\u02aa\u02ae\u02b5"+ + "\u02b7\u02bf\u02c5\u02cc\u02cf\u02d2\u02d7\u02da\u02df\u02e3\u02e7\u02ef"+ + "\u02f6\u02fa\u030a\u0310\u0317\u031b\u0347\u0354\u0368\u03e8\u0001\u0006"+ + "\u0000\u0000"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/Assignment-1/ExprLexer.tokens b/Assignment-1/ExprLexer.tokens new file mode 100644 index 0000000..3a6fe78 --- /dev/null +++ b/Assignment-1/ExprLexer.tokens @@ -0,0 +1,200 @@ +WhiteSpace=1 +Comment=2 +Abstract=3 +Assert=4 +Boolean=5 +Break=6 +Byte=7 +Case=8 +Catch=9 +Char=10 +Class=11 +Const=12 +Continue=13 +Default=14 +Do=15 +Double=16 +Else=17 +Extends=18 +Final=19 +Finally=20 +Float=21 +For=22 +Goto=23 +If=24 +Implements=25 +Import=26 +InstanceOf=27 +Int=28 +Interface=29 +Long=30 +Native=31 +New=32 +Package=33 +Private=34 +Protected=35 +Public=36 +Return=37 +Short=38 +Static=39 +Strictfp=40 +Super=41 +Switch=42 +Synchronized=43 +This=44 +Throw=45 +Throws=46 +Transient=47 +Try=48 +Void=49 +Volatile=50 +While=51 +Dot=52 +IntegerLiteral=53 +FloatingPointLiteral=54 +CharacterLiteral=55 +StringLiteral=56 +BooleanLiteral=57 +NullLiteral=58 +ParenthesesLeft=59 +ParenthesesRight=60 +CurlyBracketLeft=61 +CurlyBracketRight=62 +SquareBracketLeft=63 +SquareBracketRight=64 +Semicolon=65 +Comma=66 +UnsignedRightShiftAssign=67 +EqualTo=68 +NotEqualTo=69 +LessThanEqualTo=70 +GreaterThanEqualTo=71 +ConditionalAND=72 +ConditionalOR=73 +Increment=74 +Decrement=75 +LeftShift=76 +SignedRightShift=77 +UnsignedRightShift=78 +AddAssign=79 +SubtractAssign=80 +MultiplyAssign=81 +DivideAssign=82 +BitwiseANDAssign=83 +BitwiseORAssign=84 +BitwiseXORAssign=85 +RemainderAssign=86 +LeftShiftAssign=87 +SignedRightShiftAssign=88 +Assignment=89 +BitwiseComplement=90 +LessThan=91 +GreaterThan=92 +LogicalComplement=93 +Question=94 +Colon=95 +Addition=96 +Subtraction=97 +Multiplication=98 +Division=99 +BitwiseAND=100 +BitwiseOR=101 +BitwiseXOR=102 +Remainder=103 +IDENTIFIER=104 +'abstract'=3 +'assert'=4 +'boolean'=5 +'break'=6 +'byte'=7 +'case'=8 +'catch'=9 +'char'=10 +'class'=11 +'const'=12 +'continue'=13 +'default'=14 +'do'=15 +'double'=16 +'else'=17 +'extends'=18 +'final'=19 +'finally'=20 +'float'=21 +'for'=22 +'goto'=23 +'if'=24 +'implements'=25 +'import'=26 +'instanceof'=27 +'int'=28 +'interface'=29 +'long'=30 +'native'=31 +'new'=32 +'package'=33 +'private'=34 +'protected'=35 +'public'=36 +'return'=37 +'short'=38 +'static'=39 +'strictfp'=40 +'super'=41 +'switch'=42 +'synchronized'=43 +'this'=44 +'throw'=45 +'throws'=46 +'transient'=47 +'try'=48 +'void'=49 +'volatile'=50 +'while'=51 +'.'=52 +'null'=58 +'('=59 +')'=60 +'{'=61 +'}'=62 +'['=63 +']'=64 +';'=65 +','=66 +'>>>='=67 +'=='=68 +'!='=69 +'<='=70 +'>='=71 +'&&'=72 +'||'=73 +'++'=74 +'--'=75 +'<<'=76 +'>>'=77 +'>>>'=78 +'+='=79 +'-='=80 +'*='=81 +'/='=82 +'&='=83 +'|='=84 +'^='=85 +'%='=86 +'<<='=87 +'>>='=88 +'='=89 +'~'=90 +'<'=91 +'>'=92 +'!'=93 +'?'=94 +':'=95 +'+'=96 +'-'=97 +'*'=98 +'/'=99 +'&'=100 +'|'=101 +'^'=102 +'%'=103 diff --git a/Assignment-1/ExprParser.interp b/Assignment-1/ExprParser.interp new file mode 100644 index 0000000..d86be5d --- /dev/null +++ b/Assignment-1/ExprParser.interp @@ -0,0 +1,303 @@ +token literal names: +null +null +null +'abstract' +'assert' +'boolean' +'break' +'byte' +'case' +'catch' +'char' +'class' +'const' +'continue' +'default' +'do' +'double' +'else' +'extends' +'final' +'finally' +'float' +'for' +'goto' +'if' +'implements' +'import' +'instanceof' +'int' +'interface' +'long' +'native' +'new' +'package' +'private' +'protected' +'public' +'return' +'short' +'static' +'strictfp' +'super' +'switch' +'synchronized' +'this' +'throw' +'throws' +'transient' +'try' +'void' +'volatile' +'while' +'.' +null +null +null +null +null +'null' +'(' +')' +'{' +'}' +'[' +']' +';' +',' +'>>>=' +'==' +'!=' +'<=' +'>=' +'&&' +'||' +'++' +'--' +'<<' +'>>' +'>>>' +'+=' +'-=' +'*=' +'/=' +'&=' +'|=' +'^=' +'%=' +'<<=' +'>>=' +'=' +'~' +'<' +'>' +'!' +'?' +':' +'+' +'-' +'*' +'/' +'&' +'|' +'^' +'%' +null + +token symbolic names: +null +WhiteSpace +Comment +Abstract +Assert +Boolean +Break +Byte +Case +Catch +Char +Class +Const +Continue +Default +Do +Double +Else +Extends +Final +Finally +Float +For +Goto +If +Implements +Import +InstanceOf +Int +Interface +Long +Native +New +Package +Private +Protected +Public +Return +Short +Static +Strictfp +Super +Switch +Synchronized +This +Throw +Throws +Transient +Try +Void +Volatile +While +Dot +IntegerLiteral +FloatingPointLiteral +CharacterLiteral +StringLiteral +BooleanLiteral +NullLiteral +ParenthesesLeft +ParenthesesRight +CurlyBracketLeft +CurlyBracketRight +SquareBracketLeft +SquareBracketRight +Semicolon +Comma +UnsignedRightShiftAssign +EqualTo +NotEqualTo +LessThanEqualTo +GreaterThanEqualTo +ConditionalAND +ConditionalOR +Increment +Decrement +LeftShift +SignedRightShift +UnsignedRightShift +AddAssign +SubtractAssign +MultiplyAssign +DivideAssign +BitwiseANDAssign +BitwiseORAssign +BitwiseXORAssign +RemainderAssign +LeftShiftAssign +SignedRightShiftAssign +Assignment +BitwiseComplement +LessThan +GreaterThan +LogicalComplement +Question +Colon +Addition +Subtraction +Multiplication +Division +BitwiseAND +BitwiseOR +BitwiseXOR +Remainder +IDENTIFIER + +rule names: +prog +identifier +qualifiedIdentifier +literal +expression +conditionalExpr +logicalOrExpr +logicalAndExpr +equalityExpr +relationalExpr +additiveExpr +multiplicativeExpr +unaryExpr +postfixExpr +primaryExpr +assignmentOperator +type +statementExpression +constantExpression +identifierSuffix +postfixOp +primitiveType +argumentsOpt +arguments +bracketsOpt +creator +innerCreator +arrayCreatorRest +classCreatorRest +arrayInitializer +variableInitializer +parExpression +block +blockStatements +blockStatement +localVariableDeclarationStatement +statement +statementIncompleteIf +completeIf +catches +catchClause +switchStatement +switchBlockStatementGroups +switchBlockStatementGroup +switchLabel +moreStatementExpressions +forInit +forUpdate +modifiersOpt +modifier +variableDeclarators +variableDeclaratorsRest +constantDeclaratorsRest +variableDeclarator +constantDeclarator +variableDeclaratorRest +constantDeclaratorRest +variableDeclaratorId +compilationUnit +importDeclaration +typeDeclaration +classOrInterfaceDeclaration +classDeclaration +interfaceDeclaration +typeList +classBody +interfaceBody +classBodyDeclaration +memberDecl +methodOrFieldDecl +methodOrFieldRest +interfaceBodyDeclaration +interfaceMemberDecl +interfaceMethodOrFieldDecl +interfaceMethodOrFieldRest +methodDeclaratorRest +voidMethodDeclaratorRest +interfaceMethodDeclaratorRest +voidInterfaceMethodDeclaratorRest +constructorDeclaratorRest +qualifiedIdentifierList +formalParameters +formalParameter +methodBody + + +atn: +[4, 1, 104, 877, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 5, 2, 177, 8, 2, 10, 2, 12, 2, 180, 9, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 189, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 198, 8, 5, 1, 6, 1, 6, 1, 6, 5, 6, 203, 8, 6, 10, 6, 12, 6, 206, 9, 6, 1, 7, 1, 7, 1, 7, 5, 7, 211, 8, 7, 10, 7, 12, 7, 214, 9, 7, 1, 8, 1, 8, 1, 8, 5, 8, 219, 8, 8, 10, 8, 12, 8, 222, 9, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 5, 9, 229, 8, 9, 10, 9, 12, 9, 232, 9, 9, 1, 10, 1, 10, 1, 10, 5, 10, 237, 8, 10, 10, 10, 12, 10, 240, 9, 10, 1, 11, 1, 11, 1, 11, 5, 11, 245, 8, 11, 10, 11, 12, 11, 248, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 257, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 269, 8, 13, 10, 13, 12, 13, 272, 9, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 286, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 295, 8, 14, 10, 14, 12, 14, 298, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 307, 8, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 5, 16, 314, 8, 16, 10, 16, 12, 16, 317, 9, 16, 1, 16, 1, 16, 1, 16, 3, 16, 322, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 347, 8, 19, 3, 19, 349, 8, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 3, 22, 356, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 362, 8, 23, 10, 23, 12, 23, 365, 9, 23, 3, 23, 367, 8, 23, 1, 23, 1, 23, 1, 24, 1, 24, 5, 24, 373, 8, 24, 10, 24, 12, 24, 376, 9, 24, 1, 25, 1, 25, 1, 25, 3, 25, 381, 8, 25, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 5, 27, 398, 8, 27, 10, 27, 12, 27, 401, 9, 27, 3, 27, 403, 8, 27, 1, 28, 1, 28, 3, 28, 407, 8, 28, 1, 29, 1, 29, 1, 29, 1, 29, 5, 29, 413, 8, 29, 10, 29, 12, 29, 416, 9, 29, 1, 29, 3, 29, 419, 8, 29, 3, 29, 421, 8, 29, 1, 29, 1, 29, 1, 30, 1, 30, 3, 30, 427, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 5, 33, 438, 8, 33, 10, 33, 12, 33, 441, 9, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 448, 8, 34, 1, 34, 3, 34, 451, 8, 34, 1, 35, 3, 35, 454, 8, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 3, 36, 464, 8, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 476, 8, 37, 1, 37, 1, 37, 3, 37, 480, 8, 37, 1, 37, 1, 37, 3, 37, 484, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 520, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 529, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 534, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 541, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 550, 8, 38, 1, 39, 1, 39, 5, 39, 554, 8, 39, 10, 39, 12, 39, 557, 9, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 574, 8, 41, 1, 41, 1, 41, 3, 41, 578, 8, 41, 1, 42, 5, 42, 581, 8, 42, 10, 42, 12, 42, 584, 9, 42, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 595, 8, 44, 1, 45, 1, 45, 5, 45, 599, 8, 45, 10, 45, 12, 45, 602, 9, 45, 1, 46, 1, 46, 1, 46, 1, 46, 3, 46, 608, 8, 46, 1, 46, 1, 46, 1, 46, 3, 46, 613, 8, 46, 1, 47, 1, 47, 1, 47, 1, 48, 5, 48, 619, 8, 48, 10, 48, 12, 48, 622, 9, 48, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 5, 50, 629, 8, 50, 10, 50, 12, 50, 632, 9, 50, 1, 51, 1, 51, 1, 51, 5, 51, 637, 8, 51, 10, 51, 12, 51, 640, 9, 51, 1, 52, 1, 52, 1, 52, 5, 52, 645, 8, 52, 10, 52, 12, 52, 648, 9, 52, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 3, 55, 659, 8, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 3, 58, 672, 8, 58, 1, 58, 5, 58, 675, 8, 58, 10, 58, 12, 58, 678, 9, 58, 1, 58, 5, 58, 681, 8, 58, 10, 58, 12, 58, 684, 9, 58, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 690, 8, 59, 10, 59, 12, 59, 693, 9, 59, 1, 59, 1, 59, 3, 59, 697, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 3, 60, 703, 8, 60, 1, 61, 1, 61, 1, 61, 3, 61, 708, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 714, 8, 62, 1, 62, 1, 62, 3, 62, 718, 8, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 726, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 5, 64, 733, 8, 64, 10, 64, 12, 64, 736, 9, 64, 1, 65, 1, 65, 5, 65, 740, 8, 65, 10, 65, 12, 65, 743, 9, 65, 1, 65, 1, 65, 1, 66, 1, 66, 5, 66, 749, 8, 66, 10, 66, 12, 66, 752, 9, 66, 1, 66, 1, 66, 1, 67, 1, 67, 3, 67, 758, 8, 67, 1, 67, 1, 67, 1, 67, 1, 67, 3, 67, 764, 8, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 775, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 3, 70, 783, 8, 70, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 789, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 797, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 807, 8, 74, 1, 75, 1, 75, 1, 75, 1, 75, 3, 75, 813, 8, 75, 1, 75, 1, 75, 3, 75, 817, 8, 75, 1, 76, 1, 76, 1, 76, 3, 76, 822, 8, 76, 1, 76, 1, 76, 3, 76, 826, 8, 76, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 832, 8, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 3, 78, 839, 8, 78, 1, 79, 1, 79, 1, 79, 3, 79, 844, 8, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 5, 80, 851, 8, 80, 10, 80, 12, 80, 854, 9, 80, 1, 81, 1, 81, 1, 81, 1, 81, 5, 81, 860, 8, 81, 10, 81, 12, 81, 863, 9, 81, 3, 81, 865, 8, 81, 1, 81, 1, 81, 1, 82, 3, 82, 870, 8, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 0, 0, 84, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 0, 10, 1, 0, 53, 58, 1, 0, 68, 69, 2, 0, 70, 71, 91, 92, 1, 0, 96, 97, 2, 0, 98, 99, 103, 103, 4, 0, 74, 75, 90, 90, 93, 93, 96, 97, 2, 0, 67, 67, 79, 89, 1, 0, 74, 75, 8, 0, 5, 5, 7, 7, 10, 10, 16, 16, 21, 21, 28, 28, 30, 30, 38, 38, 8, 0, 3, 3, 19, 19, 31, 31, 34, 36, 39, 40, 43, 43, 47, 47, 50, 50, 918, 0, 168, 1, 0, 0, 0, 2, 171, 1, 0, 0, 0, 4, 173, 1, 0, 0, 0, 6, 181, 1, 0, 0, 0, 8, 188, 1, 0, 0, 0, 10, 197, 1, 0, 0, 0, 12, 199, 1, 0, 0, 0, 14, 207, 1, 0, 0, 0, 16, 215, 1, 0, 0, 0, 18, 223, 1, 0, 0, 0, 20, 233, 1, 0, 0, 0, 22, 241, 1, 0, 0, 0, 24, 256, 1, 0, 0, 0, 26, 258, 1, 0, 0, 0, 28, 306, 1, 0, 0, 0, 30, 308, 1, 0, 0, 0, 32, 321, 1, 0, 0, 0, 34, 323, 1, 0, 0, 0, 36, 325, 1, 0, 0, 0, 38, 348, 1, 0, 0, 0, 40, 350, 1, 0, 0, 0, 42, 352, 1, 0, 0, 0, 44, 355, 1, 0, 0, 0, 46, 357, 1, 0, 0, 0, 48, 374, 1, 0, 0, 0, 50, 377, 1, 0, 0, 0, 52, 382, 1, 0, 0, 0, 54, 402, 1, 0, 0, 0, 56, 404, 1, 0, 0, 0, 58, 408, 1, 0, 0, 0, 60, 426, 1, 0, 0, 0, 62, 428, 1, 0, 0, 0, 64, 432, 1, 0, 0, 0, 66, 439, 1, 0, 0, 0, 68, 450, 1, 0, 0, 0, 70, 453, 1, 0, 0, 0, 72, 463, 1, 0, 0, 0, 74, 540, 1, 0, 0, 0, 76, 549, 1, 0, 0, 0, 78, 551, 1, 0, 0, 0, 80, 558, 1, 0, 0, 0, 82, 577, 1, 0, 0, 0, 84, 582, 1, 0, 0, 0, 86, 585, 1, 0, 0, 0, 88, 594, 1, 0, 0, 0, 90, 600, 1, 0, 0, 0, 92, 612, 1, 0, 0, 0, 94, 614, 1, 0, 0, 0, 96, 620, 1, 0, 0, 0, 98, 623, 1, 0, 0, 0, 100, 625, 1, 0, 0, 0, 102, 633, 1, 0, 0, 0, 104, 641, 1, 0, 0, 0, 106, 649, 1, 0, 0, 0, 108, 652, 1, 0, 0, 0, 110, 655, 1, 0, 0, 0, 112, 660, 1, 0, 0, 0, 114, 664, 1, 0, 0, 0, 116, 671, 1, 0, 0, 0, 118, 685, 1, 0, 0, 0, 120, 702, 1, 0, 0, 0, 122, 704, 1, 0, 0, 0, 124, 709, 1, 0, 0, 0, 126, 721, 1, 0, 0, 0, 128, 729, 1, 0, 0, 0, 130, 737, 1, 0, 0, 0, 132, 746, 1, 0, 0, 0, 134, 763, 1, 0, 0, 0, 136, 774, 1, 0, 0, 0, 138, 776, 1, 0, 0, 0, 140, 782, 1, 0, 0, 0, 142, 788, 1, 0, 0, 0, 144, 796, 1, 0, 0, 0, 146, 798, 1, 0, 0, 0, 148, 806, 1, 0, 0, 0, 150, 808, 1, 0, 0, 0, 152, 818, 1, 0, 0, 0, 154, 827, 1, 0, 0, 0, 156, 835, 1, 0, 0, 0, 158, 840, 1, 0, 0, 0, 160, 847, 1, 0, 0, 0, 162, 855, 1, 0, 0, 0, 164, 869, 1, 0, 0, 0, 166, 874, 1, 0, 0, 0, 168, 169, 3, 116, 58, 0, 169, 170, 5, 0, 0, 1, 170, 1, 1, 0, 0, 0, 171, 172, 5, 104, 0, 0, 172, 3, 1, 0, 0, 0, 173, 178, 3, 2, 1, 0, 174, 175, 5, 52, 0, 0, 175, 177, 3, 2, 1, 0, 176, 174, 1, 0, 0, 0, 177, 180, 1, 0, 0, 0, 178, 176, 1, 0, 0, 0, 178, 179, 1, 0, 0, 0, 179, 5, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 181, 182, 7, 0, 0, 0, 182, 7, 1, 0, 0, 0, 183, 184, 3, 24, 12, 0, 184, 185, 3, 30, 15, 0, 185, 186, 3, 8, 4, 0, 186, 189, 1, 0, 0, 0, 187, 189, 3, 10, 5, 0, 188, 183, 1, 0, 0, 0, 188, 187, 1, 0, 0, 0, 189, 9, 1, 0, 0, 0, 190, 191, 3, 12, 6, 0, 191, 192, 5, 94, 0, 0, 192, 193, 3, 10, 5, 0, 193, 194, 5, 95, 0, 0, 194, 195, 3, 10, 5, 0, 195, 198, 1, 0, 0, 0, 196, 198, 3, 12, 6, 0, 197, 190, 1, 0, 0, 0, 197, 196, 1, 0, 0, 0, 198, 11, 1, 0, 0, 0, 199, 204, 3, 14, 7, 0, 200, 201, 5, 73, 0, 0, 201, 203, 3, 14, 7, 0, 202, 200, 1, 0, 0, 0, 203, 206, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 13, 1, 0, 0, 0, 206, 204, 1, 0, 0, 0, 207, 212, 3, 16, 8, 0, 208, 209, 5, 72, 0, 0, 209, 211, 3, 16, 8, 0, 210, 208, 1, 0, 0, 0, 211, 214, 1, 0, 0, 0, 212, 210, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 15, 1, 0, 0, 0, 214, 212, 1, 0, 0, 0, 215, 220, 3, 18, 9, 0, 216, 217, 7, 1, 0, 0, 217, 219, 3, 18, 9, 0, 218, 216, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 17, 1, 0, 0, 0, 222, 220, 1, 0, 0, 0, 223, 230, 3, 20, 10, 0, 224, 225, 7, 2, 0, 0, 225, 229, 3, 20, 10, 0, 226, 227, 5, 27, 0, 0, 227, 229, 3, 32, 16, 0, 228, 224, 1, 0, 0, 0, 228, 226, 1, 0, 0, 0, 229, 232, 1, 0, 0, 0, 230, 228, 1, 0, 0, 0, 230, 231, 1, 0, 0, 0, 231, 19, 1, 0, 0, 0, 232, 230, 1, 0, 0, 0, 233, 238, 3, 22, 11, 0, 234, 235, 7, 3, 0, 0, 235, 237, 3, 22, 11, 0, 236, 234, 1, 0, 0, 0, 237, 240, 1, 0, 0, 0, 238, 236, 1, 0, 0, 0, 238, 239, 1, 0, 0, 0, 239, 21, 1, 0, 0, 0, 240, 238, 1, 0, 0, 0, 241, 246, 3, 24, 12, 0, 242, 243, 7, 4, 0, 0, 243, 245, 3, 24, 12, 0, 244, 242, 1, 0, 0, 0, 245, 248, 1, 0, 0, 0, 246, 244, 1, 0, 0, 0, 246, 247, 1, 0, 0, 0, 247, 23, 1, 0, 0, 0, 248, 246, 1, 0, 0, 0, 249, 257, 3, 26, 13, 0, 250, 251, 7, 5, 0, 0, 251, 257, 3, 24, 12, 0, 252, 253, 3, 62, 31, 0, 253, 254, 3, 32, 16, 0, 254, 255, 3, 24, 12, 0, 255, 257, 1, 0, 0, 0, 256, 249, 1, 0, 0, 0, 256, 250, 1, 0, 0, 0, 256, 252, 1, 0, 0, 0, 257, 25, 1, 0, 0, 0, 258, 270, 3, 28, 14, 0, 259, 269, 5, 74, 0, 0, 260, 269, 5, 75, 0, 0, 261, 262, 5, 52, 0, 0, 262, 269, 5, 104, 0, 0, 263, 264, 5, 63, 0, 0, 264, 265, 3, 8, 4, 0, 265, 266, 5, 64, 0, 0, 266, 269, 1, 0, 0, 0, 267, 269, 3, 46, 23, 0, 268, 259, 1, 0, 0, 0, 268, 260, 1, 0, 0, 0, 268, 261, 1, 0, 0, 0, 268, 263, 1, 0, 0, 0, 268, 267, 1, 0, 0, 0, 269, 272, 1, 0, 0, 0, 270, 268, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 27, 1, 0, 0, 0, 272, 270, 1, 0, 0, 0, 273, 307, 3, 62, 31, 0, 274, 307, 5, 53, 0, 0, 275, 307, 5, 54, 0, 0, 276, 307, 5, 56, 0, 0, 277, 307, 5, 55, 0, 0, 278, 307, 5, 57, 0, 0, 279, 307, 5, 58, 0, 0, 280, 307, 5, 104, 0, 0, 281, 307, 5, 44, 0, 0, 282, 285, 5, 41, 0, 0, 283, 284, 5, 52, 0, 0, 284, 286, 5, 104, 0, 0, 285, 283, 1, 0, 0, 0, 285, 286, 1, 0, 0, 0, 286, 307, 1, 0, 0, 0, 287, 288, 5, 32, 0, 0, 288, 289, 3, 32, 16, 0, 289, 290, 3, 46, 23, 0, 290, 307, 1, 0, 0, 0, 291, 296, 3, 42, 21, 0, 292, 293, 5, 63, 0, 0, 293, 295, 5, 64, 0, 0, 294, 292, 1, 0, 0, 0, 295, 298, 1, 0, 0, 0, 296, 294, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 299, 1, 0, 0, 0, 298, 296, 1, 0, 0, 0, 299, 300, 5, 52, 0, 0, 300, 301, 5, 11, 0, 0, 301, 307, 1, 0, 0, 0, 302, 303, 3, 32, 16, 0, 303, 304, 5, 52, 0, 0, 304, 305, 5, 11, 0, 0, 305, 307, 1, 0, 0, 0, 306, 273, 1, 0, 0, 0, 306, 274, 1, 0, 0, 0, 306, 275, 1, 0, 0, 0, 306, 276, 1, 0, 0, 0, 306, 277, 1, 0, 0, 0, 306, 278, 1, 0, 0, 0, 306, 279, 1, 0, 0, 0, 306, 280, 1, 0, 0, 0, 306, 281, 1, 0, 0, 0, 306, 282, 1, 0, 0, 0, 306, 287, 1, 0, 0, 0, 306, 291, 1, 0, 0, 0, 306, 302, 1, 0, 0, 0, 307, 29, 1, 0, 0, 0, 308, 309, 7, 6, 0, 0, 309, 31, 1, 0, 0, 0, 310, 315, 3, 2, 1, 0, 311, 312, 5, 52, 0, 0, 312, 314, 3, 2, 1, 0, 313, 311, 1, 0, 0, 0, 314, 317, 1, 0, 0, 0, 315, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 318, 1, 0, 0, 0, 317, 315, 1, 0, 0, 0, 318, 319, 3, 48, 24, 0, 319, 322, 1, 0, 0, 0, 320, 322, 3, 42, 21, 0, 321, 310, 1, 0, 0, 0, 321, 320, 1, 0, 0, 0, 322, 33, 1, 0, 0, 0, 323, 324, 3, 8, 4, 0, 324, 35, 1, 0, 0, 0, 325, 326, 3, 8, 4, 0, 326, 37, 1, 0, 0, 0, 327, 328, 5, 63, 0, 0, 328, 329, 5, 64, 0, 0, 329, 330, 3, 48, 24, 0, 330, 331, 5, 52, 0, 0, 331, 332, 5, 11, 0, 0, 332, 349, 1, 0, 0, 0, 333, 334, 5, 63, 0, 0, 334, 335, 3, 8, 4, 0, 335, 336, 5, 64, 0, 0, 336, 349, 1, 0, 0, 0, 337, 349, 3, 46, 23, 0, 338, 346, 5, 52, 0, 0, 339, 347, 5, 11, 0, 0, 340, 347, 5, 44, 0, 0, 341, 342, 5, 41, 0, 0, 342, 343, 3, 46, 23, 0, 343, 344, 5, 32, 0, 0, 344, 345, 3, 52, 26, 0, 345, 347, 1, 0, 0, 0, 346, 339, 1, 0, 0, 0, 346, 340, 1, 0, 0, 0, 346, 341, 1, 0, 0, 0, 347, 349, 1, 0, 0, 0, 348, 327, 1, 0, 0, 0, 348, 333, 1, 0, 0, 0, 348, 337, 1, 0, 0, 0, 348, 338, 1, 0, 0, 0, 349, 39, 1, 0, 0, 0, 350, 351, 7, 7, 0, 0, 351, 41, 1, 0, 0, 0, 352, 353, 7, 8, 0, 0, 353, 43, 1, 0, 0, 0, 354, 356, 3, 46, 23, 0, 355, 354, 1, 0, 0, 0, 355, 356, 1, 0, 0, 0, 356, 45, 1, 0, 0, 0, 357, 366, 5, 59, 0, 0, 358, 363, 3, 8, 4, 0, 359, 360, 5, 66, 0, 0, 360, 362, 3, 8, 4, 0, 361, 359, 1, 0, 0, 0, 362, 365, 1, 0, 0, 0, 363, 361, 1, 0, 0, 0, 363, 364, 1, 0, 0, 0, 364, 367, 1, 0, 0, 0, 365, 363, 1, 0, 0, 0, 366, 358, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 369, 5, 60, 0, 0, 369, 47, 1, 0, 0, 0, 370, 371, 5, 63, 0, 0, 371, 373, 5, 64, 0, 0, 372, 370, 1, 0, 0, 0, 373, 376, 1, 0, 0, 0, 374, 372, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 49, 1, 0, 0, 0, 376, 374, 1, 0, 0, 0, 377, 380, 3, 4, 2, 0, 378, 381, 3, 54, 27, 0, 379, 381, 3, 56, 28, 0, 380, 378, 1, 0, 0, 0, 380, 379, 1, 0, 0, 0, 381, 51, 1, 0, 0, 0, 382, 383, 3, 2, 1, 0, 383, 384, 3, 56, 28, 0, 384, 53, 1, 0, 0, 0, 385, 386, 5, 63, 0, 0, 386, 387, 5, 64, 0, 0, 387, 388, 3, 48, 24, 0, 388, 389, 3, 58, 29, 0, 389, 403, 1, 0, 0, 0, 390, 391, 5, 63, 0, 0, 391, 392, 3, 8, 4, 0, 392, 399, 5, 64, 0, 0, 393, 394, 5, 63, 0, 0, 394, 395, 3, 8, 4, 0, 395, 396, 5, 64, 0, 0, 396, 398, 1, 0, 0, 0, 397, 393, 1, 0, 0, 0, 398, 401, 1, 0, 0, 0, 399, 397, 1, 0, 0, 0, 399, 400, 1, 0, 0, 0, 400, 403, 1, 0, 0, 0, 401, 399, 1, 0, 0, 0, 402, 385, 1, 0, 0, 0, 402, 390, 1, 0, 0, 0, 403, 55, 1, 0, 0, 0, 404, 406, 3, 46, 23, 0, 405, 407, 3, 130, 65, 0, 406, 405, 1, 0, 0, 0, 406, 407, 1, 0, 0, 0, 407, 57, 1, 0, 0, 0, 408, 420, 5, 61, 0, 0, 409, 414, 3, 60, 30, 0, 410, 411, 5, 66, 0, 0, 411, 413, 3, 60, 30, 0, 412, 410, 1, 0, 0, 0, 413, 416, 1, 0, 0, 0, 414, 412, 1, 0, 0, 0, 414, 415, 1, 0, 0, 0, 415, 418, 1, 0, 0, 0, 416, 414, 1, 0, 0, 0, 417, 419, 5, 66, 0, 0, 418, 417, 1, 0, 0, 0, 418, 419, 1, 0, 0, 0, 419, 421, 1, 0, 0, 0, 420, 409, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 422, 1, 0, 0, 0, 422, 423, 5, 62, 0, 0, 423, 59, 1, 0, 0, 0, 424, 427, 3, 58, 29, 0, 425, 427, 3, 8, 4, 0, 426, 424, 1, 0, 0, 0, 426, 425, 1, 0, 0, 0, 427, 61, 1, 0, 0, 0, 428, 429, 5, 59, 0, 0, 429, 430, 3, 8, 4, 0, 430, 431, 5, 60, 0, 0, 431, 63, 1, 0, 0, 0, 432, 433, 5, 61, 0, 0, 433, 434, 3, 66, 33, 0, 434, 435, 5, 62, 0, 0, 435, 65, 1, 0, 0, 0, 436, 438, 3, 68, 34, 0, 437, 436, 1, 0, 0, 0, 438, 441, 1, 0, 0, 0, 439, 437, 1, 0, 0, 0, 439, 440, 1, 0, 0, 0, 440, 67, 1, 0, 0, 0, 441, 439, 1, 0, 0, 0, 442, 451, 3, 70, 35, 0, 443, 451, 3, 122, 61, 0, 444, 445, 3, 2, 1, 0, 445, 446, 5, 95, 0, 0, 446, 448, 1, 0, 0, 0, 447, 444, 1, 0, 0, 0, 447, 448, 1, 0, 0, 0, 448, 449, 1, 0, 0, 0, 449, 451, 3, 72, 36, 0, 450, 442, 1, 0, 0, 0, 450, 443, 1, 0, 0, 0, 450, 447, 1, 0, 0, 0, 451, 69, 1, 0, 0, 0, 452, 454, 5, 19, 0, 0, 453, 452, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 455, 1, 0, 0, 0, 455, 456, 3, 32, 16, 0, 456, 457, 3, 100, 50, 0, 457, 71, 1, 0, 0, 0, 458, 464, 3, 76, 38, 0, 459, 460, 5, 24, 0, 0, 460, 461, 3, 62, 31, 0, 461, 462, 3, 74, 37, 0, 462, 464, 1, 0, 0, 0, 463, 458, 1, 0, 0, 0, 463, 459, 1, 0, 0, 0, 464, 73, 1, 0, 0, 0, 465, 541, 3, 64, 32, 0, 466, 467, 5, 24, 0, 0, 467, 468, 3, 62, 31, 0, 468, 469, 3, 76, 38, 0, 469, 470, 5, 17, 0, 0, 470, 471, 3, 74, 37, 0, 471, 541, 1, 0, 0, 0, 472, 473, 5, 22, 0, 0, 473, 475, 5, 59, 0, 0, 474, 476, 3, 92, 46, 0, 475, 474, 1, 0, 0, 0, 475, 476, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 479, 5, 65, 0, 0, 478, 480, 3, 8, 4, 0, 479, 478, 1, 0, 0, 0, 479, 480, 1, 0, 0, 0, 480, 481, 1, 0, 0, 0, 481, 483, 5, 65, 0, 0, 482, 484, 3, 94, 47, 0, 483, 482, 1, 0, 0, 0, 483, 484, 1, 0, 0, 0, 484, 485, 1, 0, 0, 0, 485, 486, 5, 60, 0, 0, 486, 541, 3, 72, 36, 0, 487, 488, 5, 51, 0, 0, 488, 489, 3, 62, 31, 0, 489, 490, 3, 72, 36, 0, 490, 541, 1, 0, 0, 0, 491, 492, 5, 15, 0, 0, 492, 493, 3, 72, 36, 0, 493, 494, 5, 51, 0, 0, 494, 495, 3, 62, 31, 0, 495, 496, 5, 65, 0, 0, 496, 541, 1, 0, 0, 0, 497, 498, 5, 48, 0, 0, 498, 499, 3, 64, 32, 0, 499, 500, 3, 78, 39, 0, 500, 541, 1, 0, 0, 0, 501, 502, 5, 48, 0, 0, 502, 503, 3, 64, 32, 0, 503, 504, 5, 20, 0, 0, 504, 505, 3, 64, 32, 0, 505, 541, 1, 0, 0, 0, 506, 507, 5, 48, 0, 0, 507, 508, 3, 64, 32, 0, 508, 509, 3, 78, 39, 0, 509, 510, 5, 20, 0, 0, 510, 511, 3, 64, 32, 0, 511, 541, 1, 0, 0, 0, 512, 541, 3, 82, 41, 0, 513, 514, 5, 43, 0, 0, 514, 515, 3, 62, 31, 0, 515, 516, 3, 64, 32, 0, 516, 541, 1, 0, 0, 0, 517, 519, 5, 37, 0, 0, 518, 520, 3, 8, 4, 0, 519, 518, 1, 0, 0, 0, 519, 520, 1, 0, 0, 0, 520, 521, 1, 0, 0, 0, 521, 541, 5, 65, 0, 0, 522, 523, 5, 45, 0, 0, 523, 524, 3, 8, 4, 0, 524, 525, 5, 65, 0, 0, 525, 541, 1, 0, 0, 0, 526, 528, 5, 6, 0, 0, 527, 529, 3, 2, 1, 0, 528, 527, 1, 0, 0, 0, 528, 529, 1, 0, 0, 0, 529, 530, 1, 0, 0, 0, 530, 541, 5, 65, 0, 0, 531, 533, 5, 13, 0, 0, 532, 534, 3, 2, 1, 0, 533, 532, 1, 0, 0, 0, 533, 534, 1, 0, 0, 0, 534, 535, 1, 0, 0, 0, 535, 541, 5, 65, 0, 0, 536, 537, 3, 34, 17, 0, 537, 538, 5, 65, 0, 0, 538, 541, 1, 0, 0, 0, 539, 541, 5, 65, 0, 0, 540, 465, 1, 0, 0, 0, 540, 466, 1, 0, 0, 0, 540, 472, 1, 0, 0, 0, 540, 487, 1, 0, 0, 0, 540, 491, 1, 0, 0, 0, 540, 497, 1, 0, 0, 0, 540, 501, 1, 0, 0, 0, 540, 506, 1, 0, 0, 0, 540, 512, 1, 0, 0, 0, 540, 513, 1, 0, 0, 0, 540, 517, 1, 0, 0, 0, 540, 522, 1, 0, 0, 0, 540, 526, 1, 0, 0, 0, 540, 531, 1, 0, 0, 0, 540, 536, 1, 0, 0, 0, 540, 539, 1, 0, 0, 0, 541, 75, 1, 0, 0, 0, 542, 543, 5, 24, 0, 0, 543, 544, 3, 62, 31, 0, 544, 545, 3, 76, 38, 0, 545, 546, 5, 17, 0, 0, 546, 547, 3, 76, 38, 0, 547, 550, 1, 0, 0, 0, 548, 550, 3, 74, 37, 0, 549, 542, 1, 0, 0, 0, 549, 548, 1, 0, 0, 0, 550, 77, 1, 0, 0, 0, 551, 555, 3, 80, 40, 0, 552, 554, 3, 80, 40, 0, 553, 552, 1, 0, 0, 0, 554, 557, 1, 0, 0, 0, 555, 553, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, 556, 79, 1, 0, 0, 0, 557, 555, 1, 0, 0, 0, 558, 559, 5, 9, 0, 0, 559, 560, 5, 59, 0, 0, 560, 561, 3, 164, 82, 0, 561, 562, 5, 60, 0, 0, 562, 563, 3, 64, 32, 0, 563, 81, 1, 0, 0, 0, 564, 565, 5, 42, 0, 0, 565, 566, 3, 62, 31, 0, 566, 567, 5, 61, 0, 0, 567, 568, 5, 62, 0, 0, 568, 578, 1, 0, 0, 0, 569, 570, 5, 42, 0, 0, 570, 571, 3, 62, 31, 0, 571, 573, 5, 61, 0, 0, 572, 574, 3, 84, 42, 0, 573, 572, 1, 0, 0, 0, 573, 574, 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, 576, 5, 62, 0, 0, 576, 578, 1, 0, 0, 0, 577, 564, 1, 0, 0, 0, 577, 569, 1, 0, 0, 0, 578, 83, 1, 0, 0, 0, 579, 581, 3, 86, 43, 0, 580, 579, 1, 0, 0, 0, 581, 584, 1, 0, 0, 0, 582, 580, 1, 0, 0, 0, 582, 583, 1, 0, 0, 0, 583, 85, 1, 0, 0, 0, 584, 582, 1, 0, 0, 0, 585, 586, 3, 88, 44, 0, 586, 587, 3, 66, 33, 0, 587, 87, 1, 0, 0, 0, 588, 589, 5, 8, 0, 0, 589, 590, 3, 36, 18, 0, 590, 591, 5, 95, 0, 0, 591, 595, 1, 0, 0, 0, 592, 593, 5, 14, 0, 0, 593, 595, 5, 95, 0, 0, 594, 588, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 595, 89, 1, 0, 0, 0, 596, 597, 5, 66, 0, 0, 597, 599, 3, 34, 17, 0, 598, 596, 1, 0, 0, 0, 599, 602, 1, 0, 0, 0, 600, 598, 1, 0, 0, 0, 600, 601, 1, 0, 0, 0, 601, 91, 1, 0, 0, 0, 602, 600, 1, 0, 0, 0, 603, 604, 3, 34, 17, 0, 604, 605, 3, 90, 45, 0, 605, 613, 1, 0, 0, 0, 606, 608, 5, 19, 0, 0, 607, 606, 1, 0, 0, 0, 607, 608, 1, 0, 0, 0, 608, 609, 1, 0, 0, 0, 609, 610, 3, 32, 16, 0, 610, 611, 3, 100, 50, 0, 611, 613, 1, 0, 0, 0, 612, 603, 1, 0, 0, 0, 612, 607, 1, 0, 0, 0, 613, 93, 1, 0, 0, 0, 614, 615, 3, 34, 17, 0, 615, 616, 3, 90, 45, 0, 616, 95, 1, 0, 0, 0, 617, 619, 3, 98, 49, 0, 618, 617, 1, 0, 0, 0, 619, 622, 1, 0, 0, 0, 620, 618, 1, 0, 0, 0, 620, 621, 1, 0, 0, 0, 621, 97, 1, 0, 0, 0, 622, 620, 1, 0, 0, 0, 623, 624, 7, 9, 0, 0, 624, 99, 1, 0, 0, 0, 625, 630, 3, 106, 53, 0, 626, 627, 5, 66, 0, 0, 627, 629, 3, 106, 53, 0, 628, 626, 1, 0, 0, 0, 629, 632, 1, 0, 0, 0, 630, 628, 1, 0, 0, 0, 630, 631, 1, 0, 0, 0, 631, 101, 1, 0, 0, 0, 632, 630, 1, 0, 0, 0, 633, 638, 3, 110, 55, 0, 634, 635, 5, 66, 0, 0, 635, 637, 3, 106, 53, 0, 636, 634, 1, 0, 0, 0, 637, 640, 1, 0, 0, 0, 638, 636, 1, 0, 0, 0, 638, 639, 1, 0, 0, 0, 639, 103, 1, 0, 0, 0, 640, 638, 1, 0, 0, 0, 641, 646, 3, 112, 56, 0, 642, 643, 5, 66, 0, 0, 643, 645, 3, 108, 54, 0, 644, 642, 1, 0, 0, 0, 645, 648, 1, 0, 0, 0, 646, 644, 1, 0, 0, 0, 646, 647, 1, 0, 0, 0, 647, 105, 1, 0, 0, 0, 648, 646, 1, 0, 0, 0, 649, 650, 3, 2, 1, 0, 650, 651, 3, 102, 51, 0, 651, 107, 1, 0, 0, 0, 652, 653, 3, 2, 1, 0, 653, 654, 3, 112, 56, 0, 654, 109, 1, 0, 0, 0, 655, 658, 3, 48, 24, 0, 656, 657, 5, 89, 0, 0, 657, 659, 3, 60, 30, 0, 658, 656, 1, 0, 0, 0, 658, 659, 1, 0, 0, 0, 659, 111, 1, 0, 0, 0, 660, 661, 3, 48, 24, 0, 661, 662, 5, 89, 0, 0, 662, 663, 3, 60, 30, 0, 663, 113, 1, 0, 0, 0, 664, 665, 3, 2, 1, 0, 665, 666, 3, 48, 24, 0, 666, 115, 1, 0, 0, 0, 667, 668, 5, 33, 0, 0, 668, 669, 3, 4, 2, 0, 669, 670, 5, 65, 0, 0, 670, 672, 1, 0, 0, 0, 671, 667, 1, 0, 0, 0, 671, 672, 1, 0, 0, 0, 672, 676, 1, 0, 0, 0, 673, 675, 3, 118, 59, 0, 674, 673, 1, 0, 0, 0, 675, 678, 1, 0, 0, 0, 676, 674, 1, 0, 0, 0, 676, 677, 1, 0, 0, 0, 677, 682, 1, 0, 0, 0, 678, 676, 1, 0, 0, 0, 679, 681, 3, 120, 60, 0, 680, 679, 1, 0, 0, 0, 681, 684, 1, 0, 0, 0, 682, 680, 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 117, 1, 0, 0, 0, 684, 682, 1, 0, 0, 0, 685, 686, 5, 26, 0, 0, 686, 691, 3, 2, 1, 0, 687, 688, 5, 52, 0, 0, 688, 690, 3, 2, 1, 0, 689, 687, 1, 0, 0, 0, 690, 693, 1, 0, 0, 0, 691, 689, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 696, 1, 0, 0, 0, 693, 691, 1, 0, 0, 0, 694, 695, 5, 52, 0, 0, 695, 697, 5, 98, 0, 0, 696, 694, 1, 0, 0, 0, 696, 697, 1, 0, 0, 0, 697, 698, 1, 0, 0, 0, 698, 699, 5, 65, 0, 0, 699, 119, 1, 0, 0, 0, 700, 703, 3, 122, 61, 0, 701, 703, 5, 65, 0, 0, 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, 703, 121, 1, 0, 0, 0, 704, 707, 3, 96, 48, 0, 705, 708, 3, 124, 62, 0, 706, 708, 3, 126, 63, 0, 707, 705, 1, 0, 0, 0, 707, 706, 1, 0, 0, 0, 708, 123, 1, 0, 0, 0, 709, 710, 5, 11, 0, 0, 710, 713, 3, 2, 1, 0, 711, 712, 5, 18, 0, 0, 712, 714, 3, 32, 16, 0, 713, 711, 1, 0, 0, 0, 713, 714, 1, 0, 0, 0, 714, 717, 1, 0, 0, 0, 715, 716, 5, 25, 0, 0, 716, 718, 3, 128, 64, 0, 717, 715, 1, 0, 0, 0, 717, 718, 1, 0, 0, 0, 718, 719, 1, 0, 0, 0, 719, 720, 3, 130, 65, 0, 720, 125, 1, 0, 0, 0, 721, 722, 5, 29, 0, 0, 722, 725, 3, 2, 1, 0, 723, 724, 5, 18, 0, 0, 724, 726, 3, 128, 64, 0, 725, 723, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 728, 3, 132, 66, 0, 728, 127, 1, 0, 0, 0, 729, 734, 3, 32, 16, 0, 730, 731, 5, 66, 0, 0, 731, 733, 3, 32, 16, 0, 732, 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 129, 1, 0, 0, 0, 736, 734, 1, 0, 0, 0, 737, 741, 5, 61, 0, 0, 738, 740, 3, 134, 67, 0, 739, 738, 1, 0, 0, 0, 740, 743, 1, 0, 0, 0, 741, 739, 1, 0, 0, 0, 741, 742, 1, 0, 0, 0, 742, 744, 1, 0, 0, 0, 743, 741, 1, 0, 0, 0, 744, 745, 5, 62, 0, 0, 745, 131, 1, 0, 0, 0, 746, 750, 5, 61, 0, 0, 747, 749, 3, 142, 71, 0, 748, 747, 1, 0, 0, 0, 749, 752, 1, 0, 0, 0, 750, 748, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 753, 1, 0, 0, 0, 752, 750, 1, 0, 0, 0, 753, 754, 5, 62, 0, 0, 754, 133, 1, 0, 0, 0, 755, 764, 5, 65, 0, 0, 756, 758, 5, 39, 0, 0, 757, 756, 1, 0, 0, 0, 757, 758, 1, 0, 0, 0, 758, 759, 1, 0, 0, 0, 759, 764, 3, 64, 32, 0, 760, 761, 3, 96, 48, 0, 761, 762, 3, 136, 68, 0, 762, 764, 1, 0, 0, 0, 763, 755, 1, 0, 0, 0, 763, 757, 1, 0, 0, 0, 763, 760, 1, 0, 0, 0, 764, 135, 1, 0, 0, 0, 765, 775, 3, 138, 69, 0, 766, 767, 5, 49, 0, 0, 767, 768, 3, 2, 1, 0, 768, 769, 3, 150, 75, 0, 769, 775, 1, 0, 0, 0, 770, 771, 3, 2, 1, 0, 771, 772, 3, 158, 79, 0, 772, 775, 1, 0, 0, 0, 773, 775, 3, 122, 61, 0, 774, 765, 1, 0, 0, 0, 774, 766, 1, 0, 0, 0, 774, 770, 1, 0, 0, 0, 774, 773, 1, 0, 0, 0, 775, 137, 1, 0, 0, 0, 776, 777, 3, 32, 16, 0, 777, 778, 3, 2, 1, 0, 778, 779, 3, 140, 70, 0, 779, 139, 1, 0, 0, 0, 780, 783, 3, 110, 55, 0, 781, 783, 3, 150, 75, 0, 782, 780, 1, 0, 0, 0, 782, 781, 1, 0, 0, 0, 783, 141, 1, 0, 0, 0, 784, 789, 5, 65, 0, 0, 785, 786, 3, 96, 48, 0, 786, 787, 3, 144, 72, 0, 787, 789, 1, 0, 0, 0, 788, 784, 1, 0, 0, 0, 788, 785, 1, 0, 0, 0, 789, 143, 1, 0, 0, 0, 790, 797, 3, 146, 73, 0, 791, 792, 5, 49, 0, 0, 792, 793, 3, 2, 1, 0, 793, 794, 3, 156, 78, 0, 794, 797, 1, 0, 0, 0, 795, 797, 3, 122, 61, 0, 796, 790, 1, 0, 0, 0, 796, 791, 1, 0, 0, 0, 796, 795, 1, 0, 0, 0, 797, 145, 1, 0, 0, 0, 798, 799, 3, 32, 16, 0, 799, 800, 3, 2, 1, 0, 800, 801, 3, 148, 74, 0, 801, 147, 1, 0, 0, 0, 802, 803, 3, 112, 56, 0, 803, 804, 5, 65, 0, 0, 804, 807, 1, 0, 0, 0, 805, 807, 3, 154, 77, 0, 806, 802, 1, 0, 0, 0, 806, 805, 1, 0, 0, 0, 807, 149, 1, 0, 0, 0, 808, 809, 3, 162, 81, 0, 809, 812, 3, 48, 24, 0, 810, 811, 5, 46, 0, 0, 811, 813, 3, 160, 80, 0, 812, 810, 1, 0, 0, 0, 812, 813, 1, 0, 0, 0, 813, 816, 1, 0, 0, 0, 814, 817, 3, 166, 83, 0, 815, 817, 5, 65, 0, 0, 816, 814, 1, 0, 0, 0, 816, 815, 1, 0, 0, 0, 817, 151, 1, 0, 0, 0, 818, 821, 3, 162, 81, 0, 819, 820, 5, 46, 0, 0, 820, 822, 3, 160, 80, 0, 821, 819, 1, 0, 0, 0, 821, 822, 1, 0, 0, 0, 822, 825, 1, 0, 0, 0, 823, 826, 3, 166, 83, 0, 824, 826, 5, 65, 0, 0, 825, 823, 1, 0, 0, 0, 825, 824, 1, 0, 0, 0, 826, 153, 1, 0, 0, 0, 827, 828, 3, 162, 81, 0, 828, 831, 3, 48, 24, 0, 829, 830, 5, 46, 0, 0, 830, 832, 3, 160, 80, 0, 831, 829, 1, 0, 0, 0, 831, 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, 5, 65, 0, 0, 834, 155, 1, 0, 0, 0, 835, 838, 3, 162, 81, 0, 836, 837, 5, 46, 0, 0, 837, 839, 3, 160, 80, 0, 838, 836, 1, 0, 0, 0, 838, 839, 1, 0, 0, 0, 839, 157, 1, 0, 0, 0, 840, 843, 3, 162, 81, 0, 841, 842, 5, 46, 0, 0, 842, 844, 3, 160, 80, 0, 843, 841, 1, 0, 0, 0, 843, 844, 1, 0, 0, 0, 844, 845, 1, 0, 0, 0, 845, 846, 3, 166, 83, 0, 846, 159, 1, 0, 0, 0, 847, 852, 3, 4, 2, 0, 848, 849, 5, 66, 0, 0, 849, 851, 3, 4, 2, 0, 850, 848, 1, 0, 0, 0, 851, 854, 1, 0, 0, 0, 852, 850, 1, 0, 0, 0, 852, 853, 1, 0, 0, 0, 853, 161, 1, 0, 0, 0, 854, 852, 1, 0, 0, 0, 855, 864, 5, 59, 0, 0, 856, 861, 3, 164, 82, 0, 857, 858, 5, 66, 0, 0, 858, 860, 3, 164, 82, 0, 859, 857, 1, 0, 0, 0, 860, 863, 1, 0, 0, 0, 861, 859, 1, 0, 0, 0, 861, 862, 1, 0, 0, 0, 862, 865, 1, 0, 0, 0, 863, 861, 1, 0, 0, 0, 864, 856, 1, 0, 0, 0, 864, 865, 1, 0, 0, 0, 865, 866, 1, 0, 0, 0, 866, 867, 5, 60, 0, 0, 867, 163, 1, 0, 0, 0, 868, 870, 5, 19, 0, 0, 869, 868, 1, 0, 0, 0, 869, 870, 1, 0, 0, 0, 870, 871, 1, 0, 0, 0, 871, 872, 3, 32, 16, 0, 872, 873, 3, 114, 57, 0, 873, 165, 1, 0, 0, 0, 874, 875, 3, 64, 32, 0, 875, 167, 1, 0, 0, 0, 89, 178, 188, 197, 204, 212, 220, 228, 230, 238, 246, 256, 268, 270, 285, 296, 306, 315, 321, 346, 348, 355, 363, 366, 374, 380, 399, 402, 406, 414, 418, 420, 426, 439, 447, 450, 453, 463, 475, 479, 483, 519, 528, 533, 540, 549, 555, 573, 577, 582, 594, 600, 607, 612, 620, 630, 638, 646, 658, 671, 676, 682, 691, 696, 702, 707, 713, 717, 725, 734, 741, 750, 757, 763, 774, 782, 788, 796, 806, 812, 816, 821, 825, 831, 838, 843, 852, 861, 864, 869] \ No newline at end of file diff --git a/Assignment-1/ExprParser.java b/Assignment-1/ExprParser.java new file mode 100644 index 0000000..25cfaf9 --- /dev/null +++ b/Assignment-1/ExprParser.java @@ -0,0 +1,6735 @@ +// Generated from ExprParser.g4 by ANTLR 4.13.2 +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.misc.*; +import org.antlr.v4.runtime.tree.*; +import java.util.List; +import java.util.Iterator; +import java.util.ArrayList; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) +public class ExprParser extends Parser { + static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + WhiteSpace=1, Comment=2, Abstract=3, Assert=4, Boolean=5, Break=6, Byte=7, + Case=8, Catch=9, Char=10, Class=11, Const=12, Continue=13, Default=14, + Do=15, Double=16, Else=17, Extends=18, Final=19, Finally=20, Float=21, + For=22, Goto=23, If=24, Implements=25, Import=26, InstanceOf=27, Int=28, + Interface=29, Long=30, Native=31, New=32, Package=33, Private=34, Protected=35, + Public=36, Return=37, Short=38, Static=39, Strictfp=40, Super=41, Switch=42, + Synchronized=43, This=44, Throw=45, Throws=46, Transient=47, Try=48, Void=49, + Volatile=50, While=51, Dot=52, IntegerLiteral=53, FloatingPointLiteral=54, + CharacterLiteral=55, StringLiteral=56, BooleanLiteral=57, NullLiteral=58, + ParenthesesLeft=59, ParenthesesRight=60, CurlyBracketLeft=61, CurlyBracketRight=62, + SquareBracketLeft=63, SquareBracketRight=64, Semicolon=65, Comma=66, UnsignedRightShiftAssign=67, + EqualTo=68, NotEqualTo=69, LessThanEqualTo=70, GreaterThanEqualTo=71, + ConditionalAND=72, ConditionalOR=73, Increment=74, Decrement=75, LeftShift=76, + SignedRightShift=77, UnsignedRightShift=78, AddAssign=79, SubtractAssign=80, + MultiplyAssign=81, DivideAssign=82, BitwiseANDAssign=83, BitwiseORAssign=84, + BitwiseXORAssign=85, RemainderAssign=86, LeftShiftAssign=87, SignedRightShiftAssign=88, + Assignment=89, BitwiseComplement=90, LessThan=91, GreaterThan=92, LogicalComplement=93, + Question=94, Colon=95, Addition=96, Subtraction=97, Multiplication=98, + Division=99, BitwiseAND=100, BitwiseOR=101, BitwiseXOR=102, Remainder=103, + IDENTIFIER=104; + public static final int + RULE_prog = 0, RULE_identifier = 1, RULE_qualifiedIdentifier = 2, RULE_literal = 3, + RULE_expression = 4, RULE_conditionalExpr = 5, RULE_logicalOrExpr = 6, + RULE_logicalAndExpr = 7, RULE_equalityExpr = 8, RULE_relationalExpr = 9, + RULE_additiveExpr = 10, RULE_multiplicativeExpr = 11, RULE_unaryExpr = 12, + RULE_postfixExpr = 13, RULE_primaryExpr = 14, RULE_assignmentOperator = 15, + RULE_type = 16, RULE_statementExpression = 17, RULE_constantExpression = 18, + RULE_identifierSuffix = 19, RULE_postfixOp = 20, RULE_primitiveType = 21, + RULE_argumentsOpt = 22, RULE_arguments = 23, RULE_bracketsOpt = 24, RULE_creator = 25, + RULE_innerCreator = 26, RULE_arrayCreatorRest = 27, RULE_classCreatorRest = 28, + RULE_arrayInitializer = 29, RULE_variableInitializer = 30, RULE_parExpression = 31, + RULE_block = 32, RULE_blockStatements = 33, RULE_blockStatement = 34, + RULE_localVariableDeclarationStatement = 35, RULE_statement = 36, RULE_statementIncompleteIf = 37, + RULE_completeIf = 38, RULE_catches = 39, RULE_catchClause = 40, RULE_switchStatement = 41, + RULE_switchBlockStatementGroups = 42, RULE_switchBlockStatementGroup = 43, + RULE_switchLabel = 44, RULE_moreStatementExpressions = 45, RULE_forInit = 46, + RULE_forUpdate = 47, RULE_modifiersOpt = 48, RULE_modifier = 49, RULE_variableDeclarators = 50, + RULE_variableDeclaratorsRest = 51, RULE_constantDeclaratorsRest = 52, + RULE_variableDeclarator = 53, RULE_constantDeclarator = 54, RULE_variableDeclaratorRest = 55, + RULE_constantDeclaratorRest = 56, RULE_variableDeclaratorId = 57, RULE_compilationUnit = 58, + RULE_importDeclaration = 59, RULE_typeDeclaration = 60, RULE_classOrInterfaceDeclaration = 61, + RULE_classDeclaration = 62, RULE_interfaceDeclaration = 63, RULE_typeList = 64, + RULE_classBody = 65, RULE_interfaceBody = 66, RULE_classBodyDeclaration = 67, + RULE_memberDecl = 68, RULE_methodOrFieldDecl = 69, RULE_methodOrFieldRest = 70, + RULE_interfaceBodyDeclaration = 71, RULE_interfaceMemberDecl = 72, RULE_interfaceMethodOrFieldDecl = 73, + RULE_interfaceMethodOrFieldRest = 74, RULE_methodDeclaratorRest = 75, + RULE_voidMethodDeclaratorRest = 76, RULE_interfaceMethodDeclaratorRest = 77, + RULE_voidInterfaceMethodDeclaratorRest = 78, RULE_constructorDeclaratorRest = 79, + RULE_qualifiedIdentifierList = 80, RULE_formalParameters = 81, RULE_formalParameter = 82, + RULE_methodBody = 83; + private static String[] makeRuleNames() { + return new String[] { + "prog", "identifier", "qualifiedIdentifier", "literal", "expression", + "conditionalExpr", "logicalOrExpr", "logicalAndExpr", "equalityExpr", + "relationalExpr", "additiveExpr", "multiplicativeExpr", "unaryExpr", + "postfixExpr", "primaryExpr", "assignmentOperator", "type", "statementExpression", + "constantExpression", "identifierSuffix", "postfixOp", "primitiveType", + "argumentsOpt", "arguments", "bracketsOpt", "creator", "innerCreator", + "arrayCreatorRest", "classCreatorRest", "arrayInitializer", "variableInitializer", + "parExpression", "block", "blockStatements", "blockStatement", "localVariableDeclarationStatement", + "statement", "statementIncompleteIf", "completeIf", "catches", "catchClause", + "switchStatement", "switchBlockStatementGroups", "switchBlockStatementGroup", + "switchLabel", "moreStatementExpressions", "forInit", "forUpdate", "modifiersOpt", + "modifier", "variableDeclarators", "variableDeclaratorsRest", "constantDeclaratorsRest", + "variableDeclarator", "constantDeclarator", "variableDeclaratorRest", + "constantDeclaratorRest", "variableDeclaratorId", "compilationUnit", + "importDeclaration", "typeDeclaration", "classOrInterfaceDeclaration", + "classDeclaration", "interfaceDeclaration", "typeList", "classBody", + "interfaceBody", "classBodyDeclaration", "memberDecl", "methodOrFieldDecl", + "methodOrFieldRest", "interfaceBodyDeclaration", "interfaceMemberDecl", + "interfaceMethodOrFieldDecl", "interfaceMethodOrFieldRest", "methodDeclaratorRest", + "voidMethodDeclaratorRest", "interfaceMethodDeclaratorRest", "voidInterfaceMethodDeclaratorRest", + "constructorDeclaratorRest", "qualifiedIdentifierList", "formalParameters", + "formalParameter", "methodBody" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, null, null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", + "'case'", "'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'", + "'do'", "'double'", "'else'", "'extends'", "'final'", "'finally'", "'float'", + "'for'", "'goto'", "'if'", "'implements'", "'import'", "'instanceof'", + "'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'", + "'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'", + "'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'", + "'transient'", "'try'", "'void'", "'volatile'", "'while'", "'.'", null, + null, null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", + "']'", "';'", "','", "'>>>='", "'=='", "'!='", "'<='", "'>='", "'&&'", + "'||'", "'++'", "'--'", "'<<'", "'>>'", "'>>>'", "'+='", "'-='", "'*='", + "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='", "'='", "'~'", + "'<'", "'>'", "'!'", "'?'", "':'", "'+'", "'-'", "'*'", "'/'", "'&'", + "'|'", "'^'", "'%'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "WhiteSpace", "Comment", "Abstract", "Assert", "Boolean", "Break", + "Byte", "Case", "Catch", "Char", "Class", "Const", "Continue", "Default", + "Do", "Double", "Else", "Extends", "Final", "Finally", "Float", "For", + "Goto", "If", "Implements", "Import", "InstanceOf", "Int", "Interface", + "Long", "Native", "New", "Package", "Private", "Protected", "Public", + "Return", "Short", "Static", "Strictfp", "Super", "Switch", "Synchronized", + "This", "Throw", "Throws", "Transient", "Try", "Void", "Volatile", "While", + "Dot", "IntegerLiteral", "FloatingPointLiteral", "CharacterLiteral", + "StringLiteral", "BooleanLiteral", "NullLiteral", "ParenthesesLeft", + "ParenthesesRight", "CurlyBracketLeft", "CurlyBracketRight", "SquareBracketLeft", + "SquareBracketRight", "Semicolon", "Comma", "UnsignedRightShiftAssign", + "EqualTo", "NotEqualTo", "LessThanEqualTo", "GreaterThanEqualTo", "ConditionalAND", + "ConditionalOR", "Increment", "Decrement", "LeftShift", "SignedRightShift", + "UnsignedRightShift", "AddAssign", "SubtractAssign", "MultiplyAssign", + "DivideAssign", "BitwiseANDAssign", "BitwiseORAssign", "BitwiseXORAssign", + "RemainderAssign", "LeftShiftAssign", "SignedRightShiftAssign", "Assignment", + "BitwiseComplement", "LessThan", "GreaterThan", "LogicalComplement", + "Question", "Colon", "Addition", "Subtraction", "Multiplication", "Division", + "BitwiseAND", "BitwiseOR", "BitwiseXOR", "Remainder", "IDENTIFIER" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { return "ExprParser.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public ATN getATN() { return _ATN; } + + public ExprParser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @SuppressWarnings("CheckReturnValue") + public static class ProgContext extends ParserRuleContext { + public CompilationUnitContext compilationUnit() { + return getRuleContext(CompilationUnitContext.class,0); + } + public TerminalNode EOF() { return getToken(ExprParser.EOF, 0); } + public ProgContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_prog; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterProg(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitProg(this); + } + } + + public final ProgContext prog() throws RecognitionException { + ProgContext _localctx = new ProgContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_prog); + try { + enterOuterAlt(_localctx, 1); + { + setState(168); + compilationUnit(); + setState(169); + match(EOF); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class IdentifierContext extends ParserRuleContext { + public TerminalNode IDENTIFIER() { return getToken(ExprParser.IDENTIFIER, 0); } + public IdentifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_identifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterIdentifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitIdentifier(this); + } + } + + public final IdentifierContext identifier() throws RecognitionException { + IdentifierContext _localctx = new IdentifierContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_identifier); + try { + enterOuterAlt(_localctx, 1); + { + setState(171); + match(IDENTIFIER); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class QualifiedIdentifierContext extends ParserRuleContext { + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public List Dot() { return getTokens(ExprParser.Dot); } + public TerminalNode Dot(int i) { + return getToken(ExprParser.Dot, i); + } + public QualifiedIdentifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_qualifiedIdentifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterQualifiedIdentifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitQualifiedIdentifier(this); + } + } + + public final QualifiedIdentifierContext qualifiedIdentifier() throws RecognitionException { + QualifiedIdentifierContext _localctx = new QualifiedIdentifierContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_qualifiedIdentifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(173); + identifier(); + setState(178); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Dot) { + { + { + setState(174); + match(Dot); + setState(175); + identifier(); + } + } + setState(180); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LiteralContext extends ParserRuleContext { + public TerminalNode IntegerLiteral() { return getToken(ExprParser.IntegerLiteral, 0); } + public TerminalNode FloatingPointLiteral() { return getToken(ExprParser.FloatingPointLiteral, 0); } + public TerminalNode CharacterLiteral() { return getToken(ExprParser.CharacterLiteral, 0); } + public TerminalNode StringLiteral() { return getToken(ExprParser.StringLiteral, 0); } + public TerminalNode BooleanLiteral() { return getToken(ExprParser.BooleanLiteral, 0); } + public TerminalNode NullLiteral() { return getToken(ExprParser.NullLiteral, 0); } + public LiteralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_literal; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitLiteral(this); + } + } + + public final LiteralContext literal() throws RecognitionException { + LiteralContext _localctx = new LiteralContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_literal); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(181); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 567453553048682496L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExpressionContext extends ParserRuleContext { + public UnaryExprContext unaryExpr() { + return getRuleContext(UnaryExprContext.class,0); + } + public AssignmentOperatorContext assignmentOperator() { + return getRuleContext(AssignmentOperatorContext.class,0); + } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public ConditionalExprContext conditionalExpr() { + return getRuleContext(ConditionalExprContext.class,0); + } + public ExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_expression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitExpression(this); + } + } + + public final ExpressionContext expression() throws RecognitionException { + ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_expression); + try { + setState(188); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(183); + unaryExpr(); + setState(184); + assignmentOperator(); + setState(185); + expression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(187); + conditionalExpr(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConditionalExprContext extends ParserRuleContext { + public LogicalOrExprContext logicalOrExpr() { + return getRuleContext(LogicalOrExprContext.class,0); + } + public TerminalNode Question() { return getToken(ExprParser.Question, 0); } + public List conditionalExpr() { + return getRuleContexts(ConditionalExprContext.class); + } + public ConditionalExprContext conditionalExpr(int i) { + return getRuleContext(ConditionalExprContext.class,i); + } + public TerminalNode Colon() { return getToken(ExprParser.Colon, 0); } + public ConditionalExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_conditionalExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterConditionalExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitConditionalExpr(this); + } + } + + public final ConditionalExprContext conditionalExpr() throws RecognitionException { + ConditionalExprContext _localctx = new ConditionalExprContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_conditionalExpr); + try { + setState(197); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(190); + logicalOrExpr(); + setState(191); + match(Question); + setState(192); + conditionalExpr(); + setState(193); + match(Colon); + setState(194); + conditionalExpr(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(196); + logicalOrExpr(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LogicalOrExprContext extends ParserRuleContext { + public List logicalAndExpr() { + return getRuleContexts(LogicalAndExprContext.class); + } + public LogicalAndExprContext logicalAndExpr(int i) { + return getRuleContext(LogicalAndExprContext.class,i); + } + public List ConditionalOR() { return getTokens(ExprParser.ConditionalOR); } + public TerminalNode ConditionalOR(int i) { + return getToken(ExprParser.ConditionalOR, i); + } + public LogicalOrExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_logicalOrExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterLogicalOrExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitLogicalOrExpr(this); + } + } + + public final LogicalOrExprContext logicalOrExpr() throws RecognitionException { + LogicalOrExprContext _localctx = new LogicalOrExprContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_logicalOrExpr); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(199); + logicalAndExpr(); + setState(204); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==ConditionalOR) { + { + { + setState(200); + match(ConditionalOR); + setState(201); + logicalAndExpr(); + } + } + setState(206); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LogicalAndExprContext extends ParserRuleContext { + public List equalityExpr() { + return getRuleContexts(EqualityExprContext.class); + } + public EqualityExprContext equalityExpr(int i) { + return getRuleContext(EqualityExprContext.class,i); + } + public List ConditionalAND() { return getTokens(ExprParser.ConditionalAND); } + public TerminalNode ConditionalAND(int i) { + return getToken(ExprParser.ConditionalAND, i); + } + public LogicalAndExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_logicalAndExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterLogicalAndExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitLogicalAndExpr(this); + } + } + + public final LogicalAndExprContext logicalAndExpr() throws RecognitionException { + LogicalAndExprContext _localctx = new LogicalAndExprContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_logicalAndExpr); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(207); + equalityExpr(); + setState(212); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==ConditionalAND) { + { + { + setState(208); + match(ConditionalAND); + setState(209); + equalityExpr(); + } + } + setState(214); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class EqualityExprContext extends ParserRuleContext { + public List relationalExpr() { + return getRuleContexts(RelationalExprContext.class); + } + public RelationalExprContext relationalExpr(int i) { + return getRuleContext(RelationalExprContext.class,i); + } + public List EqualTo() { return getTokens(ExprParser.EqualTo); } + public TerminalNode EqualTo(int i) { + return getToken(ExprParser.EqualTo, i); + } + public List NotEqualTo() { return getTokens(ExprParser.NotEqualTo); } + public TerminalNode NotEqualTo(int i) { + return getToken(ExprParser.NotEqualTo, i); + } + public EqualityExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_equalityExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterEqualityExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitEqualityExpr(this); + } + } + + public final EqualityExprContext equalityExpr() throws RecognitionException { + EqualityExprContext _localctx = new EqualityExprContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_equalityExpr); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(215); + relationalExpr(); + setState(220); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==EqualTo || _la==NotEqualTo) { + { + { + setState(216); + _la = _input.LA(1); + if ( !(_la==EqualTo || _la==NotEqualTo) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(217); + relationalExpr(); + } + } + setState(222); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RelationalExprContext extends ParserRuleContext { + public List additiveExpr() { + return getRuleContexts(AdditiveExprContext.class); + } + public AdditiveExprContext additiveExpr(int i) { + return getRuleContext(AdditiveExprContext.class,i); + } + public List InstanceOf() { return getTokens(ExprParser.InstanceOf); } + public TerminalNode InstanceOf(int i) { + return getToken(ExprParser.InstanceOf, i); + } + public List type() { + return getRuleContexts(TypeContext.class); + } + public TypeContext type(int i) { + return getRuleContext(TypeContext.class,i); + } + public List LessThan() { return getTokens(ExprParser.LessThan); } + public TerminalNode LessThan(int i) { + return getToken(ExprParser.LessThan, i); + } + public List GreaterThan() { return getTokens(ExprParser.GreaterThan); } + public TerminalNode GreaterThan(int i) { + return getToken(ExprParser.GreaterThan, i); + } + public List LessThanEqualTo() { return getTokens(ExprParser.LessThanEqualTo); } + public TerminalNode LessThanEqualTo(int i) { + return getToken(ExprParser.LessThanEqualTo, i); + } + public List GreaterThanEqualTo() { return getTokens(ExprParser.GreaterThanEqualTo); } + public TerminalNode GreaterThanEqualTo(int i) { + return getToken(ExprParser.GreaterThanEqualTo, i); + } + public RelationalExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_relationalExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterRelationalExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitRelationalExpr(this); + } + } + + public final RelationalExprContext relationalExpr() throws RecognitionException { + RelationalExprContext _localctx = new RelationalExprContext(_ctx, getState()); + enterRule(_localctx, 18, RULE_relationalExpr); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(223); + additiveExpr(); + setState(230); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==InstanceOf || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & 6291459L) != 0)) { + { + setState(228); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LessThanEqualTo: + case GreaterThanEqualTo: + case LessThan: + case GreaterThan: + { + setState(224); + _la = _input.LA(1); + if ( !(((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & 6291459L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(225); + additiveExpr(); + } + break; + case InstanceOf: + { + setState(226); + match(InstanceOf); + setState(227); + type(); + } + break; + default: + throw new NoViableAltException(this); + } + } + setState(232); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AdditiveExprContext extends ParserRuleContext { + public List multiplicativeExpr() { + return getRuleContexts(MultiplicativeExprContext.class); + } + public MultiplicativeExprContext multiplicativeExpr(int i) { + return getRuleContext(MultiplicativeExprContext.class,i); + } + public List Addition() { return getTokens(ExprParser.Addition); } + public TerminalNode Addition(int i) { + return getToken(ExprParser.Addition, i); + } + public List Subtraction() { return getTokens(ExprParser.Subtraction); } + public TerminalNode Subtraction(int i) { + return getToken(ExprParser.Subtraction, i); + } + public AdditiveExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_additiveExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterAdditiveExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitAdditiveExpr(this); + } + } + + public final AdditiveExprContext additiveExpr() throws RecognitionException { + AdditiveExprContext _localctx = new AdditiveExprContext(_ctx, getState()); + enterRule(_localctx, 20, RULE_additiveExpr); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(233); + multiplicativeExpr(); + setState(238); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,8,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(234); + _la = _input.LA(1); + if ( !(_la==Addition || _la==Subtraction) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(235); + multiplicativeExpr(); + } + } + } + setState(240); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,8,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MultiplicativeExprContext extends ParserRuleContext { + public List unaryExpr() { + return getRuleContexts(UnaryExprContext.class); + } + public UnaryExprContext unaryExpr(int i) { + return getRuleContext(UnaryExprContext.class,i); + } + public List Multiplication() { return getTokens(ExprParser.Multiplication); } + public TerminalNode Multiplication(int i) { + return getToken(ExprParser.Multiplication, i); + } + public List Division() { return getTokens(ExprParser.Division); } + public TerminalNode Division(int i) { + return getToken(ExprParser.Division, i); + } + public List Remainder() { return getTokens(ExprParser.Remainder); } + public TerminalNode Remainder(int i) { + return getToken(ExprParser.Remainder, i); + } + public MultiplicativeExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_multiplicativeExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMultiplicativeExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMultiplicativeExpr(this); + } + } + + public final MultiplicativeExprContext multiplicativeExpr() throws RecognitionException { + MultiplicativeExprContext _localctx = new MultiplicativeExprContext(_ctx, getState()); + enterRule(_localctx, 22, RULE_multiplicativeExpr); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(241); + unaryExpr(); + setState(246); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 98)) & ~0x3f) == 0 && ((1L << (_la - 98)) & 35L) != 0)) { + { + { + setState(242); + _la = _input.LA(1); + if ( !(((((_la - 98)) & ~0x3f) == 0 && ((1L << (_la - 98)) & 35L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(243); + unaryExpr(); + } + } + setState(248); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class UnaryExprContext extends ParserRuleContext { + public PostfixExprContext postfixExpr() { + return getRuleContext(PostfixExprContext.class,0); + } + public UnaryExprContext unaryExpr() { + return getRuleContext(UnaryExprContext.class,0); + } + public TerminalNode Addition() { return getToken(ExprParser.Addition, 0); } + public TerminalNode Subtraction() { return getToken(ExprParser.Subtraction, 0); } + public TerminalNode LogicalComplement() { return getToken(ExprParser.LogicalComplement, 0); } + public TerminalNode BitwiseComplement() { return getToken(ExprParser.BitwiseComplement, 0); } + public TerminalNode Increment() { return getToken(ExprParser.Increment, 0); } + public TerminalNode Decrement() { return getToken(ExprParser.Decrement, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public UnaryExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_unaryExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterUnaryExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitUnaryExpr(this); + } + } + + public final UnaryExprContext unaryExpr() throws RecognitionException { + UnaryExprContext _localctx = new UnaryExprContext(_ctx, getState()); + enterRule(_localctx, 24, RULE_unaryExpr); + int _la; + try { + setState(256); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,10,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(249); + postfixExpr(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(250); + _la = _input.LA(1); + if ( !(((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 13172739L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(251); + unaryExpr(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(252); + parExpression(); + setState(253); + type(); + setState(254); + unaryExpr(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PostfixExprContext extends ParserRuleContext { + public PrimaryExprContext primaryExpr() { + return getRuleContext(PrimaryExprContext.class,0); + } + public List Increment() { return getTokens(ExprParser.Increment); } + public TerminalNode Increment(int i) { + return getToken(ExprParser.Increment, i); + } + public List Decrement() { return getTokens(ExprParser.Decrement); } + public TerminalNode Decrement(int i) { + return getToken(ExprParser.Decrement, i); + } + public List Dot() { return getTokens(ExprParser.Dot); } + public TerminalNode Dot(int i) { + return getToken(ExprParser.Dot, i); + } + public List IDENTIFIER() { return getTokens(ExprParser.IDENTIFIER); } + public TerminalNode IDENTIFIER(int i) { + return getToken(ExprParser.IDENTIFIER, i); + } + public List SquareBracketLeft() { return getTokens(ExprParser.SquareBracketLeft); } + public TerminalNode SquareBracketLeft(int i) { + return getToken(ExprParser.SquareBracketLeft, i); + } + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public List SquareBracketRight() { return getTokens(ExprParser.SquareBracketRight); } + public TerminalNode SquareBracketRight(int i) { + return getToken(ExprParser.SquareBracketRight, i); + } + public List arguments() { + return getRuleContexts(ArgumentsContext.class); + } + public ArgumentsContext arguments(int i) { + return getRuleContext(ArgumentsContext.class,i); + } + public PostfixExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_postfixExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterPostfixExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitPostfixExpr(this); + } + } + + public final PostfixExprContext postfixExpr() throws RecognitionException { + PostfixExprContext _localctx = new PostfixExprContext(_ctx, getState()); + enterRule(_localctx, 26, RULE_postfixExpr); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(258); + primaryExpr(); + setState(270); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,12,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + setState(268); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Increment: + { + setState(259); + match(Increment); + } + break; + case Decrement: + { + setState(260); + match(Decrement); + } + break; + case Dot: + { + setState(261); + match(Dot); + setState(262); + match(IDENTIFIER); + } + break; + case SquareBracketLeft: + { + setState(263); + match(SquareBracketLeft); + setState(264); + expression(); + setState(265); + match(SquareBracketRight); + } + break; + case ParenthesesLeft: + { + setState(267); + arguments(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + setState(272); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,12,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PrimaryExprContext extends ParserRuleContext { + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public TerminalNode IntegerLiteral() { return getToken(ExprParser.IntegerLiteral, 0); } + public TerminalNode FloatingPointLiteral() { return getToken(ExprParser.FloatingPointLiteral, 0); } + public TerminalNode StringLiteral() { return getToken(ExprParser.StringLiteral, 0); } + public TerminalNode CharacterLiteral() { return getToken(ExprParser.CharacterLiteral, 0); } + public TerminalNode BooleanLiteral() { return getToken(ExprParser.BooleanLiteral, 0); } + public TerminalNode NullLiteral() { return getToken(ExprParser.NullLiteral, 0); } + public TerminalNode IDENTIFIER() { return getToken(ExprParser.IDENTIFIER, 0); } + public TerminalNode This() { return getToken(ExprParser.This, 0); } + public TerminalNode Super() { return getToken(ExprParser.Super, 0); } + public TerminalNode Dot() { return getToken(ExprParser.Dot, 0); } + public TerminalNode New() { return getToken(ExprParser.New, 0); } + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public PrimitiveTypeContext primitiveType() { + return getRuleContext(PrimitiveTypeContext.class,0); + } + public TerminalNode Class() { return getToken(ExprParser.Class, 0); } + public List SquareBracketLeft() { return getTokens(ExprParser.SquareBracketLeft); } + public TerminalNode SquareBracketLeft(int i) { + return getToken(ExprParser.SquareBracketLeft, i); + } + public List SquareBracketRight() { return getTokens(ExprParser.SquareBracketRight); } + public TerminalNode SquareBracketRight(int i) { + return getToken(ExprParser.SquareBracketRight, i); + } + public PrimaryExprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_primaryExpr; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterPrimaryExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitPrimaryExpr(this); + } + } + + public final PrimaryExprContext primaryExpr() throws RecognitionException { + PrimaryExprContext _localctx = new PrimaryExprContext(_ctx, getState()); + enterRule(_localctx, 28, RULE_primaryExpr); + int _la; + try { + setState(306); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(273); + parExpression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(274); + match(IntegerLiteral); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(275); + match(FloatingPointLiteral); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(276); + match(StringLiteral); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(277); + match(CharacterLiteral); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(278); + match(BooleanLiteral); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(279); + match(NullLiteral); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(280); + match(IDENTIFIER); + } + break; + case 9: + enterOuterAlt(_localctx, 9); + { + setState(281); + match(This); + } + break; + case 10: + enterOuterAlt(_localctx, 10); + { + setState(282); + match(Super); + setState(285); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { + case 1: + { + setState(283); + match(Dot); + setState(284); + match(IDENTIFIER); + } + break; + } + } + break; + case 11: + enterOuterAlt(_localctx, 11); + { + setState(287); + match(New); + setState(288); + type(); + setState(289); + arguments(); + } + break; + case 12: + enterOuterAlt(_localctx, 12); + { + setState(291); + primitiveType(); + setState(296); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==SquareBracketLeft) { + { + { + setState(292); + match(SquareBracketLeft); + setState(293); + match(SquareBracketRight); + } + } + setState(298); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(299); + match(Dot); + setState(300); + match(Class); + } + break; + case 13: + enterOuterAlt(_localctx, 13); + { + setState(302); + type(); + setState(303); + match(Dot); + setState(304); + match(Class); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AssignmentOperatorContext extends ParserRuleContext { + public TerminalNode Assignment() { return getToken(ExprParser.Assignment, 0); } + public TerminalNode AddAssign() { return getToken(ExprParser.AddAssign, 0); } + public TerminalNode SubtractAssign() { return getToken(ExprParser.SubtractAssign, 0); } + public TerminalNode MultiplyAssign() { return getToken(ExprParser.MultiplyAssign, 0); } + public TerminalNode DivideAssign() { return getToken(ExprParser.DivideAssign, 0); } + public TerminalNode BitwiseANDAssign() { return getToken(ExprParser.BitwiseANDAssign, 0); } + public TerminalNode BitwiseORAssign() { return getToken(ExprParser.BitwiseORAssign, 0); } + public TerminalNode BitwiseXORAssign() { return getToken(ExprParser.BitwiseXORAssign, 0); } + public TerminalNode RemainderAssign() { return getToken(ExprParser.RemainderAssign, 0); } + public TerminalNode LeftShiftAssign() { return getToken(ExprParser.LeftShiftAssign, 0); } + public TerminalNode SignedRightShiftAssign() { return getToken(ExprParser.SignedRightShiftAssign, 0); } + public TerminalNode UnsignedRightShiftAssign() { return getToken(ExprParser.UnsignedRightShiftAssign, 0); } + public AssignmentOperatorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_assignmentOperator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterAssignmentOperator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitAssignmentOperator(this); + } + } + + public final AssignmentOperatorContext assignmentOperator() throws RecognitionException { + AssignmentOperatorContext _localctx = new AssignmentOperatorContext(_ctx, getState()); + enterRule(_localctx, 30, RULE_assignmentOperator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(308); + _la = _input.LA(1); + if ( !(((((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 8384513L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeContext extends ParserRuleContext { + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public List Dot() { return getTokens(ExprParser.Dot); } + public TerminalNode Dot(int i) { + return getToken(ExprParser.Dot, i); + } + public PrimitiveTypeContext primitiveType() { + return getRuleContext(PrimitiveTypeContext.class,0); + } + public TypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_type; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitType(this); + } + } + + public final TypeContext type() throws RecognitionException { + TypeContext _localctx = new TypeContext(_ctx, getState()); + enterRule(_localctx, 32, RULE_type); + try { + int _alt; + setState(321); + _errHandler.sync(this); + switch (_input.LA(1)) { + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(310); + identifier(); + setState(315); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,16,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(311); + match(Dot); + setState(312); + identifier(); + } + } + } + setState(317); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,16,_ctx); + } + setState(318); + bracketsOpt(); + } + break; + case Boolean: + case Byte: + case Char: + case Double: + case Float: + case Int: + case Long: + case Short: + enterOuterAlt(_localctx, 2); + { + setState(320); + primitiveType(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class StatementExpressionContext extends ParserRuleContext { + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public StatementExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_statementExpression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterStatementExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitStatementExpression(this); + } + } + + public final StatementExpressionContext statementExpression() throws RecognitionException { + StatementExpressionContext _localctx = new StatementExpressionContext(_ctx, getState()); + enterRule(_localctx, 34, RULE_statementExpression); + try { + enterOuterAlt(_localctx, 1); + { + setState(323); + expression(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstantExpressionContext extends ParserRuleContext { + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public ConstantExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constantExpression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterConstantExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitConstantExpression(this); + } + } + + public final ConstantExpressionContext constantExpression() throws RecognitionException { + ConstantExpressionContext _localctx = new ConstantExpressionContext(_ctx, getState()); + enterRule(_localctx, 36, RULE_constantExpression); + try { + enterOuterAlt(_localctx, 1); + { + setState(325); + expression(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class IdentifierSuffixContext extends ParserRuleContext { + public TerminalNode SquareBracketLeft() { return getToken(ExprParser.SquareBracketLeft, 0); } + public TerminalNode SquareBracketRight() { return getToken(ExprParser.SquareBracketRight, 0); } + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public TerminalNode Dot() { return getToken(ExprParser.Dot, 0); } + public TerminalNode Class() { return getToken(ExprParser.Class, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public TerminalNode This() { return getToken(ExprParser.This, 0); } + public TerminalNode Super() { return getToken(ExprParser.Super, 0); } + public TerminalNode New() { return getToken(ExprParser.New, 0); } + public InnerCreatorContext innerCreator() { + return getRuleContext(InnerCreatorContext.class,0); + } + public IdentifierSuffixContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_identifierSuffix; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterIdentifierSuffix(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitIdentifierSuffix(this); + } + } + + public final IdentifierSuffixContext identifierSuffix() throws RecognitionException { + IdentifierSuffixContext _localctx = new IdentifierSuffixContext(_ctx, getState()); + enterRule(_localctx, 38, RULE_identifierSuffix); + try { + setState(348); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(327); + match(SquareBracketLeft); + setState(328); + match(SquareBracketRight); + setState(329); + bracketsOpt(); + setState(330); + match(Dot); + setState(331); + match(Class); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(333); + match(SquareBracketLeft); + setState(334); + expression(); + setState(335); + match(SquareBracketRight); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(337); + arguments(); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(338); + match(Dot); + setState(346); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Class: + { + setState(339); + match(Class); + } + break; + case This: + { + setState(340); + match(This); + } + break; + case Super: + { + setState(341); + match(Super); + setState(342); + arguments(); + setState(343); + match(New); + setState(344); + innerCreator(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PostfixOpContext extends ParserRuleContext { + public TerminalNode Increment() { return getToken(ExprParser.Increment, 0); } + public TerminalNode Decrement() { return getToken(ExprParser.Decrement, 0); } + public PostfixOpContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_postfixOp; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterPostfixOp(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitPostfixOp(this); + } + } + + public final PostfixOpContext postfixOp() throws RecognitionException { + PostfixOpContext _localctx = new PostfixOpContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_postfixOp); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(350); + _la = _input.LA(1); + if ( !(_la==Increment || _la==Decrement) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PrimitiveTypeContext extends ParserRuleContext { + public TerminalNode Byte() { return getToken(ExprParser.Byte, 0); } + public TerminalNode Short() { return getToken(ExprParser.Short, 0); } + public TerminalNode Char() { return getToken(ExprParser.Char, 0); } + public TerminalNode Int() { return getToken(ExprParser.Int, 0); } + public TerminalNode Long() { return getToken(ExprParser.Long, 0); } + public TerminalNode Float() { return getToken(ExprParser.Float, 0); } + public TerminalNode Double() { return getToken(ExprParser.Double, 0); } + public TerminalNode Boolean() { return getToken(ExprParser.Boolean, 0); } + public PrimitiveTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_primitiveType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterPrimitiveType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitPrimitiveType(this); + } + } + + public final PrimitiveTypeContext primitiveType() throws RecognitionException { + PrimitiveTypeContext _localctx = new PrimitiveTypeContext(_ctx, getState()); + enterRule(_localctx, 42, RULE_primitiveType); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(352); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 276222248096L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArgumentsOptContext extends ParserRuleContext { + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public ArgumentsOptContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_argumentsOpt; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterArgumentsOpt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitArgumentsOpt(this); + } + } + + public final ArgumentsOptContext argumentsOpt() throws RecognitionException { + ArgumentsOptContext _localctx = new ArgumentsOptContext(_ctx, getState()); + enterRule(_localctx, 44, RULE_argumentsOpt); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(355); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==ParenthesesLeft) { + { + setState(354); + arguments(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArgumentsContext extends ParserRuleContext { + public TerminalNode ParenthesesLeft() { return getToken(ExprParser.ParenthesesLeft, 0); } + public TerminalNode ParenthesesRight() { return getToken(ExprParser.ParenthesesRight, 0); } + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public ArgumentsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_arguments; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterArguments(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitArguments(this); + } + } + + public final ArgumentsContext arguments() throws RecognitionException { + ArgumentsContext _localctx = new ArgumentsContext(_ctx, getState()); + enterRule(_localctx, 46, RULE_arguments); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(357); + match(ParenthesesLeft); + setState(366); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1143934377078621344L) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 1086914563L) != 0)) { + { + setState(358); + expression(); + setState(363); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(359); + match(Comma); + setState(360); + expression(); + } + } + setState(365); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + + setState(368); + match(ParenthesesRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BracketsOptContext extends ParserRuleContext { + public List SquareBracketLeft() { return getTokens(ExprParser.SquareBracketLeft); } + public TerminalNode SquareBracketLeft(int i) { + return getToken(ExprParser.SquareBracketLeft, i); + } + public List SquareBracketRight() { return getTokens(ExprParser.SquareBracketRight); } + public TerminalNode SquareBracketRight(int i) { + return getToken(ExprParser.SquareBracketRight, i); + } + public BracketsOptContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_bracketsOpt; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterBracketsOpt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitBracketsOpt(this); + } + } + + public final BracketsOptContext bracketsOpt() throws RecognitionException { + BracketsOptContext _localctx = new BracketsOptContext(_ctx, getState()); + enterRule(_localctx, 48, RULE_bracketsOpt); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(374); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==SquareBracketLeft) { + { + { + setState(370); + match(SquareBracketLeft); + setState(371); + match(SquareBracketRight); + } + } + setState(376); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CreatorContext extends ParserRuleContext { + public QualifiedIdentifierContext qualifiedIdentifier() { + return getRuleContext(QualifiedIdentifierContext.class,0); + } + public ArrayCreatorRestContext arrayCreatorRest() { + return getRuleContext(ArrayCreatorRestContext.class,0); + } + public ClassCreatorRestContext classCreatorRest() { + return getRuleContext(ClassCreatorRestContext.class,0); + } + public CreatorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_creator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterCreator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitCreator(this); + } + } + + public final CreatorContext creator() throws RecognitionException { + CreatorContext _localctx = new CreatorContext(_ctx, getState()); + enterRule(_localctx, 50, RULE_creator); + try { + enterOuterAlt(_localctx, 1); + { + setState(377); + qualifiedIdentifier(); + setState(380); + _errHandler.sync(this); + switch (_input.LA(1)) { + case SquareBracketLeft: + { + setState(378); + arrayCreatorRest(); + } + break; + case ParenthesesLeft: + { + setState(379); + classCreatorRest(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InnerCreatorContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ClassCreatorRestContext classCreatorRest() { + return getRuleContext(ClassCreatorRestContext.class,0); + } + public InnerCreatorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_innerCreator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInnerCreator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInnerCreator(this); + } + } + + public final InnerCreatorContext innerCreator() throws RecognitionException { + InnerCreatorContext _localctx = new InnerCreatorContext(_ctx, getState()); + enterRule(_localctx, 52, RULE_innerCreator); + try { + enterOuterAlt(_localctx, 1); + { + setState(382); + identifier(); + setState(383); + classCreatorRest(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArrayCreatorRestContext extends ParserRuleContext { + public List SquareBracketLeft() { return getTokens(ExprParser.SquareBracketLeft); } + public TerminalNode SquareBracketLeft(int i) { + return getToken(ExprParser.SquareBracketLeft, i); + } + public List SquareBracketRight() { return getTokens(ExprParser.SquareBracketRight); } + public TerminalNode SquareBracketRight(int i) { + return getToken(ExprParser.SquareBracketRight, i); + } + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public ArrayInitializerContext arrayInitializer() { + return getRuleContext(ArrayInitializerContext.class,0); + } + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public ArrayCreatorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_arrayCreatorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterArrayCreatorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitArrayCreatorRest(this); + } + } + + public final ArrayCreatorRestContext arrayCreatorRest() throws RecognitionException { + ArrayCreatorRestContext _localctx = new ArrayCreatorRestContext(_ctx, getState()); + enterRule(_localctx, 54, RULE_arrayCreatorRest); + int _la; + try { + setState(402); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,26,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(385); + match(SquareBracketLeft); + setState(386); + match(SquareBracketRight); + setState(387); + bracketsOpt(); + setState(388); + arrayInitializer(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(390); + match(SquareBracketLeft); + setState(391); + expression(); + setState(392); + match(SquareBracketRight); + setState(399); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==SquareBracketLeft) { + { + { + setState(393); + match(SquareBracketLeft); + setState(394); + expression(); + setState(395); + match(SquareBracketRight); + } + } + setState(401); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassCreatorRestContext extends ParserRuleContext { + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public ClassBodyContext classBody() { + return getRuleContext(ClassBodyContext.class,0); + } + public ClassCreatorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classCreatorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterClassCreatorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitClassCreatorRest(this); + } + } + + public final ClassCreatorRestContext classCreatorRest() throws RecognitionException { + ClassCreatorRestContext _localctx = new ClassCreatorRestContext(_ctx, getState()); + enterRule(_localctx, 56, RULE_classCreatorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(404); + arguments(); + setState(406); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==CurlyBracketLeft) { + { + setState(405); + classBody(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArrayInitializerContext extends ParserRuleContext { + public TerminalNode CurlyBracketLeft() { return getToken(ExprParser.CurlyBracketLeft, 0); } + public TerminalNode CurlyBracketRight() { return getToken(ExprParser.CurlyBracketRight, 0); } + public List variableInitializer() { + return getRuleContexts(VariableInitializerContext.class); + } + public VariableInitializerContext variableInitializer(int i) { + return getRuleContext(VariableInitializerContext.class,i); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public ArrayInitializerContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_arrayInitializer; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterArrayInitializer(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitArrayInitializer(this); + } + } + + public final ArrayInitializerContext arrayInitializer() throws RecognitionException { + ArrayInitializerContext _localctx = new ArrayInitializerContext(_ctx, getState()); + enterRule(_localctx, 58, RULE_arrayInitializer); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(408); + match(CurlyBracketLeft); + setState(420); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 3449777386292315296L) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 1086914563L) != 0)) { + { + setState(409); + variableInitializer(); + setState(414); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,28,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(410); + match(Comma); + setState(411); + variableInitializer(); + } + } + } + setState(416); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,28,_ctx); + } + setState(418); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Comma) { + { + setState(417); + match(Comma); + } + } + + } + } + + setState(422); + match(CurlyBracketRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableInitializerContext extends ParserRuleContext { + public ArrayInitializerContext arrayInitializer() { + return getRuleContext(ArrayInitializerContext.class,0); + } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public VariableInitializerContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableInitializer; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVariableInitializer(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVariableInitializer(this); + } + } + + public final VariableInitializerContext variableInitializer() throws RecognitionException { + VariableInitializerContext _localctx = new VariableInitializerContext(_ctx, getState()); + enterRule(_localctx, 60, RULE_variableInitializer); + try { + setState(426); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CurlyBracketLeft: + enterOuterAlt(_localctx, 1); + { + setState(424); + arrayInitializer(); + } + break; + case Boolean: + case Byte: + case Char: + case Double: + case Float: + case Int: + case Long: + case New: + case Short: + case Super: + case This: + case IntegerLiteral: + case FloatingPointLiteral: + case CharacterLiteral: + case StringLiteral: + case BooleanLiteral: + case NullLiteral: + case ParenthesesLeft: + case Increment: + case Decrement: + case BitwiseComplement: + case LogicalComplement: + case Addition: + case Subtraction: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(425); + expression(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ParExpressionContext extends ParserRuleContext { + public TerminalNode ParenthesesLeft() { return getToken(ExprParser.ParenthesesLeft, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode ParenthesesRight() { return getToken(ExprParser.ParenthesesRight, 0); } + public ParExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_parExpression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterParExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitParExpression(this); + } + } + + public final ParExpressionContext parExpression() throws RecognitionException { + ParExpressionContext _localctx = new ParExpressionContext(_ctx, getState()); + enterRule(_localctx, 62, RULE_parExpression); + try { + enterOuterAlt(_localctx, 1); + { + setState(428); + match(ParenthesesLeft); + setState(429); + expression(); + setState(430); + match(ParenthesesRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BlockContext extends ParserRuleContext { + public TerminalNode CurlyBracketLeft() { return getToken(ExprParser.CurlyBracketLeft, 0); } + public BlockStatementsContext blockStatements() { + return getRuleContext(BlockStatementsContext.class,0); + } + public TerminalNode CurlyBracketRight() { return getToken(ExprParser.CurlyBracketRight, 0); } + public BlockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_block; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterBlock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitBlock(this); + } + } + + public final BlockContext block() throws RecognitionException { + BlockContext _localctx = new BlockContext(_ctx, getState()); + enterRule(_localctx, 64, RULE_block); + try { + enterOuterAlt(_localctx, 1); + { + setState(432); + match(CurlyBracketLeft); + setState(433); + blockStatements(); + setState(434); + match(CurlyBracketRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BlockStatementsContext extends ParserRuleContext { + public List blockStatement() { + return getRuleContexts(BlockStatementContext.class); + } + public BlockStatementContext blockStatement(int i) { + return getRuleContext(BlockStatementContext.class,i); + } + public BlockStatementsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_blockStatements; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterBlockStatements(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitBlockStatements(this); + } + } + + public final BlockStatementsContext blockStatements() throws RecognitionException { + BlockStatementsContext _localctx = new BlockStatementsContext(_ctx, getState()); + enterRule(_localctx, 66, RULE_blockStatements); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(439); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 3453627586660904168L) != 0) || ((((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & 556500256257L) != 0)) { + { + { + setState(436); + blockStatement(); + } + } + setState(441); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BlockStatementContext extends ParserRuleContext { + public LocalVariableDeclarationStatementContext localVariableDeclarationStatement() { + return getRuleContext(LocalVariableDeclarationStatementContext.class,0); + } + public ClassOrInterfaceDeclarationContext classOrInterfaceDeclaration() { + return getRuleContext(ClassOrInterfaceDeclarationContext.class,0); + } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode Colon() { return getToken(ExprParser.Colon, 0); } + public BlockStatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_blockStatement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterBlockStatement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitBlockStatement(this); + } + } + + public final BlockStatementContext blockStatement() throws RecognitionException { + BlockStatementContext _localctx = new BlockStatementContext(_ctx, getState()); + enterRule(_localctx, 68, RULE_blockStatement); + try { + setState(450); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,34,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(442); + localVariableDeclarationStatement(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(443); + classOrInterfaceDeclaration(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(447); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,33,_ctx) ) { + case 1: + { + setState(444); + identifier(); + setState(445); + match(Colon); + } + break; + } + setState(449); + statement(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LocalVariableDeclarationStatementContext extends ParserRuleContext { + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public VariableDeclaratorsContext variableDeclarators() { + return getRuleContext(VariableDeclaratorsContext.class,0); + } + public TerminalNode Final() { return getToken(ExprParser.Final, 0); } + public LocalVariableDeclarationStatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_localVariableDeclarationStatement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterLocalVariableDeclarationStatement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitLocalVariableDeclarationStatement(this); + } + } + + public final LocalVariableDeclarationStatementContext localVariableDeclarationStatement() throws RecognitionException { + LocalVariableDeclarationStatementContext _localctx = new LocalVariableDeclarationStatementContext(_ctx, getState()); + enterRule(_localctx, 70, RULE_localVariableDeclarationStatement); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(453); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Final) { + { + setState(452); + match(Final); + } + } + + setState(455); + type(); + setState(456); + variableDeclarators(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class StatementContext extends ParserRuleContext { + public CompleteIfContext completeIf() { + return getRuleContext(CompleteIfContext.class,0); + } + public TerminalNode If() { return getToken(ExprParser.If, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public StatementIncompleteIfContext statementIncompleteIf() { + return getRuleContext(StatementIncompleteIfContext.class,0); + } + public StatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_statement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterStatement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitStatement(this); + } + } + + public final StatementContext statement() throws RecognitionException { + StatementContext _localctx = new StatementContext(_ctx, getState()); + enterRule(_localctx, 72, RULE_statement); + try { + setState(463); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,36,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(458); + completeIf(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(459); + match(If); + setState(460); + parExpression(); + setState(461); + statementIncompleteIf(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class StatementIncompleteIfContext extends ParserRuleContext { + public List block() { + return getRuleContexts(BlockContext.class); + } + public BlockContext block(int i) { + return getRuleContext(BlockContext.class,i); + } + public TerminalNode If() { return getToken(ExprParser.If, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public CompleteIfContext completeIf() { + return getRuleContext(CompleteIfContext.class,0); + } + public TerminalNode Else() { return getToken(ExprParser.Else, 0); } + public StatementIncompleteIfContext statementIncompleteIf() { + return getRuleContext(StatementIncompleteIfContext.class,0); + } + public TerminalNode For() { return getToken(ExprParser.For, 0); } + public TerminalNode ParenthesesLeft() { return getToken(ExprParser.ParenthesesLeft, 0); } + public List Semicolon() { return getTokens(ExprParser.Semicolon); } + public TerminalNode Semicolon(int i) { + return getToken(ExprParser.Semicolon, i); + } + public TerminalNode ParenthesesRight() { return getToken(ExprParser.ParenthesesRight, 0); } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public ForInitContext forInit() { + return getRuleContext(ForInitContext.class,0); + } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public ForUpdateContext forUpdate() { + return getRuleContext(ForUpdateContext.class,0); + } + public TerminalNode While() { return getToken(ExprParser.While, 0); } + public TerminalNode Do() { return getToken(ExprParser.Do, 0); } + public TerminalNode Try() { return getToken(ExprParser.Try, 0); } + public CatchesContext catches() { + return getRuleContext(CatchesContext.class,0); + } + public TerminalNode Finally() { return getToken(ExprParser.Finally, 0); } + public SwitchStatementContext switchStatement() { + return getRuleContext(SwitchStatementContext.class,0); + } + public TerminalNode Synchronized() { return getToken(ExprParser.Synchronized, 0); } + public TerminalNode Return() { return getToken(ExprParser.Return, 0); } + public TerminalNode Throw() { return getToken(ExprParser.Throw, 0); } + public TerminalNode Break() { return getToken(ExprParser.Break, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode Continue() { return getToken(ExprParser.Continue, 0); } + public StatementExpressionContext statementExpression() { + return getRuleContext(StatementExpressionContext.class,0); + } + public StatementIncompleteIfContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_statementIncompleteIf; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterStatementIncompleteIf(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitStatementIncompleteIf(this); + } + } + + public final StatementIncompleteIfContext statementIncompleteIf() throws RecognitionException { + StatementIncompleteIfContext _localctx = new StatementIncompleteIfContext(_ctx, getState()); + enterRule(_localctx, 74, RULE_statementIncompleteIf); + int _la; + try { + setState(540); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,43,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(465); + block(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(466); + match(If); + setState(467); + parExpression(); + setState(468); + completeIf(); + setState(469); + match(Else); + setState(470); + statementIncompleteIf(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(472); + match(For); + setState(473); + match(ParenthesesLeft); + setState(475); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1143934377079145632L) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 1086914563L) != 0)) { + { + setState(474); + forInit(); + } + } + + setState(477); + match(Semicolon); + setState(479); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1143934377078621344L) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 1086914563L) != 0)) { + { + setState(478); + expression(); + } + } + + setState(481); + match(Semicolon); + setState(483); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1143934377078621344L) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 1086914563L) != 0)) { + { + setState(482); + forUpdate(); + } + } + + setState(485); + match(ParenthesesRight); + setState(486); + statement(); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(487); + match(While); + setState(488); + parExpression(); + setState(489); + statement(); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(491); + match(Do); + setState(492); + statement(); + setState(493); + match(While); + setState(494); + parExpression(); + setState(495); + match(Semicolon); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(497); + match(Try); + setState(498); + block(); + setState(499); + catches(); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(501); + match(Try); + setState(502); + block(); + setState(503); + match(Finally); + setState(504); + block(); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(506); + match(Try); + setState(507); + block(); + setState(508); + catches(); + setState(509); + match(Finally); + setState(510); + block(); + } + break; + case 9: + enterOuterAlt(_localctx, 9); + { + setState(512); + switchStatement(); + } + break; + case 10: + enterOuterAlt(_localctx, 10); + { + setState(513); + match(Synchronized); + setState(514); + parExpression(); + setState(515); + block(); + } + break; + case 11: + enterOuterAlt(_localctx, 11); + { + setState(517); + match(Return); + setState(519); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1143934377078621344L) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & 1086914563L) != 0)) { + { + setState(518); + expression(); + } + } + + setState(521); + match(Semicolon); + } + break; + case 12: + enterOuterAlt(_localctx, 12); + { + setState(522); + match(Throw); + setState(523); + expression(); + setState(524); + match(Semicolon); + } + break; + case 13: + enterOuterAlt(_localctx, 13); + { + setState(526); + match(Break); + setState(528); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==IDENTIFIER) { + { + setState(527); + identifier(); + } + } + + setState(530); + match(Semicolon); + } + break; + case 14: + enterOuterAlt(_localctx, 14); + { + setState(531); + match(Continue); + setState(533); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==IDENTIFIER) { + { + setState(532); + identifier(); + } + } + + setState(535); + match(Semicolon); + } + break; + case 15: + enterOuterAlt(_localctx, 15); + { + setState(536); + statementExpression(); + setState(537); + match(Semicolon); + } + break; + case 16: + enterOuterAlt(_localctx, 16); + { + setState(539); + match(Semicolon); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CompleteIfContext extends ParserRuleContext { + public TerminalNode If() { return getToken(ExprParser.If, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public List completeIf() { + return getRuleContexts(CompleteIfContext.class); + } + public CompleteIfContext completeIf(int i) { + return getRuleContext(CompleteIfContext.class,i); + } + public TerminalNode Else() { return getToken(ExprParser.Else, 0); } + public StatementIncompleteIfContext statementIncompleteIf() { + return getRuleContext(StatementIncompleteIfContext.class,0); + } + public CompleteIfContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_completeIf; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterCompleteIf(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitCompleteIf(this); + } + } + + public final CompleteIfContext completeIf() throws RecognitionException { + CompleteIfContext _localctx = new CompleteIfContext(_ctx, getState()); + enterRule(_localctx, 76, RULE_completeIf); + try { + setState(549); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,44,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(542); + match(If); + setState(543); + parExpression(); + setState(544); + completeIf(); + setState(545); + match(Else); + setState(546); + completeIf(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(548); + statementIncompleteIf(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CatchesContext extends ParserRuleContext { + public List catchClause() { + return getRuleContexts(CatchClauseContext.class); + } + public CatchClauseContext catchClause(int i) { + return getRuleContext(CatchClauseContext.class,i); + } + public CatchesContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_catches; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterCatches(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitCatches(this); + } + } + + public final CatchesContext catches() throws RecognitionException { + CatchesContext _localctx = new CatchesContext(_ctx, getState()); + enterRule(_localctx, 78, RULE_catches); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(551); + catchClause(); + setState(555); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Catch) { + { + { + setState(552); + catchClause(); + } + } + setState(557); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CatchClauseContext extends ParserRuleContext { + public TerminalNode Catch() { return getToken(ExprParser.Catch, 0); } + public TerminalNode ParenthesesLeft() { return getToken(ExprParser.ParenthesesLeft, 0); } + public FormalParameterContext formalParameter() { + return getRuleContext(FormalParameterContext.class,0); + } + public TerminalNode ParenthesesRight() { return getToken(ExprParser.ParenthesesRight, 0); } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public CatchClauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_catchClause; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterCatchClause(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitCatchClause(this); + } + } + + public final CatchClauseContext catchClause() throws RecognitionException { + CatchClauseContext _localctx = new CatchClauseContext(_ctx, getState()); + enterRule(_localctx, 80, RULE_catchClause); + try { + enterOuterAlt(_localctx, 1); + { + setState(558); + match(Catch); + setState(559); + match(ParenthesesLeft); + setState(560); + formalParameter(); + setState(561); + match(ParenthesesRight); + setState(562); + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchStatementContext extends ParserRuleContext { + public TerminalNode Switch() { return getToken(ExprParser.Switch, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public TerminalNode CurlyBracketLeft() { return getToken(ExprParser.CurlyBracketLeft, 0); } + public TerminalNode CurlyBracketRight() { return getToken(ExprParser.CurlyBracketRight, 0); } + public SwitchBlockStatementGroupsContext switchBlockStatementGroups() { + return getRuleContext(SwitchBlockStatementGroupsContext.class,0); + } + public SwitchStatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchStatement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterSwitchStatement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitSwitchStatement(this); + } + } + + public final SwitchStatementContext switchStatement() throws RecognitionException { + SwitchStatementContext _localctx = new SwitchStatementContext(_ctx, getState()); + enterRule(_localctx, 82, RULE_switchStatement); + try { + setState(577); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,47,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(564); + match(Switch); + setState(565); + parExpression(); + setState(566); + match(CurlyBracketLeft); + setState(567); + match(CurlyBracketRight); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(569); + match(Switch); + setState(570); + parExpression(); + setState(571); + match(CurlyBracketLeft); + setState(573); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,46,_ctx) ) { + case 1: + { + setState(572); + switchBlockStatementGroups(); + } + break; + } + setState(575); + match(CurlyBracketRight); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchBlockStatementGroupsContext extends ParserRuleContext { + public List switchBlockStatementGroup() { + return getRuleContexts(SwitchBlockStatementGroupContext.class); + } + public SwitchBlockStatementGroupContext switchBlockStatementGroup(int i) { + return getRuleContext(SwitchBlockStatementGroupContext.class,i); + } + public SwitchBlockStatementGroupsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchBlockStatementGroups; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterSwitchBlockStatementGroups(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitSwitchBlockStatementGroups(this); + } + } + + public final SwitchBlockStatementGroupsContext switchBlockStatementGroups() throws RecognitionException { + SwitchBlockStatementGroupsContext _localctx = new SwitchBlockStatementGroupsContext(_ctx, getState()); + enterRule(_localctx, 84, RULE_switchBlockStatementGroups); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(582); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Case || _la==Default) { + { + { + setState(579); + switchBlockStatementGroup(); + } + } + setState(584); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchBlockStatementGroupContext extends ParserRuleContext { + public SwitchLabelContext switchLabel() { + return getRuleContext(SwitchLabelContext.class,0); + } + public BlockStatementsContext blockStatements() { + return getRuleContext(BlockStatementsContext.class,0); + } + public SwitchBlockStatementGroupContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchBlockStatementGroup; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterSwitchBlockStatementGroup(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitSwitchBlockStatementGroup(this); + } + } + + public final SwitchBlockStatementGroupContext switchBlockStatementGroup() throws RecognitionException { + SwitchBlockStatementGroupContext _localctx = new SwitchBlockStatementGroupContext(_ctx, getState()); + enterRule(_localctx, 86, RULE_switchBlockStatementGroup); + try { + enterOuterAlt(_localctx, 1); + { + setState(585); + switchLabel(); + setState(586); + blockStatements(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelContext extends ParserRuleContext { + public TerminalNode Case() { return getToken(ExprParser.Case, 0); } + public ConstantExpressionContext constantExpression() { + return getRuleContext(ConstantExpressionContext.class,0); + } + public TerminalNode Colon() { return getToken(ExprParser.Colon, 0); } + public TerminalNode Default() { return getToken(ExprParser.Default, 0); } + public SwitchLabelContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchLabel; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterSwitchLabel(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitSwitchLabel(this); + } + } + + public final SwitchLabelContext switchLabel() throws RecognitionException { + SwitchLabelContext _localctx = new SwitchLabelContext(_ctx, getState()); + enterRule(_localctx, 88, RULE_switchLabel); + try { + setState(594); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Case: + enterOuterAlt(_localctx, 1); + { + setState(588); + match(Case); + setState(589); + constantExpression(); + setState(590); + match(Colon); + } + break; + case Default: + enterOuterAlt(_localctx, 2); + { + setState(592); + match(Default); + setState(593); + match(Colon); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MoreStatementExpressionsContext extends ParserRuleContext { + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public List statementExpression() { + return getRuleContexts(StatementExpressionContext.class); + } + public StatementExpressionContext statementExpression(int i) { + return getRuleContext(StatementExpressionContext.class,i); + } + public MoreStatementExpressionsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_moreStatementExpressions; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMoreStatementExpressions(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMoreStatementExpressions(this); + } + } + + public final MoreStatementExpressionsContext moreStatementExpressions() throws RecognitionException { + MoreStatementExpressionsContext _localctx = new MoreStatementExpressionsContext(_ctx, getState()); + enterRule(_localctx, 90, RULE_moreStatementExpressions); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(600); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(596); + match(Comma); + setState(597); + statementExpression(); + } + } + setState(602); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ForInitContext extends ParserRuleContext { + public StatementExpressionContext statementExpression() { + return getRuleContext(StatementExpressionContext.class,0); + } + public MoreStatementExpressionsContext moreStatementExpressions() { + return getRuleContext(MoreStatementExpressionsContext.class,0); + } + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public VariableDeclaratorsContext variableDeclarators() { + return getRuleContext(VariableDeclaratorsContext.class,0); + } + public TerminalNode Final() { return getToken(ExprParser.Final, 0); } + public ForInitContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_forInit; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterForInit(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitForInit(this); + } + } + + public final ForInitContext forInit() throws RecognitionException { + ForInitContext _localctx = new ForInitContext(_ctx, getState()); + enterRule(_localctx, 92, RULE_forInit); + int _la; + try { + setState(612); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,52,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(603); + statementExpression(); + setState(604); + moreStatementExpressions(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(607); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Final) { + { + setState(606); + match(Final); + } + } + + setState(609); + type(); + setState(610); + variableDeclarators(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ForUpdateContext extends ParserRuleContext { + public StatementExpressionContext statementExpression() { + return getRuleContext(StatementExpressionContext.class,0); + } + public MoreStatementExpressionsContext moreStatementExpressions() { + return getRuleContext(MoreStatementExpressionsContext.class,0); + } + public ForUpdateContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_forUpdate; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterForUpdate(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitForUpdate(this); + } + } + + public final ForUpdateContext forUpdate() throws RecognitionException { + ForUpdateContext _localctx = new ForUpdateContext(_ctx, getState()); + enterRule(_localctx, 94, RULE_forUpdate); + try { + enterOuterAlt(_localctx, 1); + { + setState(614); + statementExpression(); + setState(615); + moreStatementExpressions(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ModifiersOptContext extends ParserRuleContext { + public List modifier() { + return getRuleContexts(ModifierContext.class); + } + public ModifierContext modifier(int i) { + return getRuleContext(ModifierContext.class,i); + } + public ModifiersOptContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_modifiersOpt; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterModifiersOpt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitModifiersOpt(this); + } + } + + public final ModifiersOptContext modifiersOpt() throws RecognitionException { + ModifiersOptContext _localctx = new ModifiersOptContext(_ctx, getState()); + enterRule(_localctx, 96, RULE_modifiersOpt); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(620); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,53,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(617); + modifier(); + } + } + } + setState(622); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,53,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ModifierContext extends ParserRuleContext { + public TerminalNode Public() { return getToken(ExprParser.Public, 0); } + public TerminalNode Protected() { return getToken(ExprParser.Protected, 0); } + public TerminalNode Private() { return getToken(ExprParser.Private, 0); } + public TerminalNode Static() { return getToken(ExprParser.Static, 0); } + public TerminalNode Abstract() { return getToken(ExprParser.Abstract, 0); } + public TerminalNode Final() { return getToken(ExprParser.Final, 0); } + public TerminalNode Native() { return getToken(ExprParser.Native, 0); } + public TerminalNode Synchronized() { return getToken(ExprParser.Synchronized, 0); } + public TerminalNode Transient() { return getToken(ExprParser.Transient, 0); } + public TerminalNode Volatile() { return getToken(ExprParser.Volatile, 0); } + public TerminalNode Strictfp() { return getToken(ExprParser.Strictfp, 0); } + public ModifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_modifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterModifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitModifier(this); + } + } + + public final ModifierContext modifier() throws RecognitionException { + ModifierContext _localctx = new ModifierContext(_ctx, getState()); + enterRule(_localctx, 98, RULE_modifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(623); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 1277205162754056L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorsContext extends ParserRuleContext { + public List variableDeclarator() { + return getRuleContexts(VariableDeclaratorContext.class); + } + public VariableDeclaratorContext variableDeclarator(int i) { + return getRuleContext(VariableDeclaratorContext.class,i); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public VariableDeclaratorsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclarators; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVariableDeclarators(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVariableDeclarators(this); + } + } + + public final VariableDeclaratorsContext variableDeclarators() throws RecognitionException { + VariableDeclaratorsContext _localctx = new VariableDeclaratorsContext(_ctx, getState()); + enterRule(_localctx, 100, RULE_variableDeclarators); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(625); + variableDeclarator(); + setState(630); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(626); + match(Comma); + setState(627); + variableDeclarator(); + } + } + setState(632); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorsRestContext extends ParserRuleContext { + public VariableDeclaratorRestContext variableDeclaratorRest() { + return getRuleContext(VariableDeclaratorRestContext.class,0); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public List variableDeclarator() { + return getRuleContexts(VariableDeclaratorContext.class); + } + public VariableDeclaratorContext variableDeclarator(int i) { + return getRuleContext(VariableDeclaratorContext.class,i); + } + public VariableDeclaratorsRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclaratorsRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVariableDeclaratorsRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVariableDeclaratorsRest(this); + } + } + + public final VariableDeclaratorsRestContext variableDeclaratorsRest() throws RecognitionException { + VariableDeclaratorsRestContext _localctx = new VariableDeclaratorsRestContext(_ctx, getState()); + enterRule(_localctx, 102, RULE_variableDeclaratorsRest); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(633); + variableDeclaratorRest(); + setState(638); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,55,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(634); + match(Comma); + setState(635); + variableDeclarator(); + } + } + } + setState(640); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,55,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstantDeclaratorsRestContext extends ParserRuleContext { + public ConstantDeclaratorRestContext constantDeclaratorRest() { + return getRuleContext(ConstantDeclaratorRestContext.class,0); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public List constantDeclarator() { + return getRuleContexts(ConstantDeclaratorContext.class); + } + public ConstantDeclaratorContext constantDeclarator(int i) { + return getRuleContext(ConstantDeclaratorContext.class,i); + } + public ConstantDeclaratorsRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constantDeclaratorsRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterConstantDeclaratorsRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitConstantDeclaratorsRest(this); + } + } + + public final ConstantDeclaratorsRestContext constantDeclaratorsRest() throws RecognitionException { + ConstantDeclaratorsRestContext _localctx = new ConstantDeclaratorsRestContext(_ctx, getState()); + enterRule(_localctx, 104, RULE_constantDeclaratorsRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(641); + constantDeclaratorRest(); + setState(646); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(642); + match(Comma); + setState(643); + constantDeclarator(); + } + } + setState(648); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public VariableDeclaratorsRestContext variableDeclaratorsRest() { + return getRuleContext(VariableDeclaratorsRestContext.class,0); + } + public VariableDeclaratorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclarator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVariableDeclarator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVariableDeclarator(this); + } + } + + public final VariableDeclaratorContext variableDeclarator() throws RecognitionException { + VariableDeclaratorContext _localctx = new VariableDeclaratorContext(_ctx, getState()); + enterRule(_localctx, 106, RULE_variableDeclarator); + try { + enterOuterAlt(_localctx, 1); + { + setState(649); + identifier(); + setState(650); + variableDeclaratorsRest(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstantDeclaratorContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ConstantDeclaratorRestContext constantDeclaratorRest() { + return getRuleContext(ConstantDeclaratorRestContext.class,0); + } + public ConstantDeclaratorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constantDeclarator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterConstantDeclarator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitConstantDeclarator(this); + } + } + + public final ConstantDeclaratorContext constantDeclarator() throws RecognitionException { + ConstantDeclaratorContext _localctx = new ConstantDeclaratorContext(_ctx, getState()); + enterRule(_localctx, 108, RULE_constantDeclarator); + try { + enterOuterAlt(_localctx, 1); + { + setState(652); + identifier(); + setState(653); + constantDeclaratorRest(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorRestContext extends ParserRuleContext { + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public TerminalNode Assignment() { return getToken(ExprParser.Assignment, 0); } + public VariableInitializerContext variableInitializer() { + return getRuleContext(VariableInitializerContext.class,0); + } + public VariableDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVariableDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVariableDeclaratorRest(this); + } + } + + public final VariableDeclaratorRestContext variableDeclaratorRest() throws RecognitionException { + VariableDeclaratorRestContext _localctx = new VariableDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 110, RULE_variableDeclaratorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(655); + bracketsOpt(); + setState(658); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Assignment) { + { + setState(656); + match(Assignment); + setState(657); + variableInitializer(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstantDeclaratorRestContext extends ParserRuleContext { + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public TerminalNode Assignment() { return getToken(ExprParser.Assignment, 0); } + public VariableInitializerContext variableInitializer() { + return getRuleContext(VariableInitializerContext.class,0); + } + public ConstantDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constantDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterConstantDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitConstantDeclaratorRest(this); + } + } + + public final ConstantDeclaratorRestContext constantDeclaratorRest() throws RecognitionException { + ConstantDeclaratorRestContext _localctx = new ConstantDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 112, RULE_constantDeclaratorRest); + try { + enterOuterAlt(_localctx, 1); + { + setState(660); + bracketsOpt(); + setState(661); + match(Assignment); + setState(662); + variableInitializer(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorIdContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public VariableDeclaratorIdContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclaratorId; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVariableDeclaratorId(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVariableDeclaratorId(this); + } + } + + public final VariableDeclaratorIdContext variableDeclaratorId() throws RecognitionException { + VariableDeclaratorIdContext _localctx = new VariableDeclaratorIdContext(_ctx, getState()); + enterRule(_localctx, 114, RULE_variableDeclaratorId); + try { + enterOuterAlt(_localctx, 1); + { + setState(664); + identifier(); + setState(665); + bracketsOpt(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CompilationUnitContext extends ParserRuleContext { + public TerminalNode Package() { return getToken(ExprParser.Package, 0); } + public QualifiedIdentifierContext qualifiedIdentifier() { + return getRuleContext(QualifiedIdentifierContext.class,0); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public List importDeclaration() { + return getRuleContexts(ImportDeclarationContext.class); + } + public ImportDeclarationContext importDeclaration(int i) { + return getRuleContext(ImportDeclarationContext.class,i); + } + public List typeDeclaration() { + return getRuleContexts(TypeDeclarationContext.class); + } + public TypeDeclarationContext typeDeclaration(int i) { + return getRuleContext(TypeDeclarationContext.class,i); + } + public CompilationUnitContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_compilationUnit; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterCompilationUnit(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitCompilationUnit(this); + } + } + + public final CompilationUnitContext compilationUnit() throws RecognitionException { + CompilationUnitContext _localctx = new CompilationUnitContext(_ctx, getState()); + enterRule(_localctx, 116, RULE_compilationUnit); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(671); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Package) { + { + setState(667); + match(Package); + setState(668); + qualifiedIdentifier(); + setState(669); + match(Semicolon); + } + } + + setState(676); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Import) { + { + { + setState(673); + importDeclaration(); + } + } + setState(678); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(682); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 4611845669139841281L) != 0)) { + { + { + setState(679); + typeDeclaration(); + } + } + setState(684); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ImportDeclarationContext extends ParserRuleContext { + public TerminalNode Import() { return getToken(ExprParser.Import, 0); } + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public List Dot() { return getTokens(ExprParser.Dot); } + public TerminalNode Dot(int i) { + return getToken(ExprParser.Dot, i); + } + public TerminalNode Multiplication() { return getToken(ExprParser.Multiplication, 0); } + public ImportDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_importDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterImportDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitImportDeclaration(this); + } + } + + public final ImportDeclarationContext importDeclaration() throws RecognitionException { + ImportDeclarationContext _localctx = new ImportDeclarationContext(_ctx, getState()); + enterRule(_localctx, 118, RULE_importDeclaration); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(685); + match(Import); + setState(686); + identifier(); + setState(691); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,61,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(687); + match(Dot); + setState(688); + identifier(); + } + } + } + setState(693); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,61,_ctx); + } + setState(696); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Dot) { + { + setState(694); + match(Dot); + setState(695); + match(Multiplication); + } + } + + setState(698); + match(Semicolon); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeDeclarationContext extends ParserRuleContext { + public ClassOrInterfaceDeclarationContext classOrInterfaceDeclaration() { + return getRuleContext(ClassOrInterfaceDeclarationContext.class,0); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public TypeDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterTypeDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitTypeDeclaration(this); + } + } + + public final TypeDeclarationContext typeDeclaration() throws RecognitionException { + TypeDeclarationContext _localctx = new TypeDeclarationContext(_ctx, getState()); + enterRule(_localctx, 120, RULE_typeDeclaration); + try { + setState(702); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Abstract: + case Class: + case Final: + case Interface: + case Native: + case Private: + case Protected: + case Public: + case Static: + case Strictfp: + case Synchronized: + case Transient: + case Volatile: + enterOuterAlt(_localctx, 1); + { + setState(700); + classOrInterfaceDeclaration(); + } + break; + case Semicolon: + enterOuterAlt(_localctx, 2); + { + setState(701); + match(Semicolon); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassOrInterfaceDeclarationContext extends ParserRuleContext { + public ModifiersOptContext modifiersOpt() { + return getRuleContext(ModifiersOptContext.class,0); + } + public ClassDeclarationContext classDeclaration() { + return getRuleContext(ClassDeclarationContext.class,0); + } + public InterfaceDeclarationContext interfaceDeclaration() { + return getRuleContext(InterfaceDeclarationContext.class,0); + } + public ClassOrInterfaceDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classOrInterfaceDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterClassOrInterfaceDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitClassOrInterfaceDeclaration(this); + } + } + + public final ClassOrInterfaceDeclarationContext classOrInterfaceDeclaration() throws RecognitionException { + ClassOrInterfaceDeclarationContext _localctx = new ClassOrInterfaceDeclarationContext(_ctx, getState()); + enterRule(_localctx, 122, RULE_classOrInterfaceDeclaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(704); + modifiersOpt(); + setState(707); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Class: + { + setState(705); + classDeclaration(); + } + break; + case Interface: + { + setState(706); + interfaceDeclaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassDeclarationContext extends ParserRuleContext { + public TerminalNode Class() { return getToken(ExprParser.Class, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ClassBodyContext classBody() { + return getRuleContext(ClassBodyContext.class,0); + } + public TerminalNode Extends() { return getToken(ExprParser.Extends, 0); } + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public TerminalNode Implements() { return getToken(ExprParser.Implements, 0); } + public TypeListContext typeList() { + return getRuleContext(TypeListContext.class,0); + } + public ClassDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterClassDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitClassDeclaration(this); + } + } + + public final ClassDeclarationContext classDeclaration() throws RecognitionException { + ClassDeclarationContext _localctx = new ClassDeclarationContext(_ctx, getState()); + enterRule(_localctx, 124, RULE_classDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(709); + match(Class); + setState(710); + identifier(); + setState(713); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Extends) { + { + setState(711); + match(Extends); + setState(712); + type(); + } + } + + setState(717); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Implements) { + { + setState(715); + match(Implements); + setState(716); + typeList(); + } + } + + setState(719); + classBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceDeclarationContext extends ParserRuleContext { + public TerminalNode Interface() { return getToken(ExprParser.Interface, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public InterfaceBodyContext interfaceBody() { + return getRuleContext(InterfaceBodyContext.class,0); + } + public TerminalNode Extends() { return getToken(ExprParser.Extends, 0); } + public TypeListContext typeList() { + return getRuleContext(TypeListContext.class,0); + } + public InterfaceDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceDeclaration(this); + } + } + + public final InterfaceDeclarationContext interfaceDeclaration() throws RecognitionException { + InterfaceDeclarationContext _localctx = new InterfaceDeclarationContext(_ctx, getState()); + enterRule(_localctx, 126, RULE_interfaceDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(721); + match(Interface); + setState(722); + identifier(); + setState(725); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Extends) { + { + setState(723); + match(Extends); + setState(724); + typeList(); + } + } + + setState(727); + interfaceBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeListContext extends ParserRuleContext { + public List type() { + return getRuleContexts(TypeContext.class); + } + public TypeContext type(int i) { + return getRuleContext(TypeContext.class,i); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public TypeListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterTypeList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitTypeList(this); + } + } + + public final TypeListContext typeList() throws RecognitionException { + TypeListContext _localctx = new TypeListContext(_ctx, getState()); + enterRule(_localctx, 128, RULE_typeList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(729); + type(); + setState(734); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(730); + match(Comma); + setState(731); + type(); + } + } + setState(736); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassBodyContext extends ParserRuleContext { + public TerminalNode CurlyBracketLeft() { return getToken(ExprParser.CurlyBracketLeft, 0); } + public TerminalNode CurlyBracketRight() { return getToken(ExprParser.CurlyBracketRight, 0); } + public List classBodyDeclaration() { + return getRuleContexts(ClassBodyDeclarationContext.class); + } + public ClassBodyDeclarationContext classBodyDeclaration(int i) { + return getRuleContext(ClassBodyDeclarationContext.class,i); + } + public ClassBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterClassBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitClassBody(this); + } + } + + public final ClassBodyContext classBody() throws RecognitionException { + ClassBodyContext _localctx = new ClassBodyContext(_ctx, getState()); + enterRule(_localctx, 130, RULE_classBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(737); + match(CurlyBracketLeft); + setState(741); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 2307683441088990376L) != 0) || _la==Semicolon || _la==IDENTIFIER) { + { + { + setState(738); + classBodyDeclaration(); + } + } + setState(743); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(744); + match(CurlyBracketRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceBodyContext extends ParserRuleContext { + public TerminalNode CurlyBracketLeft() { return getToken(ExprParser.CurlyBracketLeft, 0); } + public TerminalNode CurlyBracketRight() { return getToken(ExprParser.CurlyBracketRight, 0); } + public List interfaceBodyDeclaration() { + return getRuleContexts(InterfaceBodyDeclarationContext.class); + } + public InterfaceBodyDeclarationContext interfaceBodyDeclaration(int i) { + return getRuleContext(InterfaceBodyDeclarationContext.class,i); + } + public InterfaceBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceBody(this); + } + } + + public final InterfaceBodyContext interfaceBody() throws RecognitionException { + InterfaceBodyContext _localctx = new InterfaceBodyContext(_ctx, getState()); + enterRule(_localctx, 132, RULE_interfaceBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(746); + match(CurlyBracketLeft); + setState(750); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1840431875296424L) != 0) || _la==Semicolon || _la==IDENTIFIER) { + { + { + setState(747); + interfaceBodyDeclaration(); + } + } + setState(752); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(753); + match(CurlyBracketRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassBodyDeclarationContext extends ParserRuleContext { + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public TerminalNode Static() { return getToken(ExprParser.Static, 0); } + public ModifiersOptContext modifiersOpt() { + return getRuleContext(ModifiersOptContext.class,0); + } + public MemberDeclContext memberDecl() { + return getRuleContext(MemberDeclContext.class,0); + } + public ClassBodyDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classBodyDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterClassBodyDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitClassBodyDeclaration(this); + } + } + + public final ClassBodyDeclarationContext classBodyDeclaration() throws RecognitionException { + ClassBodyDeclarationContext _localctx = new ClassBodyDeclarationContext(_ctx, getState()); + enterRule(_localctx, 134, RULE_classBodyDeclaration); + int _la; + try { + setState(763); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,72,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(755); + match(Semicolon); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(757); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Static) { + { + setState(756); + match(Static); + } + } + + setState(759); + block(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(760); + modifiersOpt(); + setState(761); + memberDecl(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MemberDeclContext extends ParserRuleContext { + public MethodOrFieldDeclContext methodOrFieldDecl() { + return getRuleContext(MethodOrFieldDeclContext.class,0); + } + public TerminalNode Void() { return getToken(ExprParser.Void, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public MethodDeclaratorRestContext methodDeclaratorRest() { + return getRuleContext(MethodDeclaratorRestContext.class,0); + } + public ConstructorDeclaratorRestContext constructorDeclaratorRest() { + return getRuleContext(ConstructorDeclaratorRestContext.class,0); + } + public ClassOrInterfaceDeclarationContext classOrInterfaceDeclaration() { + return getRuleContext(ClassOrInterfaceDeclarationContext.class,0); + } + public MemberDeclContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_memberDecl; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMemberDecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMemberDecl(this); + } + } + + public final MemberDeclContext memberDecl() throws RecognitionException { + MemberDeclContext _localctx = new MemberDeclContext(_ctx, getState()); + enterRule(_localctx, 136, RULE_memberDecl); + try { + setState(774); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,73,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(765); + methodOrFieldDecl(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(766); + match(Void); + setState(767); + identifier(); + setState(768); + methodDeclaratorRest(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(770); + identifier(); + setState(771); + constructorDeclaratorRest(); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(773); + classOrInterfaceDeclaration(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodOrFieldDeclContext extends ParserRuleContext { + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public MethodOrFieldRestContext methodOrFieldRest() { + return getRuleContext(MethodOrFieldRestContext.class,0); + } + public MethodOrFieldDeclContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodOrFieldDecl; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMethodOrFieldDecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMethodOrFieldDecl(this); + } + } + + public final MethodOrFieldDeclContext methodOrFieldDecl() throws RecognitionException { + MethodOrFieldDeclContext _localctx = new MethodOrFieldDeclContext(_ctx, getState()); + enterRule(_localctx, 138, RULE_methodOrFieldDecl); + try { + enterOuterAlt(_localctx, 1); + { + setState(776); + type(); + setState(777); + identifier(); + setState(778); + methodOrFieldRest(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodOrFieldRestContext extends ParserRuleContext { + public VariableDeclaratorRestContext variableDeclaratorRest() { + return getRuleContext(VariableDeclaratorRestContext.class,0); + } + public MethodDeclaratorRestContext methodDeclaratorRest() { + return getRuleContext(MethodDeclaratorRestContext.class,0); + } + public MethodOrFieldRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodOrFieldRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMethodOrFieldRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMethodOrFieldRest(this); + } + } + + public final MethodOrFieldRestContext methodOrFieldRest() throws RecognitionException { + MethodOrFieldRestContext _localctx = new MethodOrFieldRestContext(_ctx, getState()); + enterRule(_localctx, 140, RULE_methodOrFieldRest); + try { + setState(782); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Abstract: + case Boolean: + case Byte: + case Char: + case Class: + case Double: + case Final: + case Float: + case Int: + case Interface: + case Long: + case Native: + case Private: + case Protected: + case Public: + case Short: + case Static: + case Strictfp: + case Synchronized: + case Transient: + case Void: + case Volatile: + case CurlyBracketLeft: + case CurlyBracketRight: + case SquareBracketLeft: + case Semicolon: + case Assignment: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(780); + variableDeclaratorRest(); + } + break; + case ParenthesesLeft: + enterOuterAlt(_localctx, 2); + { + setState(781); + methodDeclaratorRest(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceBodyDeclarationContext extends ParserRuleContext { + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public ModifiersOptContext modifiersOpt() { + return getRuleContext(ModifiersOptContext.class,0); + } + public InterfaceMemberDeclContext interfaceMemberDecl() { + return getRuleContext(InterfaceMemberDeclContext.class,0); + } + public InterfaceBodyDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceBodyDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceBodyDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceBodyDeclaration(this); + } + } + + public final InterfaceBodyDeclarationContext interfaceBodyDeclaration() throws RecognitionException { + InterfaceBodyDeclarationContext _localctx = new InterfaceBodyDeclarationContext(_ctx, getState()); + enterRule(_localctx, 142, RULE_interfaceBodyDeclaration); + try { + setState(788); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Semicolon: + enterOuterAlt(_localctx, 1); + { + setState(784); + match(Semicolon); + } + break; + case Abstract: + case Boolean: + case Byte: + case Char: + case Class: + case Double: + case Final: + case Float: + case Int: + case Interface: + case Long: + case Native: + case Private: + case Protected: + case Public: + case Short: + case Static: + case Strictfp: + case Synchronized: + case Transient: + case Void: + case Volatile: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(785); + modifiersOpt(); + setState(786); + interfaceMemberDecl(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMemberDeclContext extends ParserRuleContext { + public InterfaceMethodOrFieldDeclContext interfaceMethodOrFieldDecl() { + return getRuleContext(InterfaceMethodOrFieldDeclContext.class,0); + } + public TerminalNode Void() { return getToken(ExprParser.Void, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public VoidInterfaceMethodDeclaratorRestContext voidInterfaceMethodDeclaratorRest() { + return getRuleContext(VoidInterfaceMethodDeclaratorRestContext.class,0); + } + public ClassOrInterfaceDeclarationContext classOrInterfaceDeclaration() { + return getRuleContext(ClassOrInterfaceDeclarationContext.class,0); + } + public InterfaceMemberDeclContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMemberDecl; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceMemberDecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceMemberDecl(this); + } + } + + public final InterfaceMemberDeclContext interfaceMemberDecl() throws RecognitionException { + InterfaceMemberDeclContext _localctx = new InterfaceMemberDeclContext(_ctx, getState()); + enterRule(_localctx, 144, RULE_interfaceMemberDecl); + try { + setState(796); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Boolean: + case Byte: + case Char: + case Double: + case Float: + case Int: + case Long: + case Short: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(790); + interfaceMethodOrFieldDecl(); + } + break; + case Void: + enterOuterAlt(_localctx, 2); + { + setState(791); + match(Void); + setState(792); + identifier(); + setState(793); + voidInterfaceMethodDeclaratorRest(); + } + break; + case Abstract: + case Class: + case Final: + case Interface: + case Native: + case Private: + case Protected: + case Public: + case Static: + case Strictfp: + case Synchronized: + case Transient: + case Volatile: + enterOuterAlt(_localctx, 3); + { + setState(795); + classOrInterfaceDeclaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMethodOrFieldDeclContext extends ParserRuleContext { + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public InterfaceMethodOrFieldRestContext interfaceMethodOrFieldRest() { + return getRuleContext(InterfaceMethodOrFieldRestContext.class,0); + } + public InterfaceMethodOrFieldDeclContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMethodOrFieldDecl; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceMethodOrFieldDecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceMethodOrFieldDecl(this); + } + } + + public final InterfaceMethodOrFieldDeclContext interfaceMethodOrFieldDecl() throws RecognitionException { + InterfaceMethodOrFieldDeclContext _localctx = new InterfaceMethodOrFieldDeclContext(_ctx, getState()); + enterRule(_localctx, 146, RULE_interfaceMethodOrFieldDecl); + try { + enterOuterAlt(_localctx, 1); + { + setState(798); + type(); + setState(799); + identifier(); + setState(800); + interfaceMethodOrFieldRest(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMethodOrFieldRestContext extends ParserRuleContext { + public ConstantDeclaratorRestContext constantDeclaratorRest() { + return getRuleContext(ConstantDeclaratorRestContext.class,0); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public InterfaceMethodDeclaratorRestContext interfaceMethodDeclaratorRest() { + return getRuleContext(InterfaceMethodDeclaratorRestContext.class,0); + } + public InterfaceMethodOrFieldRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMethodOrFieldRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceMethodOrFieldRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceMethodOrFieldRest(this); + } + } + + public final InterfaceMethodOrFieldRestContext interfaceMethodOrFieldRest() throws RecognitionException { + InterfaceMethodOrFieldRestContext _localctx = new InterfaceMethodOrFieldRestContext(_ctx, getState()); + enterRule(_localctx, 148, RULE_interfaceMethodOrFieldRest); + try { + setState(806); + _errHandler.sync(this); + switch (_input.LA(1)) { + case SquareBracketLeft: + case Assignment: + enterOuterAlt(_localctx, 1); + { + setState(802); + constantDeclaratorRest(); + setState(803); + match(Semicolon); + } + break; + case ParenthesesLeft: + enterOuterAlt(_localctx, 2); + { + setState(805); + interfaceMethodDeclaratorRest(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodDeclaratorRestContext extends ParserRuleContext { + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public MethodBodyContext methodBody() { + return getRuleContext(MethodBodyContext.class,0); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public TerminalNode Throws() { return getToken(ExprParser.Throws, 0); } + public QualifiedIdentifierListContext qualifiedIdentifierList() { + return getRuleContext(QualifiedIdentifierListContext.class,0); + } + public MethodDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMethodDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMethodDeclaratorRest(this); + } + } + + public final MethodDeclaratorRestContext methodDeclaratorRest() throws RecognitionException { + MethodDeclaratorRestContext _localctx = new MethodDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 150, RULE_methodDeclaratorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(808); + formalParameters(); + setState(809); + bracketsOpt(); + setState(812); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Throws) { + { + setState(810); + match(Throws); + setState(811); + qualifiedIdentifierList(); + } + } + + setState(816); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CurlyBracketLeft: + { + setState(814); + methodBody(); + } + break; + case Semicolon: + { + setState(815); + match(Semicolon); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VoidMethodDeclaratorRestContext extends ParserRuleContext { + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public MethodBodyContext methodBody() { + return getRuleContext(MethodBodyContext.class,0); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public TerminalNode Throws() { return getToken(ExprParser.Throws, 0); } + public QualifiedIdentifierListContext qualifiedIdentifierList() { + return getRuleContext(QualifiedIdentifierListContext.class,0); + } + public VoidMethodDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_voidMethodDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVoidMethodDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVoidMethodDeclaratorRest(this); + } + } + + public final VoidMethodDeclaratorRestContext voidMethodDeclaratorRest() throws RecognitionException { + VoidMethodDeclaratorRestContext _localctx = new VoidMethodDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 152, RULE_voidMethodDeclaratorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(818); + formalParameters(); + setState(821); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Throws) { + { + setState(819); + match(Throws); + setState(820); + qualifiedIdentifierList(); + } + } + + setState(825); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CurlyBracketLeft: + { + setState(823); + methodBody(); + } + break; + case Semicolon: + { + setState(824); + match(Semicolon); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMethodDeclaratorRestContext extends ParserRuleContext { + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public BracketsOptContext bracketsOpt() { + return getRuleContext(BracketsOptContext.class,0); + } + public TerminalNode Semicolon() { return getToken(ExprParser.Semicolon, 0); } + public TerminalNode Throws() { return getToken(ExprParser.Throws, 0); } + public QualifiedIdentifierListContext qualifiedIdentifierList() { + return getRuleContext(QualifiedIdentifierListContext.class,0); + } + public InterfaceMethodDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMethodDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterInterfaceMethodDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitInterfaceMethodDeclaratorRest(this); + } + } + + public final InterfaceMethodDeclaratorRestContext interfaceMethodDeclaratorRest() throws RecognitionException { + InterfaceMethodDeclaratorRestContext _localctx = new InterfaceMethodDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 154, RULE_interfaceMethodDeclaratorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(827); + formalParameters(); + setState(828); + bracketsOpt(); + setState(831); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Throws) { + { + setState(829); + match(Throws); + setState(830); + qualifiedIdentifierList(); + } + } + + setState(833); + match(Semicolon); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VoidInterfaceMethodDeclaratorRestContext extends ParserRuleContext { + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public TerminalNode Throws() { return getToken(ExprParser.Throws, 0); } + public QualifiedIdentifierListContext qualifiedIdentifierList() { + return getRuleContext(QualifiedIdentifierListContext.class,0); + } + public VoidInterfaceMethodDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_voidInterfaceMethodDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterVoidInterfaceMethodDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitVoidInterfaceMethodDeclaratorRest(this); + } + } + + public final VoidInterfaceMethodDeclaratorRestContext voidInterfaceMethodDeclaratorRest() throws RecognitionException { + VoidInterfaceMethodDeclaratorRestContext _localctx = new VoidInterfaceMethodDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 156, RULE_voidInterfaceMethodDeclaratorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(835); + formalParameters(); + setState(838); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Throws) { + { + setState(836); + match(Throws); + setState(837); + qualifiedIdentifierList(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstructorDeclaratorRestContext extends ParserRuleContext { + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public MethodBodyContext methodBody() { + return getRuleContext(MethodBodyContext.class,0); + } + public TerminalNode Throws() { return getToken(ExprParser.Throws, 0); } + public QualifiedIdentifierListContext qualifiedIdentifierList() { + return getRuleContext(QualifiedIdentifierListContext.class,0); + } + public ConstructorDeclaratorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constructorDeclaratorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterConstructorDeclaratorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitConstructorDeclaratorRest(this); + } + } + + public final ConstructorDeclaratorRestContext constructorDeclaratorRest() throws RecognitionException { + ConstructorDeclaratorRestContext _localctx = new ConstructorDeclaratorRestContext(_ctx, getState()); + enterRule(_localctx, 158, RULE_constructorDeclaratorRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(840); + formalParameters(); + setState(843); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Throws) { + { + setState(841); + match(Throws); + setState(842); + qualifiedIdentifierList(); + } + } + + setState(845); + methodBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class QualifiedIdentifierListContext extends ParserRuleContext { + public List qualifiedIdentifier() { + return getRuleContexts(QualifiedIdentifierContext.class); + } + public QualifiedIdentifierContext qualifiedIdentifier(int i) { + return getRuleContext(QualifiedIdentifierContext.class,i); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public QualifiedIdentifierListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_qualifiedIdentifierList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterQualifiedIdentifierList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitQualifiedIdentifierList(this); + } + } + + public final QualifiedIdentifierListContext qualifiedIdentifierList() throws RecognitionException { + QualifiedIdentifierListContext _localctx = new QualifiedIdentifierListContext(_ctx, getState()); + enterRule(_localctx, 160, RULE_qualifiedIdentifierList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(847); + qualifiedIdentifier(); + setState(852); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(848); + match(Comma); + setState(849); + qualifiedIdentifier(); + } + } + setState(854); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FormalParametersContext extends ParserRuleContext { + public TerminalNode ParenthesesLeft() { return getToken(ExprParser.ParenthesesLeft, 0); } + public TerminalNode ParenthesesRight() { return getToken(ExprParser.ParenthesesRight, 0); } + public List formalParameter() { + return getRuleContexts(FormalParameterContext.class); + } + public FormalParameterContext formalParameter(int i) { + return getRuleContext(FormalParameterContext.class,i); + } + public List Comma() { return getTokens(ExprParser.Comma); } + public TerminalNode Comma(int i) { + return getToken(ExprParser.Comma, i); + } + public FormalParametersContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_formalParameters; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterFormalParameters(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitFormalParameters(this); + } + } + + public final FormalParametersContext formalParameters() throws RecognitionException { + FormalParametersContext _localctx = new FormalParametersContext(_ctx, getState()); + enterRule(_localctx, 162, RULE_formalParameters); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(855); + match(ParenthesesLeft); + setState(864); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 276222772384L) != 0) || _la==IDENTIFIER) { + { + setState(856); + formalParameter(); + setState(861); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==Comma) { + { + { + setState(857); + match(Comma); + setState(858); + formalParameter(); + } + } + setState(863); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + + setState(866); + match(ParenthesesRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FormalParameterContext extends ParserRuleContext { + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public VariableDeclaratorIdContext variableDeclaratorId() { + return getRuleContext(VariableDeclaratorIdContext.class,0); + } + public TerminalNode Final() { return getToken(ExprParser.Final, 0); } + public FormalParameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_formalParameter; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterFormalParameter(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitFormalParameter(this); + } + } + + public final FormalParameterContext formalParameter() throws RecognitionException { + FormalParameterContext _localctx = new FormalParameterContext(_ctx, getState()); + enterRule(_localctx, 164, RULE_formalParameter); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(869); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==Final) { + { + setState(868); + match(Final); + } + } + + setState(871); + type(); + setState(872); + variableDeclaratorId(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodBodyContext extends ParserRuleContext { + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public MethodBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).enterMethodBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof ExprParserListener ) ((ExprParserListener)listener).exitMethodBody(this); + } + } + + public final MethodBodyContext methodBody() throws RecognitionException { + MethodBodyContext _localctx = new MethodBodyContext(_ctx, getState()); + enterRule(_localctx, 166, RULE_methodBody); + try { + enterOuterAlt(_localctx, 1); + { + setState(874); + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static final String _serializedATN = + "\u0004\u0001h\u036d\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ + "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+ + "\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002"+ + "\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007\u000f"+ + "\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007\u0012"+ + "\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007\u0015"+ + "\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002\u0018\u0007\u0018"+ + "\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002\u001b\u0007\u001b"+ + "\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002\u001e\u0007\u001e"+ + "\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007!\u0002\"\u0007\"\u0002"+ + "#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007&\u0002\'\u0007\'\u0002"+ + "(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007+\u0002,\u0007,\u0002"+ + "-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u00070\u00021\u00071\u0002"+ + "2\u00072\u00023\u00073\u00024\u00074\u00025\u00075\u00026\u00076\u0002"+ + "7\u00077\u00028\u00078\u00029\u00079\u0002:\u0007:\u0002;\u0007;\u0002"+ + "<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007?\u0002@\u0007@\u0002"+ + "A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007D\u0002E\u0007E\u0002"+ + "F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007I\u0002J\u0007J\u0002"+ + "K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007N\u0002O\u0007O\u0002"+ + "P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007S\u0001\u0000\u0001\u0000"+ + "\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002"+ + "\u0005\u0002\u00b1\b\u0002\n\u0002\f\u0002\u00b4\t\u0002\u0001\u0003\u0001"+ + "\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0003"+ + "\u0004\u00bd\b\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001"+ + "\u0005\u0001\u0005\u0001\u0005\u0003\u0005\u00c6\b\u0005\u0001\u0006\u0001"+ + "\u0006\u0001\u0006\u0005\u0006\u00cb\b\u0006\n\u0006\f\u0006\u00ce\t\u0006"+ + "\u0001\u0007\u0001\u0007\u0001\u0007\u0005\u0007\u00d3\b\u0007\n\u0007"+ + "\f\u0007\u00d6\t\u0007\u0001\b\u0001\b\u0001\b\u0005\b\u00db\b\b\n\b\f"+ + "\b\u00de\t\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0005\t\u00e5\b\t"+ + "\n\t\f\t\u00e8\t\t\u0001\n\u0001\n\u0001\n\u0005\n\u00ed\b\n\n\n\f\n\u00f0"+ + "\t\n\u0001\u000b\u0001\u000b\u0001\u000b\u0005\u000b\u00f5\b\u000b\n\u000b"+ + "\f\u000b\u00f8\t\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f"+ + "\u0001\f\u0003\f\u0101\b\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0005\r\u010d\b\r\n\r\f\r\u0110\t\r"+ + "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0003\u000e\u011e\b\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0001\u000e\u0001\u000e\u0001\u000e\u0005\u000e\u0127\b\u000e\n\u000e"+ + "\f\u000e\u012a\t\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0001\u000e\u0001\u000e\u0001\u000e\u0003\u000e\u0133\b\u000e\u0001\u000f"+ + "\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0005\u0010\u013a\b\u0010"+ + "\n\u0010\f\u0010\u013d\t\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0003"+ + "\u0010\u0142\b\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001"+ + "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"+ + "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"+ + "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"+ + "\u0013\u0003\u0013\u015b\b\u0013\u0003\u0013\u015d\b\u0013\u0001\u0014"+ + "\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0016\u0003\u0016\u0164\b\u0016"+ + "\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0005\u0017\u016a\b\u0017"+ + "\n\u0017\f\u0017\u016d\t\u0017\u0003\u0017\u016f\b\u0017\u0001\u0017\u0001"+ + "\u0017\u0001\u0018\u0001\u0018\u0005\u0018\u0175\b\u0018\n\u0018\f\u0018"+ + "\u0178\t\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0003\u0019\u017d\b"+ + "\u0019\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0001"+ + "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001"+ + "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0005\u001b\u018e\b\u001b\n"+ + "\u001b\f\u001b\u0191\t\u001b\u0003\u001b\u0193\b\u001b\u0001\u001c\u0001"+ + "\u001c\u0003\u001c\u0197\b\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0001"+ + "\u001d\u0005\u001d\u019d\b\u001d\n\u001d\f\u001d\u01a0\t\u001d\u0001\u001d"+ + "\u0003\u001d\u01a3\b\u001d\u0003\u001d\u01a5\b\u001d\u0001\u001d\u0001"+ + "\u001d\u0001\u001e\u0001\u001e\u0003\u001e\u01ab\b\u001e\u0001\u001f\u0001"+ + "\u001f\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001!\u0005"+ + "!\u01b6\b!\n!\f!\u01b9\t!\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0003"+ + "\"\u01c0\b\"\u0001\"\u0003\"\u01c3\b\"\u0001#\u0003#\u01c6\b#\u0001#\u0001"+ + "#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0003$\u01d0\b$\u0001%\u0001"+ + "%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0003%\u01dc"+ + "\b%\u0001%\u0001%\u0003%\u01e0\b%\u0001%\u0001%\u0003%\u01e4\b%\u0001"+ + "%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001"+ + "%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001"+ + "%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001"+ + "%\u0001%\u0001%\u0001%\u0003%\u0208\b%\u0001%\u0001%\u0001%\u0001%\u0001"+ + "%\u0001%\u0001%\u0003%\u0211\b%\u0001%\u0001%\u0001%\u0003%\u0216\b%\u0001"+ + "%\u0001%\u0001%\u0001%\u0001%\u0003%\u021d\b%\u0001&\u0001&\u0001&\u0001"+ + "&\u0001&\u0001&\u0001&\u0003&\u0226\b&\u0001\'\u0001\'\u0005\'\u022a\b"+ + "\'\n\'\f\'\u022d\t\'\u0001(\u0001(\u0001(\u0001(\u0001(\u0001(\u0001)"+ + "\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0003)\u023e"+ + "\b)\u0001)\u0001)\u0003)\u0242\b)\u0001*\u0005*\u0245\b*\n*\f*\u0248\t"+ + "*\u0001+\u0001+\u0001+\u0001,\u0001,\u0001,\u0001,\u0001,\u0001,\u0003"+ + ",\u0253\b,\u0001-\u0001-\u0005-\u0257\b-\n-\f-\u025a\t-\u0001.\u0001."+ + "\u0001.\u0001.\u0003.\u0260\b.\u0001.\u0001.\u0001.\u0003.\u0265\b.\u0001"+ + "/\u0001/\u0001/\u00010\u00050\u026b\b0\n0\f0\u026e\t0\u00011\u00011\u0001"+ + "2\u00012\u00012\u00052\u0275\b2\n2\f2\u0278\t2\u00013\u00013\u00013\u0005"+ + "3\u027d\b3\n3\f3\u0280\t3\u00014\u00014\u00014\u00054\u0285\b4\n4\f4\u0288"+ + "\t4\u00015\u00015\u00015\u00016\u00016\u00016\u00017\u00017\u00017\u0003"+ + "7\u0293\b7\u00018\u00018\u00018\u00018\u00019\u00019\u00019\u0001:\u0001"+ + ":\u0001:\u0001:\u0003:\u02a0\b:\u0001:\u0005:\u02a3\b:\n:\f:\u02a6\t:"+ + "\u0001:\u0005:\u02a9\b:\n:\f:\u02ac\t:\u0001;\u0001;\u0001;\u0001;\u0005"+ + ";\u02b2\b;\n;\f;\u02b5\t;\u0001;\u0001;\u0003;\u02b9\b;\u0001;\u0001;"+ + "\u0001<\u0001<\u0003<\u02bf\b<\u0001=\u0001=\u0001=\u0003=\u02c4\b=\u0001"+ + ">\u0001>\u0001>\u0001>\u0003>\u02ca\b>\u0001>\u0001>\u0003>\u02ce\b>\u0001"+ + ">\u0001>\u0001?\u0001?\u0001?\u0001?\u0003?\u02d6\b?\u0001?\u0001?\u0001"+ + "@\u0001@\u0001@\u0005@\u02dd\b@\n@\f@\u02e0\t@\u0001A\u0001A\u0005A\u02e4"+ + "\bA\nA\fA\u02e7\tA\u0001A\u0001A\u0001B\u0001B\u0005B\u02ed\bB\nB\fB\u02f0"+ + "\tB\u0001B\u0001B\u0001C\u0001C\u0003C\u02f6\bC\u0001C\u0001C\u0001C\u0001"+ + "C\u0003C\u02fc\bC\u0001D\u0001D\u0001D\u0001D\u0001D\u0001D\u0001D\u0001"+ + "D\u0001D\u0003D\u0307\bD\u0001E\u0001E\u0001E\u0001E\u0001F\u0001F\u0003"+ + "F\u030f\bF\u0001G\u0001G\u0001G\u0001G\u0003G\u0315\bG\u0001H\u0001H\u0001"+ + "H\u0001H\u0001H\u0001H\u0003H\u031d\bH\u0001I\u0001I\u0001I\u0001I\u0001"+ + "J\u0001J\u0001J\u0001J\u0003J\u0327\bJ\u0001K\u0001K\u0001K\u0001K\u0003"+ + "K\u032d\bK\u0001K\u0001K\u0003K\u0331\bK\u0001L\u0001L\u0001L\u0003L\u0336"+ + "\bL\u0001L\u0001L\u0003L\u033a\bL\u0001M\u0001M\u0001M\u0001M\u0003M\u0340"+ + "\bM\u0001M\u0001M\u0001N\u0001N\u0001N\u0003N\u0347\bN\u0001O\u0001O\u0001"+ + "O\u0003O\u034c\bO\u0001O\u0001O\u0001P\u0001P\u0001P\u0005P\u0353\bP\n"+ + "P\fP\u0356\tP\u0001Q\u0001Q\u0001Q\u0001Q\u0005Q\u035c\bQ\nQ\fQ\u035f"+ + "\tQ\u0003Q\u0361\bQ\u0001Q\u0001Q\u0001R\u0003R\u0366\bR\u0001R\u0001"+ + "R\u0001R\u0001S\u0001S\u0001S\u0000\u0000T\u0000\u0002\u0004\u0006\b\n"+ + "\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a\u001c\u001e \"$&(*,.0246"+ + "8:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a"+ + "\u008c\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2"+ + "\u00a4\u00a6\u0000\n\u0001\u00005:\u0001\u0000DE\u0002\u0000FG[\\\u0001"+ + "\u0000`a\u0002\u0000bcgg\u0004\u0000JKZZ]]`a\u0002\u0000CCOY\u0001\u0000"+ + "JK\b\u0000\u0005\u0005\u0007\u0007\n\n\u0010\u0010\u0015\u0015\u001c\u001c"+ + "\u001e\u001e&&\b\u0000\u0003\u0003\u0013\u0013\u001f\u001f\"$\'(++//2"+ + "2\u0396\u0000\u00a8\u0001\u0000\u0000\u0000\u0002\u00ab\u0001\u0000\u0000"+ + "\u0000\u0004\u00ad\u0001\u0000\u0000\u0000\u0006\u00b5\u0001\u0000\u0000"+ + "\u0000\b\u00bc\u0001\u0000\u0000\u0000\n\u00c5\u0001\u0000\u0000\u0000"+ + "\f\u00c7\u0001\u0000\u0000\u0000\u000e\u00cf\u0001\u0000\u0000\u0000\u0010"+ + "\u00d7\u0001\u0000\u0000\u0000\u0012\u00df\u0001\u0000\u0000\u0000\u0014"+ + "\u00e9\u0001\u0000\u0000\u0000\u0016\u00f1\u0001\u0000\u0000\u0000\u0018"+ + "\u0100\u0001\u0000\u0000\u0000\u001a\u0102\u0001\u0000\u0000\u0000\u001c"+ + "\u0132\u0001\u0000\u0000\u0000\u001e\u0134\u0001\u0000\u0000\u0000 \u0141"+ + "\u0001\u0000\u0000\u0000\"\u0143\u0001\u0000\u0000\u0000$\u0145\u0001"+ + "\u0000\u0000\u0000&\u015c\u0001\u0000\u0000\u0000(\u015e\u0001\u0000\u0000"+ + "\u0000*\u0160\u0001\u0000\u0000\u0000,\u0163\u0001\u0000\u0000\u0000."+ + "\u0165\u0001\u0000\u0000\u00000\u0176\u0001\u0000\u0000\u00002\u0179\u0001"+ + "\u0000\u0000\u00004\u017e\u0001\u0000\u0000\u00006\u0192\u0001\u0000\u0000"+ + "\u00008\u0194\u0001\u0000\u0000\u0000:\u0198\u0001\u0000\u0000\u0000<"+ + "\u01aa\u0001\u0000\u0000\u0000>\u01ac\u0001\u0000\u0000\u0000@\u01b0\u0001"+ + "\u0000\u0000\u0000B\u01b7\u0001\u0000\u0000\u0000D\u01c2\u0001\u0000\u0000"+ + "\u0000F\u01c5\u0001\u0000\u0000\u0000H\u01cf\u0001\u0000\u0000\u0000J"+ + "\u021c\u0001\u0000\u0000\u0000L\u0225\u0001\u0000\u0000\u0000N\u0227\u0001"+ + "\u0000\u0000\u0000P\u022e\u0001\u0000\u0000\u0000R\u0241\u0001\u0000\u0000"+ + "\u0000T\u0246\u0001\u0000\u0000\u0000V\u0249\u0001\u0000\u0000\u0000X"+ + "\u0252\u0001\u0000\u0000\u0000Z\u0258\u0001\u0000\u0000\u0000\\\u0264"+ + "\u0001\u0000\u0000\u0000^\u0266\u0001\u0000\u0000\u0000`\u026c\u0001\u0000"+ + "\u0000\u0000b\u026f\u0001\u0000\u0000\u0000d\u0271\u0001\u0000\u0000\u0000"+ + "f\u0279\u0001\u0000\u0000\u0000h\u0281\u0001\u0000\u0000\u0000j\u0289"+ + "\u0001\u0000\u0000\u0000l\u028c\u0001\u0000\u0000\u0000n\u028f\u0001\u0000"+ + "\u0000\u0000p\u0294\u0001\u0000\u0000\u0000r\u0298\u0001\u0000\u0000\u0000"+ + "t\u029f\u0001\u0000\u0000\u0000v\u02ad\u0001\u0000\u0000\u0000x\u02be"+ + "\u0001\u0000\u0000\u0000z\u02c0\u0001\u0000\u0000\u0000|\u02c5\u0001\u0000"+ + "\u0000\u0000~\u02d1\u0001\u0000\u0000\u0000\u0080\u02d9\u0001\u0000\u0000"+ + "\u0000\u0082\u02e1\u0001\u0000\u0000\u0000\u0084\u02ea\u0001\u0000\u0000"+ + "\u0000\u0086\u02fb\u0001\u0000\u0000\u0000\u0088\u0306\u0001\u0000\u0000"+ + "\u0000\u008a\u0308\u0001\u0000\u0000\u0000\u008c\u030e\u0001\u0000\u0000"+ + "\u0000\u008e\u0314\u0001\u0000\u0000\u0000\u0090\u031c\u0001\u0000\u0000"+ + "\u0000\u0092\u031e\u0001\u0000\u0000\u0000\u0094\u0326\u0001\u0000\u0000"+ + "\u0000\u0096\u0328\u0001\u0000\u0000\u0000\u0098\u0332\u0001\u0000\u0000"+ + "\u0000\u009a\u033b\u0001\u0000\u0000\u0000\u009c\u0343\u0001\u0000\u0000"+ + "\u0000\u009e\u0348\u0001\u0000\u0000\u0000\u00a0\u034f\u0001\u0000\u0000"+ + "\u0000\u00a2\u0357\u0001\u0000\u0000\u0000\u00a4\u0365\u0001\u0000\u0000"+ + "\u0000\u00a6\u036a\u0001\u0000\u0000\u0000\u00a8\u00a9\u0003t:\u0000\u00a9"+ + "\u00aa\u0005\u0000\u0000\u0001\u00aa\u0001\u0001\u0000\u0000\u0000\u00ab"+ + "\u00ac\u0005h\u0000\u0000\u00ac\u0003\u0001\u0000\u0000\u0000\u00ad\u00b2"+ + "\u0003\u0002\u0001\u0000\u00ae\u00af\u00054\u0000\u0000\u00af\u00b1\u0003"+ + "\u0002\u0001\u0000\u00b0\u00ae\u0001\u0000\u0000\u0000\u00b1\u00b4\u0001"+ + "\u0000\u0000\u0000\u00b2\u00b0\u0001\u0000\u0000\u0000\u00b2\u00b3\u0001"+ + "\u0000\u0000\u0000\u00b3\u0005\u0001\u0000\u0000\u0000\u00b4\u00b2\u0001"+ + "\u0000\u0000\u0000\u00b5\u00b6\u0007\u0000\u0000\u0000\u00b6\u0007\u0001"+ + "\u0000\u0000\u0000\u00b7\u00b8\u0003\u0018\f\u0000\u00b8\u00b9\u0003\u001e"+ + "\u000f\u0000\u00b9\u00ba\u0003\b\u0004\u0000\u00ba\u00bd\u0001\u0000\u0000"+ + "\u0000\u00bb\u00bd\u0003\n\u0005\u0000\u00bc\u00b7\u0001\u0000\u0000\u0000"+ + "\u00bc\u00bb\u0001\u0000\u0000\u0000\u00bd\t\u0001\u0000\u0000\u0000\u00be"+ + "\u00bf\u0003\f\u0006\u0000\u00bf\u00c0\u0005^\u0000\u0000\u00c0\u00c1"+ + "\u0003\n\u0005\u0000\u00c1\u00c2\u0005_\u0000\u0000\u00c2\u00c3\u0003"+ + "\n\u0005\u0000\u00c3\u00c6\u0001\u0000\u0000\u0000\u00c4\u00c6\u0003\f"+ + "\u0006\u0000\u00c5\u00be\u0001\u0000\u0000\u0000\u00c5\u00c4\u0001\u0000"+ + "\u0000\u0000\u00c6\u000b\u0001\u0000\u0000\u0000\u00c7\u00cc\u0003\u000e"+ + "\u0007\u0000\u00c8\u00c9\u0005I\u0000\u0000\u00c9\u00cb\u0003\u000e\u0007"+ + "\u0000\u00ca\u00c8\u0001\u0000\u0000\u0000\u00cb\u00ce\u0001\u0000\u0000"+ + "\u0000\u00cc\u00ca\u0001\u0000\u0000\u0000\u00cc\u00cd\u0001\u0000\u0000"+ + "\u0000\u00cd\r\u0001\u0000\u0000\u0000\u00ce\u00cc\u0001\u0000\u0000\u0000"+ + "\u00cf\u00d4\u0003\u0010\b\u0000\u00d0\u00d1\u0005H\u0000\u0000\u00d1"+ + "\u00d3\u0003\u0010\b\u0000\u00d2\u00d0\u0001\u0000\u0000\u0000\u00d3\u00d6"+ + "\u0001\u0000\u0000\u0000\u00d4\u00d2\u0001\u0000\u0000\u0000\u00d4\u00d5"+ + "\u0001\u0000\u0000\u0000\u00d5\u000f\u0001\u0000\u0000\u0000\u00d6\u00d4"+ + "\u0001\u0000\u0000\u0000\u00d7\u00dc\u0003\u0012\t\u0000\u00d8\u00d9\u0007"+ + "\u0001\u0000\u0000\u00d9\u00db\u0003\u0012\t\u0000\u00da\u00d8\u0001\u0000"+ + "\u0000\u0000\u00db\u00de\u0001\u0000\u0000\u0000\u00dc\u00da\u0001\u0000"+ + "\u0000\u0000\u00dc\u00dd\u0001\u0000\u0000\u0000\u00dd\u0011\u0001\u0000"+ + "\u0000\u0000\u00de\u00dc\u0001\u0000\u0000\u0000\u00df\u00e6\u0003\u0014"+ + "\n\u0000\u00e0\u00e1\u0007\u0002\u0000\u0000\u00e1\u00e5\u0003\u0014\n"+ + "\u0000\u00e2\u00e3\u0005\u001b\u0000\u0000\u00e3\u00e5\u0003 \u0010\u0000"+ + "\u00e4\u00e0\u0001\u0000\u0000\u0000\u00e4\u00e2\u0001\u0000\u0000\u0000"+ + "\u00e5\u00e8\u0001\u0000\u0000\u0000\u00e6\u00e4\u0001\u0000\u0000\u0000"+ + "\u00e6\u00e7\u0001\u0000\u0000\u0000\u00e7\u0013\u0001\u0000\u0000\u0000"+ + "\u00e8\u00e6\u0001\u0000\u0000\u0000\u00e9\u00ee\u0003\u0016\u000b\u0000"+ + "\u00ea\u00eb\u0007\u0003\u0000\u0000\u00eb\u00ed\u0003\u0016\u000b\u0000"+ + "\u00ec\u00ea\u0001\u0000\u0000\u0000\u00ed\u00f0\u0001\u0000\u0000\u0000"+ + "\u00ee\u00ec\u0001\u0000\u0000\u0000\u00ee\u00ef\u0001\u0000\u0000\u0000"+ + "\u00ef\u0015\u0001\u0000\u0000\u0000\u00f0\u00ee\u0001\u0000\u0000\u0000"+ + "\u00f1\u00f6\u0003\u0018\f\u0000\u00f2\u00f3\u0007\u0004\u0000\u0000\u00f3"+ + "\u00f5\u0003\u0018\f\u0000\u00f4\u00f2\u0001\u0000\u0000\u0000\u00f5\u00f8"+ + "\u0001\u0000\u0000\u0000\u00f6\u00f4\u0001\u0000\u0000\u0000\u00f6\u00f7"+ + "\u0001\u0000\u0000\u0000\u00f7\u0017\u0001\u0000\u0000\u0000\u00f8\u00f6"+ + "\u0001\u0000\u0000\u0000\u00f9\u0101\u0003\u001a\r\u0000\u00fa\u00fb\u0007"+ + "\u0005\u0000\u0000\u00fb\u0101\u0003\u0018\f\u0000\u00fc\u00fd\u0003>"+ + "\u001f\u0000\u00fd\u00fe\u0003 \u0010\u0000\u00fe\u00ff\u0003\u0018\f"+ + "\u0000\u00ff\u0101\u0001\u0000\u0000\u0000\u0100\u00f9\u0001\u0000\u0000"+ + "\u0000\u0100\u00fa\u0001\u0000\u0000\u0000\u0100\u00fc\u0001\u0000\u0000"+ + "\u0000\u0101\u0019\u0001\u0000\u0000\u0000\u0102\u010e\u0003\u001c\u000e"+ + "\u0000\u0103\u010d\u0005J\u0000\u0000\u0104\u010d\u0005K\u0000\u0000\u0105"+ + "\u0106\u00054\u0000\u0000\u0106\u010d\u0005h\u0000\u0000\u0107\u0108\u0005"+ + "?\u0000\u0000\u0108\u0109\u0003\b\u0004\u0000\u0109\u010a\u0005@\u0000"+ + "\u0000\u010a\u010d\u0001\u0000\u0000\u0000\u010b\u010d\u0003.\u0017\u0000"+ + "\u010c\u0103\u0001\u0000\u0000\u0000\u010c\u0104\u0001\u0000\u0000\u0000"+ + "\u010c\u0105\u0001\u0000\u0000\u0000\u010c\u0107\u0001\u0000\u0000\u0000"+ + "\u010c\u010b\u0001\u0000\u0000\u0000\u010d\u0110\u0001\u0000\u0000\u0000"+ + "\u010e\u010c\u0001\u0000\u0000\u0000\u010e\u010f\u0001\u0000\u0000\u0000"+ + "\u010f\u001b\u0001\u0000\u0000\u0000\u0110\u010e\u0001\u0000\u0000\u0000"+ + "\u0111\u0133\u0003>\u001f\u0000\u0112\u0133\u00055\u0000\u0000\u0113\u0133"+ + "\u00056\u0000\u0000\u0114\u0133\u00058\u0000\u0000\u0115\u0133\u00057"+ + "\u0000\u0000\u0116\u0133\u00059\u0000\u0000\u0117\u0133\u0005:\u0000\u0000"+ + "\u0118\u0133\u0005h\u0000\u0000\u0119\u0133\u0005,\u0000\u0000\u011a\u011d"+ + "\u0005)\u0000\u0000\u011b\u011c\u00054\u0000\u0000\u011c\u011e\u0005h"+ + "\u0000\u0000\u011d\u011b\u0001\u0000\u0000\u0000\u011d\u011e\u0001\u0000"+ + "\u0000\u0000\u011e\u0133\u0001\u0000\u0000\u0000\u011f\u0120\u0005 \u0000"+ + "\u0000\u0120\u0121\u0003 \u0010\u0000\u0121\u0122\u0003.\u0017\u0000\u0122"+ + "\u0133\u0001\u0000\u0000\u0000\u0123\u0128\u0003*\u0015\u0000\u0124\u0125"+ + "\u0005?\u0000\u0000\u0125\u0127\u0005@\u0000\u0000\u0126\u0124\u0001\u0000"+ + "\u0000\u0000\u0127\u012a\u0001\u0000\u0000\u0000\u0128\u0126\u0001\u0000"+ + "\u0000\u0000\u0128\u0129\u0001\u0000\u0000\u0000\u0129\u012b\u0001\u0000"+ + "\u0000\u0000\u012a\u0128\u0001\u0000\u0000\u0000\u012b\u012c\u00054\u0000"+ + "\u0000\u012c\u012d\u0005\u000b\u0000\u0000\u012d\u0133\u0001\u0000\u0000"+ + "\u0000\u012e\u012f\u0003 \u0010\u0000\u012f\u0130\u00054\u0000\u0000\u0130"+ + "\u0131\u0005\u000b\u0000\u0000\u0131\u0133\u0001\u0000\u0000\u0000\u0132"+ + "\u0111\u0001\u0000\u0000\u0000\u0132\u0112\u0001\u0000\u0000\u0000\u0132"+ + "\u0113\u0001\u0000\u0000\u0000\u0132\u0114\u0001\u0000\u0000\u0000\u0132"+ + "\u0115\u0001\u0000\u0000\u0000\u0132\u0116\u0001\u0000\u0000\u0000\u0132"+ + "\u0117\u0001\u0000\u0000\u0000\u0132\u0118\u0001\u0000\u0000\u0000\u0132"+ + "\u0119\u0001\u0000\u0000\u0000\u0132\u011a\u0001\u0000\u0000\u0000\u0132"+ + "\u011f\u0001\u0000\u0000\u0000\u0132\u0123\u0001\u0000\u0000\u0000\u0132"+ + "\u012e\u0001\u0000\u0000\u0000\u0133\u001d\u0001\u0000\u0000\u0000\u0134"+ + "\u0135\u0007\u0006\u0000\u0000\u0135\u001f\u0001\u0000\u0000\u0000\u0136"+ + "\u013b\u0003\u0002\u0001\u0000\u0137\u0138\u00054\u0000\u0000\u0138\u013a"+ + "\u0003\u0002\u0001\u0000\u0139\u0137\u0001\u0000\u0000\u0000\u013a\u013d"+ + "\u0001\u0000\u0000\u0000\u013b\u0139\u0001\u0000\u0000\u0000\u013b\u013c"+ + "\u0001\u0000\u0000\u0000\u013c\u013e\u0001\u0000\u0000\u0000\u013d\u013b"+ + "\u0001\u0000\u0000\u0000\u013e\u013f\u00030\u0018\u0000\u013f\u0142\u0001"+ + "\u0000\u0000\u0000\u0140\u0142\u0003*\u0015\u0000\u0141\u0136\u0001\u0000"+ + "\u0000\u0000\u0141\u0140\u0001\u0000\u0000\u0000\u0142!\u0001\u0000\u0000"+ + "\u0000\u0143\u0144\u0003\b\u0004\u0000\u0144#\u0001\u0000\u0000\u0000"+ + "\u0145\u0146\u0003\b\u0004\u0000\u0146%\u0001\u0000\u0000\u0000\u0147"+ + "\u0148\u0005?\u0000\u0000\u0148\u0149\u0005@\u0000\u0000\u0149\u014a\u0003"+ + "0\u0018\u0000\u014a\u014b\u00054\u0000\u0000\u014b\u014c\u0005\u000b\u0000"+ + "\u0000\u014c\u015d\u0001\u0000\u0000\u0000\u014d\u014e\u0005?\u0000\u0000"+ + "\u014e\u014f\u0003\b\u0004\u0000\u014f\u0150\u0005@\u0000\u0000\u0150"+ + "\u015d\u0001\u0000\u0000\u0000\u0151\u015d\u0003.\u0017\u0000\u0152\u015a"+ + "\u00054\u0000\u0000\u0153\u015b\u0005\u000b\u0000\u0000\u0154\u015b\u0005"+ + ",\u0000\u0000\u0155\u0156\u0005)\u0000\u0000\u0156\u0157\u0003.\u0017"+ + "\u0000\u0157\u0158\u0005 \u0000\u0000\u0158\u0159\u00034\u001a\u0000\u0159"+ + "\u015b\u0001\u0000\u0000\u0000\u015a\u0153\u0001\u0000\u0000\u0000\u015a"+ + "\u0154\u0001\u0000\u0000\u0000\u015a\u0155\u0001\u0000\u0000\u0000\u015b"+ + "\u015d\u0001\u0000\u0000\u0000\u015c\u0147\u0001\u0000\u0000\u0000\u015c"+ + "\u014d\u0001\u0000\u0000\u0000\u015c\u0151\u0001\u0000\u0000\u0000\u015c"+ + "\u0152\u0001\u0000\u0000\u0000\u015d\'\u0001\u0000\u0000\u0000\u015e\u015f"+ + "\u0007\u0007\u0000\u0000\u015f)\u0001\u0000\u0000\u0000\u0160\u0161\u0007"+ + "\b\u0000\u0000\u0161+\u0001\u0000\u0000\u0000\u0162\u0164\u0003.\u0017"+ + "\u0000\u0163\u0162\u0001\u0000\u0000\u0000\u0163\u0164\u0001\u0000\u0000"+ + "\u0000\u0164-\u0001\u0000\u0000\u0000\u0165\u016e\u0005;\u0000\u0000\u0166"+ + "\u016b\u0003\b\u0004\u0000\u0167\u0168\u0005B\u0000\u0000\u0168\u016a"+ + "\u0003\b\u0004\u0000\u0169\u0167\u0001\u0000\u0000\u0000\u016a\u016d\u0001"+ + "\u0000\u0000\u0000\u016b\u0169\u0001\u0000\u0000\u0000\u016b\u016c\u0001"+ + "\u0000\u0000\u0000\u016c\u016f\u0001\u0000\u0000\u0000\u016d\u016b\u0001"+ + "\u0000\u0000\u0000\u016e\u0166\u0001\u0000\u0000\u0000\u016e\u016f\u0001"+ + "\u0000\u0000\u0000\u016f\u0170\u0001\u0000\u0000\u0000\u0170\u0171\u0005"+ + "<\u0000\u0000\u0171/\u0001\u0000\u0000\u0000\u0172\u0173\u0005?\u0000"+ + "\u0000\u0173\u0175\u0005@\u0000\u0000\u0174\u0172\u0001\u0000\u0000\u0000"+ + "\u0175\u0178\u0001\u0000\u0000\u0000\u0176\u0174\u0001\u0000\u0000\u0000"+ + "\u0176\u0177\u0001\u0000\u0000\u0000\u01771\u0001\u0000\u0000\u0000\u0178"+ + "\u0176\u0001\u0000\u0000\u0000\u0179\u017c\u0003\u0004\u0002\u0000\u017a"+ + "\u017d\u00036\u001b\u0000\u017b\u017d\u00038\u001c\u0000\u017c\u017a\u0001"+ + "\u0000\u0000\u0000\u017c\u017b\u0001\u0000\u0000\u0000\u017d3\u0001\u0000"+ + "\u0000\u0000\u017e\u017f\u0003\u0002\u0001\u0000\u017f\u0180\u00038\u001c"+ + "\u0000\u01805\u0001\u0000\u0000\u0000\u0181\u0182\u0005?\u0000\u0000\u0182"+ + "\u0183\u0005@\u0000\u0000\u0183\u0184\u00030\u0018\u0000\u0184\u0185\u0003"+ + ":\u001d\u0000\u0185\u0193\u0001\u0000\u0000\u0000\u0186\u0187\u0005?\u0000"+ + "\u0000\u0187\u0188\u0003\b\u0004\u0000\u0188\u018f\u0005@\u0000\u0000"+ + "\u0189\u018a\u0005?\u0000\u0000\u018a\u018b\u0003\b\u0004\u0000\u018b"+ + "\u018c\u0005@\u0000\u0000\u018c\u018e\u0001\u0000\u0000\u0000\u018d\u0189"+ + "\u0001\u0000\u0000\u0000\u018e\u0191\u0001\u0000\u0000\u0000\u018f\u018d"+ + "\u0001\u0000\u0000\u0000\u018f\u0190\u0001\u0000\u0000\u0000\u0190\u0193"+ + "\u0001\u0000\u0000\u0000\u0191\u018f\u0001\u0000\u0000\u0000\u0192\u0181"+ + "\u0001\u0000\u0000\u0000\u0192\u0186\u0001\u0000\u0000\u0000\u01937\u0001"+ + "\u0000\u0000\u0000\u0194\u0196\u0003.\u0017\u0000\u0195\u0197\u0003\u0082"+ + "A\u0000\u0196\u0195\u0001\u0000\u0000\u0000\u0196\u0197\u0001\u0000\u0000"+ + "\u0000\u01979\u0001\u0000\u0000\u0000\u0198\u01a4\u0005=\u0000\u0000\u0199"+ + "\u019e\u0003<\u001e\u0000\u019a\u019b\u0005B\u0000\u0000\u019b\u019d\u0003"+ + "<\u001e\u0000\u019c\u019a\u0001\u0000\u0000\u0000\u019d\u01a0\u0001\u0000"+ + "\u0000\u0000\u019e\u019c\u0001\u0000\u0000\u0000\u019e\u019f\u0001\u0000"+ + "\u0000\u0000\u019f\u01a2\u0001\u0000\u0000\u0000\u01a0\u019e\u0001\u0000"+ + "\u0000\u0000\u01a1\u01a3\u0005B\u0000\u0000\u01a2\u01a1\u0001\u0000\u0000"+ + "\u0000\u01a2\u01a3\u0001\u0000\u0000\u0000\u01a3\u01a5\u0001\u0000\u0000"+ + "\u0000\u01a4\u0199\u0001\u0000\u0000\u0000\u01a4\u01a5\u0001\u0000\u0000"+ + "\u0000\u01a5\u01a6\u0001\u0000\u0000\u0000\u01a6\u01a7\u0005>\u0000\u0000"+ + "\u01a7;\u0001\u0000\u0000\u0000\u01a8\u01ab\u0003:\u001d\u0000\u01a9\u01ab"+ + "\u0003\b\u0004\u0000\u01aa\u01a8\u0001\u0000\u0000\u0000\u01aa\u01a9\u0001"+ + "\u0000\u0000\u0000\u01ab=\u0001\u0000\u0000\u0000\u01ac\u01ad\u0005;\u0000"+ + "\u0000\u01ad\u01ae\u0003\b\u0004\u0000\u01ae\u01af\u0005<\u0000\u0000"+ + "\u01af?\u0001\u0000\u0000\u0000\u01b0\u01b1\u0005=\u0000\u0000\u01b1\u01b2"+ + "\u0003B!\u0000\u01b2\u01b3\u0005>\u0000\u0000\u01b3A\u0001\u0000\u0000"+ + "\u0000\u01b4\u01b6\u0003D\"\u0000\u01b5\u01b4\u0001\u0000\u0000\u0000"+ + "\u01b6\u01b9\u0001\u0000\u0000\u0000\u01b7\u01b5\u0001\u0000\u0000\u0000"+ + "\u01b7\u01b8\u0001\u0000\u0000\u0000\u01b8C\u0001\u0000\u0000\u0000\u01b9"+ + "\u01b7\u0001\u0000\u0000\u0000\u01ba\u01c3\u0003F#\u0000\u01bb\u01c3\u0003"+ + "z=\u0000\u01bc\u01bd\u0003\u0002\u0001\u0000\u01bd\u01be\u0005_\u0000"+ + "\u0000\u01be\u01c0\u0001\u0000\u0000\u0000\u01bf\u01bc\u0001\u0000\u0000"+ + "\u0000\u01bf\u01c0\u0001\u0000\u0000\u0000\u01c0\u01c1\u0001\u0000\u0000"+ + "\u0000\u01c1\u01c3\u0003H$\u0000\u01c2\u01ba\u0001\u0000\u0000\u0000\u01c2"+ + "\u01bb\u0001\u0000\u0000\u0000\u01c2\u01bf\u0001\u0000\u0000\u0000\u01c3"+ + "E\u0001\u0000\u0000\u0000\u01c4\u01c6\u0005\u0013\u0000\u0000\u01c5\u01c4"+ + "\u0001\u0000\u0000\u0000\u01c5\u01c6\u0001\u0000\u0000\u0000\u01c6\u01c7"+ + "\u0001\u0000\u0000\u0000\u01c7\u01c8\u0003 \u0010\u0000\u01c8\u01c9\u0003"+ + "d2\u0000\u01c9G\u0001\u0000\u0000\u0000\u01ca\u01d0\u0003L&\u0000\u01cb"+ + "\u01cc\u0005\u0018\u0000\u0000\u01cc\u01cd\u0003>\u001f\u0000\u01cd\u01ce"+ + "\u0003J%\u0000\u01ce\u01d0\u0001\u0000\u0000\u0000\u01cf\u01ca\u0001\u0000"+ + "\u0000\u0000\u01cf\u01cb\u0001\u0000\u0000\u0000\u01d0I\u0001\u0000\u0000"+ + "\u0000\u01d1\u021d\u0003@ \u0000\u01d2\u01d3\u0005\u0018\u0000\u0000\u01d3"+ + "\u01d4\u0003>\u001f\u0000\u01d4\u01d5\u0003L&\u0000\u01d5\u01d6\u0005"+ + "\u0011\u0000\u0000\u01d6\u01d7\u0003J%\u0000\u01d7\u021d\u0001\u0000\u0000"+ + "\u0000\u01d8\u01d9\u0005\u0016\u0000\u0000\u01d9\u01db\u0005;\u0000\u0000"+ + "\u01da\u01dc\u0003\\.\u0000\u01db\u01da\u0001\u0000\u0000\u0000\u01db"+ + "\u01dc\u0001\u0000\u0000\u0000\u01dc\u01dd\u0001\u0000\u0000\u0000\u01dd"+ + "\u01df\u0005A\u0000\u0000\u01de\u01e0\u0003\b\u0004\u0000\u01df\u01de"+ + "\u0001\u0000\u0000\u0000\u01df\u01e0\u0001\u0000\u0000\u0000\u01e0\u01e1"+ + "\u0001\u0000\u0000\u0000\u01e1\u01e3\u0005A\u0000\u0000\u01e2\u01e4\u0003"+ + "^/\u0000\u01e3\u01e2\u0001\u0000\u0000\u0000\u01e3\u01e4\u0001\u0000\u0000"+ + "\u0000\u01e4\u01e5\u0001\u0000\u0000\u0000\u01e5\u01e6\u0005<\u0000\u0000"+ + "\u01e6\u021d\u0003H$\u0000\u01e7\u01e8\u00053\u0000\u0000\u01e8\u01e9"+ + "\u0003>\u001f\u0000\u01e9\u01ea\u0003H$\u0000\u01ea\u021d\u0001\u0000"+ + "\u0000\u0000\u01eb\u01ec\u0005\u000f\u0000\u0000\u01ec\u01ed\u0003H$\u0000"+ + "\u01ed\u01ee\u00053\u0000\u0000\u01ee\u01ef\u0003>\u001f\u0000\u01ef\u01f0"+ + "\u0005A\u0000\u0000\u01f0\u021d\u0001\u0000\u0000\u0000\u01f1\u01f2\u0005"+ + "0\u0000\u0000\u01f2\u01f3\u0003@ \u0000\u01f3\u01f4\u0003N\'\u0000\u01f4"+ + "\u021d\u0001\u0000\u0000\u0000\u01f5\u01f6\u00050\u0000\u0000\u01f6\u01f7"+ + "\u0003@ \u0000\u01f7\u01f8\u0005\u0014\u0000\u0000\u01f8\u01f9\u0003@"+ + " \u0000\u01f9\u021d\u0001\u0000\u0000\u0000\u01fa\u01fb\u00050\u0000\u0000"+ + "\u01fb\u01fc\u0003@ \u0000\u01fc\u01fd\u0003N\'\u0000\u01fd\u01fe\u0005"+ + "\u0014\u0000\u0000\u01fe\u01ff\u0003@ \u0000\u01ff\u021d\u0001\u0000\u0000"+ + "\u0000\u0200\u021d\u0003R)\u0000\u0201\u0202\u0005+\u0000\u0000\u0202"+ + "\u0203\u0003>\u001f\u0000\u0203\u0204\u0003@ \u0000\u0204\u021d\u0001"+ + "\u0000\u0000\u0000\u0205\u0207\u0005%\u0000\u0000\u0206\u0208\u0003\b"+ + "\u0004\u0000\u0207\u0206\u0001\u0000\u0000\u0000\u0207\u0208\u0001\u0000"+ + "\u0000\u0000\u0208\u0209\u0001\u0000\u0000\u0000\u0209\u021d\u0005A\u0000"+ + "\u0000\u020a\u020b\u0005-\u0000\u0000\u020b\u020c\u0003\b\u0004\u0000"+ + "\u020c\u020d\u0005A\u0000\u0000\u020d\u021d\u0001\u0000\u0000\u0000\u020e"+ + "\u0210\u0005\u0006\u0000\u0000\u020f\u0211\u0003\u0002\u0001\u0000\u0210"+ + "\u020f\u0001\u0000\u0000\u0000\u0210\u0211\u0001\u0000\u0000\u0000\u0211"+ + "\u0212\u0001\u0000\u0000\u0000\u0212\u021d\u0005A\u0000\u0000\u0213\u0215"+ + "\u0005\r\u0000\u0000\u0214\u0216\u0003\u0002\u0001\u0000\u0215\u0214\u0001"+ + "\u0000\u0000\u0000\u0215\u0216\u0001\u0000\u0000\u0000\u0216\u0217\u0001"+ + "\u0000\u0000\u0000\u0217\u021d\u0005A\u0000\u0000\u0218\u0219\u0003\""+ + "\u0011\u0000\u0219\u021a\u0005A\u0000\u0000\u021a\u021d\u0001\u0000\u0000"+ + "\u0000\u021b\u021d\u0005A\u0000\u0000\u021c\u01d1\u0001\u0000\u0000\u0000"+ + "\u021c\u01d2\u0001\u0000\u0000\u0000\u021c\u01d8\u0001\u0000\u0000\u0000"+ + "\u021c\u01e7\u0001\u0000\u0000\u0000\u021c\u01eb\u0001\u0000\u0000\u0000"+ + "\u021c\u01f1\u0001\u0000\u0000\u0000\u021c\u01f5\u0001\u0000\u0000\u0000"+ + "\u021c\u01fa\u0001\u0000\u0000\u0000\u021c\u0200\u0001\u0000\u0000\u0000"+ + "\u021c\u0201\u0001\u0000\u0000\u0000\u021c\u0205\u0001\u0000\u0000\u0000"+ + "\u021c\u020a\u0001\u0000\u0000\u0000\u021c\u020e\u0001\u0000\u0000\u0000"+ + "\u021c\u0213\u0001\u0000\u0000\u0000\u021c\u0218\u0001\u0000\u0000\u0000"+ + "\u021c\u021b\u0001\u0000\u0000\u0000\u021dK\u0001\u0000\u0000\u0000\u021e"+ + "\u021f\u0005\u0018\u0000\u0000\u021f\u0220\u0003>\u001f\u0000\u0220\u0221"+ + "\u0003L&\u0000\u0221\u0222\u0005\u0011\u0000\u0000\u0222\u0223\u0003L"+ + "&\u0000\u0223\u0226\u0001\u0000\u0000\u0000\u0224\u0226\u0003J%\u0000"+ + "\u0225\u021e\u0001\u0000\u0000\u0000\u0225\u0224\u0001\u0000\u0000\u0000"+ + "\u0226M\u0001\u0000\u0000\u0000\u0227\u022b\u0003P(\u0000\u0228\u022a"+ + "\u0003P(\u0000\u0229\u0228\u0001\u0000\u0000\u0000\u022a\u022d\u0001\u0000"+ + "\u0000\u0000\u022b\u0229\u0001\u0000\u0000\u0000\u022b\u022c\u0001\u0000"+ + "\u0000\u0000\u022cO\u0001\u0000\u0000\u0000\u022d\u022b\u0001\u0000\u0000"+ + "\u0000\u022e\u022f\u0005\t\u0000\u0000\u022f\u0230\u0005;\u0000\u0000"+ + "\u0230\u0231\u0003\u00a4R\u0000\u0231\u0232\u0005<\u0000\u0000\u0232\u0233"+ + "\u0003@ \u0000\u0233Q\u0001\u0000\u0000\u0000\u0234\u0235\u0005*\u0000"+ + "\u0000\u0235\u0236\u0003>\u001f\u0000\u0236\u0237\u0005=\u0000\u0000\u0237"+ + "\u0238\u0005>\u0000\u0000\u0238\u0242\u0001\u0000\u0000\u0000\u0239\u023a"+ + "\u0005*\u0000\u0000\u023a\u023b\u0003>\u001f\u0000\u023b\u023d\u0005="+ + "\u0000\u0000\u023c\u023e\u0003T*\u0000\u023d\u023c\u0001\u0000\u0000\u0000"+ + "\u023d\u023e\u0001\u0000\u0000\u0000\u023e\u023f\u0001\u0000\u0000\u0000"+ + "\u023f\u0240\u0005>\u0000\u0000\u0240\u0242\u0001\u0000\u0000\u0000\u0241"+ + "\u0234\u0001\u0000\u0000\u0000\u0241\u0239\u0001\u0000\u0000\u0000\u0242"+ + "S\u0001\u0000\u0000\u0000\u0243\u0245\u0003V+\u0000\u0244\u0243\u0001"+ + "\u0000\u0000\u0000\u0245\u0248\u0001\u0000\u0000\u0000\u0246\u0244\u0001"+ + "\u0000\u0000\u0000\u0246\u0247\u0001\u0000\u0000\u0000\u0247U\u0001\u0000"+ + "\u0000\u0000\u0248\u0246\u0001\u0000\u0000\u0000\u0249\u024a\u0003X,\u0000"+ + "\u024a\u024b\u0003B!\u0000\u024bW\u0001\u0000\u0000\u0000\u024c\u024d"+ + "\u0005\b\u0000\u0000\u024d\u024e\u0003$\u0012\u0000\u024e\u024f\u0005"+ + "_\u0000\u0000\u024f\u0253\u0001\u0000\u0000\u0000\u0250\u0251\u0005\u000e"+ + "\u0000\u0000\u0251\u0253\u0005_\u0000\u0000\u0252\u024c\u0001\u0000\u0000"+ + "\u0000\u0252\u0250\u0001\u0000\u0000\u0000\u0253Y\u0001\u0000\u0000\u0000"+ + "\u0254\u0255\u0005B\u0000\u0000\u0255\u0257\u0003\"\u0011\u0000\u0256"+ + "\u0254\u0001\u0000\u0000\u0000\u0257\u025a\u0001\u0000\u0000\u0000\u0258"+ + "\u0256\u0001\u0000\u0000\u0000\u0258\u0259\u0001\u0000\u0000\u0000\u0259"+ + "[\u0001\u0000\u0000\u0000\u025a\u0258\u0001\u0000\u0000\u0000\u025b\u025c"+ + "\u0003\"\u0011\u0000\u025c\u025d\u0003Z-\u0000\u025d\u0265\u0001\u0000"+ + "\u0000\u0000\u025e\u0260\u0005\u0013\u0000\u0000\u025f\u025e\u0001\u0000"+ + "\u0000\u0000\u025f\u0260\u0001\u0000\u0000\u0000\u0260\u0261\u0001\u0000"+ + "\u0000\u0000\u0261\u0262\u0003 \u0010\u0000\u0262\u0263\u0003d2\u0000"+ + "\u0263\u0265\u0001\u0000\u0000\u0000\u0264\u025b\u0001\u0000\u0000\u0000"+ + "\u0264\u025f\u0001\u0000\u0000\u0000\u0265]\u0001\u0000\u0000\u0000\u0266"+ + "\u0267\u0003\"\u0011\u0000\u0267\u0268\u0003Z-\u0000\u0268_\u0001\u0000"+ + "\u0000\u0000\u0269\u026b\u0003b1\u0000\u026a\u0269\u0001\u0000\u0000\u0000"+ + "\u026b\u026e\u0001\u0000\u0000\u0000\u026c\u026a\u0001\u0000\u0000\u0000"+ + "\u026c\u026d\u0001\u0000\u0000\u0000\u026da\u0001\u0000\u0000\u0000\u026e"+ + "\u026c\u0001\u0000\u0000\u0000\u026f\u0270\u0007\t\u0000\u0000\u0270c"+ + "\u0001\u0000\u0000\u0000\u0271\u0276\u0003j5\u0000\u0272\u0273\u0005B"+ + "\u0000\u0000\u0273\u0275\u0003j5\u0000\u0274\u0272\u0001\u0000\u0000\u0000"+ + "\u0275\u0278\u0001\u0000\u0000\u0000\u0276\u0274\u0001\u0000\u0000\u0000"+ + "\u0276\u0277\u0001\u0000\u0000\u0000\u0277e\u0001\u0000\u0000\u0000\u0278"+ + "\u0276\u0001\u0000\u0000\u0000\u0279\u027e\u0003n7\u0000\u027a\u027b\u0005"+ + "B\u0000\u0000\u027b\u027d\u0003j5\u0000\u027c\u027a\u0001\u0000\u0000"+ + "\u0000\u027d\u0280\u0001\u0000\u0000\u0000\u027e\u027c\u0001\u0000\u0000"+ + "\u0000\u027e\u027f\u0001\u0000\u0000\u0000\u027fg\u0001\u0000\u0000\u0000"+ + "\u0280\u027e\u0001\u0000\u0000\u0000\u0281\u0286\u0003p8\u0000\u0282\u0283"+ + "\u0005B\u0000\u0000\u0283\u0285\u0003l6\u0000\u0284\u0282\u0001\u0000"+ + "\u0000\u0000\u0285\u0288\u0001\u0000\u0000\u0000\u0286\u0284\u0001\u0000"+ + "\u0000\u0000\u0286\u0287\u0001\u0000\u0000\u0000\u0287i\u0001\u0000\u0000"+ + "\u0000\u0288\u0286\u0001\u0000\u0000\u0000\u0289\u028a\u0003\u0002\u0001"+ + "\u0000\u028a\u028b\u0003f3\u0000\u028bk\u0001\u0000\u0000\u0000\u028c"+ + "\u028d\u0003\u0002\u0001\u0000\u028d\u028e\u0003p8\u0000\u028em\u0001"+ + "\u0000\u0000\u0000\u028f\u0292\u00030\u0018\u0000\u0290\u0291\u0005Y\u0000"+ + "\u0000\u0291\u0293\u0003<\u001e\u0000\u0292\u0290\u0001\u0000\u0000\u0000"+ + "\u0292\u0293\u0001\u0000\u0000\u0000\u0293o\u0001\u0000\u0000\u0000\u0294"+ + "\u0295\u00030\u0018\u0000\u0295\u0296\u0005Y\u0000\u0000\u0296\u0297\u0003"+ + "<\u001e\u0000\u0297q\u0001\u0000\u0000\u0000\u0298\u0299\u0003\u0002\u0001"+ + "\u0000\u0299\u029a\u00030\u0018\u0000\u029as\u0001\u0000\u0000\u0000\u029b"+ + "\u029c\u0005!\u0000\u0000\u029c\u029d\u0003\u0004\u0002\u0000\u029d\u029e"+ + "\u0005A\u0000\u0000\u029e\u02a0\u0001\u0000\u0000\u0000\u029f\u029b\u0001"+ + "\u0000\u0000\u0000\u029f\u02a0\u0001\u0000\u0000\u0000\u02a0\u02a4\u0001"+ + "\u0000\u0000\u0000\u02a1\u02a3\u0003v;\u0000\u02a2\u02a1\u0001\u0000\u0000"+ + "\u0000\u02a3\u02a6\u0001\u0000\u0000\u0000\u02a4\u02a2\u0001\u0000\u0000"+ + "\u0000\u02a4\u02a5\u0001\u0000\u0000\u0000\u02a5\u02aa\u0001\u0000\u0000"+ + "\u0000\u02a6\u02a4\u0001\u0000\u0000\u0000\u02a7\u02a9\u0003x<\u0000\u02a8"+ + "\u02a7\u0001\u0000\u0000\u0000\u02a9\u02ac\u0001\u0000\u0000\u0000\u02aa"+ + "\u02a8\u0001\u0000\u0000\u0000\u02aa\u02ab\u0001\u0000\u0000\u0000\u02ab"+ + "u\u0001\u0000\u0000\u0000\u02ac\u02aa\u0001\u0000\u0000\u0000\u02ad\u02ae"+ + "\u0005\u001a\u0000\u0000\u02ae\u02b3\u0003\u0002\u0001\u0000\u02af\u02b0"+ + "\u00054\u0000\u0000\u02b0\u02b2\u0003\u0002\u0001\u0000\u02b1\u02af\u0001"+ + "\u0000\u0000\u0000\u02b2\u02b5\u0001\u0000\u0000\u0000\u02b3\u02b1\u0001"+ + "\u0000\u0000\u0000\u02b3\u02b4\u0001\u0000\u0000\u0000\u02b4\u02b8\u0001"+ + "\u0000\u0000\u0000\u02b5\u02b3\u0001\u0000\u0000\u0000\u02b6\u02b7\u0005"+ + "4\u0000\u0000\u02b7\u02b9\u0005b\u0000\u0000\u02b8\u02b6\u0001\u0000\u0000"+ + "\u0000\u02b8\u02b9\u0001\u0000\u0000\u0000\u02b9\u02ba\u0001\u0000\u0000"+ + "\u0000\u02ba\u02bb\u0005A\u0000\u0000\u02bbw\u0001\u0000\u0000\u0000\u02bc"+ + "\u02bf\u0003z=\u0000\u02bd\u02bf\u0005A\u0000\u0000\u02be\u02bc\u0001"+ + "\u0000\u0000\u0000\u02be\u02bd\u0001\u0000\u0000\u0000\u02bfy\u0001\u0000"+ + "\u0000\u0000\u02c0\u02c3\u0003`0\u0000\u02c1\u02c4\u0003|>\u0000\u02c2"+ + "\u02c4\u0003~?\u0000\u02c3\u02c1\u0001\u0000\u0000\u0000\u02c3\u02c2\u0001"+ + "\u0000\u0000\u0000\u02c4{\u0001\u0000\u0000\u0000\u02c5\u02c6\u0005\u000b"+ + "\u0000\u0000\u02c6\u02c9\u0003\u0002\u0001\u0000\u02c7\u02c8\u0005\u0012"+ + "\u0000\u0000\u02c8\u02ca\u0003 \u0010\u0000\u02c9\u02c7\u0001\u0000\u0000"+ + "\u0000\u02c9\u02ca\u0001\u0000\u0000\u0000\u02ca\u02cd\u0001\u0000\u0000"+ + "\u0000\u02cb\u02cc\u0005\u0019\u0000\u0000\u02cc\u02ce\u0003\u0080@\u0000"+ + "\u02cd\u02cb\u0001\u0000\u0000\u0000\u02cd\u02ce\u0001\u0000\u0000\u0000"+ + "\u02ce\u02cf\u0001\u0000\u0000\u0000\u02cf\u02d0\u0003\u0082A\u0000\u02d0"+ + "}\u0001\u0000\u0000\u0000\u02d1\u02d2\u0005\u001d\u0000\u0000\u02d2\u02d5"+ + "\u0003\u0002\u0001\u0000\u02d3\u02d4\u0005\u0012\u0000\u0000\u02d4\u02d6"+ + "\u0003\u0080@\u0000\u02d5\u02d3\u0001\u0000\u0000\u0000\u02d5\u02d6\u0001"+ + "\u0000\u0000\u0000\u02d6\u02d7\u0001\u0000\u0000\u0000\u02d7\u02d8\u0003"+ + "\u0084B\u0000\u02d8\u007f\u0001\u0000\u0000\u0000\u02d9\u02de\u0003 \u0010"+ + "\u0000\u02da\u02db\u0005B\u0000\u0000\u02db\u02dd\u0003 \u0010\u0000\u02dc"+ + "\u02da\u0001\u0000\u0000\u0000\u02dd\u02e0\u0001\u0000\u0000\u0000\u02de"+ + "\u02dc\u0001\u0000\u0000\u0000\u02de\u02df\u0001\u0000\u0000\u0000\u02df"+ + "\u0081\u0001\u0000\u0000\u0000\u02e0\u02de\u0001\u0000\u0000\u0000\u02e1"+ + "\u02e5\u0005=\u0000\u0000\u02e2\u02e4\u0003\u0086C\u0000\u02e3\u02e2\u0001"+ + "\u0000\u0000\u0000\u02e4\u02e7\u0001\u0000\u0000\u0000\u02e5\u02e3\u0001"+ + "\u0000\u0000\u0000\u02e5\u02e6\u0001\u0000\u0000\u0000\u02e6\u02e8\u0001"+ + "\u0000\u0000\u0000\u02e7\u02e5\u0001\u0000\u0000\u0000\u02e8\u02e9\u0005"+ + ">\u0000\u0000\u02e9\u0083\u0001\u0000\u0000\u0000\u02ea\u02ee\u0005=\u0000"+ + "\u0000\u02eb\u02ed\u0003\u008eG\u0000\u02ec\u02eb\u0001\u0000\u0000\u0000"+ + "\u02ed\u02f0\u0001\u0000\u0000\u0000\u02ee\u02ec\u0001\u0000\u0000\u0000"+ + "\u02ee\u02ef\u0001\u0000\u0000\u0000\u02ef\u02f1\u0001\u0000\u0000\u0000"+ + "\u02f0\u02ee\u0001\u0000\u0000\u0000\u02f1\u02f2\u0005>\u0000\u0000\u02f2"+ + "\u0085\u0001\u0000\u0000\u0000\u02f3\u02fc\u0005A\u0000\u0000\u02f4\u02f6"+ + "\u0005\'\u0000\u0000\u02f5\u02f4\u0001\u0000\u0000\u0000\u02f5\u02f6\u0001"+ + "\u0000\u0000\u0000\u02f6\u02f7\u0001\u0000\u0000\u0000\u02f7\u02fc\u0003"+ + "@ \u0000\u02f8\u02f9\u0003`0\u0000\u02f9\u02fa\u0003\u0088D\u0000\u02fa"+ + "\u02fc\u0001\u0000\u0000\u0000\u02fb\u02f3\u0001\u0000\u0000\u0000\u02fb"+ + "\u02f5\u0001\u0000\u0000\u0000\u02fb\u02f8\u0001\u0000\u0000\u0000\u02fc"+ + "\u0087\u0001\u0000\u0000\u0000\u02fd\u0307\u0003\u008aE\u0000\u02fe\u02ff"+ + "\u00051\u0000\u0000\u02ff\u0300\u0003\u0002\u0001\u0000\u0300\u0301\u0003"+ + "\u0096K\u0000\u0301\u0307\u0001\u0000\u0000\u0000\u0302\u0303\u0003\u0002"+ + "\u0001\u0000\u0303\u0304\u0003\u009eO\u0000\u0304\u0307\u0001\u0000\u0000"+ + "\u0000\u0305\u0307\u0003z=\u0000\u0306\u02fd\u0001\u0000\u0000\u0000\u0306"+ + "\u02fe\u0001\u0000\u0000\u0000\u0306\u0302\u0001\u0000\u0000\u0000\u0306"+ + "\u0305\u0001\u0000\u0000\u0000\u0307\u0089\u0001\u0000\u0000\u0000\u0308"+ + "\u0309\u0003 \u0010\u0000\u0309\u030a\u0003\u0002\u0001\u0000\u030a\u030b"+ + "\u0003\u008cF\u0000\u030b\u008b\u0001\u0000\u0000\u0000\u030c\u030f\u0003"+ + "n7\u0000\u030d\u030f\u0003\u0096K\u0000\u030e\u030c\u0001\u0000\u0000"+ + "\u0000\u030e\u030d\u0001\u0000\u0000\u0000\u030f\u008d\u0001\u0000\u0000"+ + "\u0000\u0310\u0315\u0005A\u0000\u0000\u0311\u0312\u0003`0\u0000\u0312"+ + "\u0313\u0003\u0090H\u0000\u0313\u0315\u0001\u0000\u0000\u0000\u0314\u0310"+ + "\u0001\u0000\u0000\u0000\u0314\u0311\u0001\u0000\u0000\u0000\u0315\u008f"+ + "\u0001\u0000\u0000\u0000\u0316\u031d\u0003\u0092I\u0000\u0317\u0318\u0005"+ + "1\u0000\u0000\u0318\u0319\u0003\u0002\u0001\u0000\u0319\u031a\u0003\u009c"+ + "N\u0000\u031a\u031d\u0001\u0000\u0000\u0000\u031b\u031d\u0003z=\u0000"+ + "\u031c\u0316\u0001\u0000\u0000\u0000\u031c\u0317\u0001\u0000\u0000\u0000"+ + "\u031c\u031b\u0001\u0000\u0000\u0000\u031d\u0091\u0001\u0000\u0000\u0000"+ + "\u031e\u031f\u0003 \u0010\u0000\u031f\u0320\u0003\u0002\u0001\u0000\u0320"+ + "\u0321\u0003\u0094J\u0000\u0321\u0093\u0001\u0000\u0000\u0000\u0322\u0323"+ + "\u0003p8\u0000\u0323\u0324\u0005A\u0000\u0000\u0324\u0327\u0001\u0000"+ + "\u0000\u0000\u0325\u0327\u0003\u009aM\u0000\u0326\u0322\u0001\u0000\u0000"+ + "\u0000\u0326\u0325\u0001\u0000\u0000\u0000\u0327\u0095\u0001\u0000\u0000"+ + "\u0000\u0328\u0329\u0003\u00a2Q\u0000\u0329\u032c\u00030\u0018\u0000\u032a"+ + "\u032b\u0005.\u0000\u0000\u032b\u032d\u0003\u00a0P\u0000\u032c\u032a\u0001"+ + "\u0000\u0000\u0000\u032c\u032d\u0001\u0000\u0000\u0000\u032d\u0330\u0001"+ + "\u0000\u0000\u0000\u032e\u0331\u0003\u00a6S\u0000\u032f\u0331\u0005A\u0000"+ + "\u0000\u0330\u032e\u0001\u0000\u0000\u0000\u0330\u032f\u0001\u0000\u0000"+ + "\u0000\u0331\u0097\u0001\u0000\u0000\u0000\u0332\u0335\u0003\u00a2Q\u0000"+ + "\u0333\u0334\u0005.\u0000\u0000\u0334\u0336\u0003\u00a0P\u0000\u0335\u0333"+ + "\u0001\u0000\u0000\u0000\u0335\u0336\u0001\u0000\u0000\u0000\u0336\u0339"+ + "\u0001\u0000\u0000\u0000\u0337\u033a\u0003\u00a6S\u0000\u0338\u033a\u0005"+ + "A\u0000\u0000\u0339\u0337\u0001\u0000\u0000\u0000\u0339\u0338\u0001\u0000"+ + "\u0000\u0000\u033a\u0099\u0001\u0000\u0000\u0000\u033b\u033c\u0003\u00a2"+ + "Q\u0000\u033c\u033f\u00030\u0018\u0000\u033d\u033e\u0005.\u0000\u0000"+ + "\u033e\u0340\u0003\u00a0P\u0000\u033f\u033d\u0001\u0000\u0000\u0000\u033f"+ + "\u0340\u0001\u0000\u0000\u0000\u0340\u0341\u0001\u0000\u0000\u0000\u0341"+ + "\u0342\u0005A\u0000\u0000\u0342\u009b\u0001\u0000\u0000\u0000\u0343\u0346"+ + "\u0003\u00a2Q\u0000\u0344\u0345\u0005.\u0000\u0000\u0345\u0347\u0003\u00a0"+ + "P\u0000\u0346\u0344\u0001\u0000\u0000\u0000\u0346\u0347\u0001\u0000\u0000"+ + "\u0000\u0347\u009d\u0001\u0000\u0000\u0000\u0348\u034b\u0003\u00a2Q\u0000"+ + "\u0349\u034a\u0005.\u0000\u0000\u034a\u034c\u0003\u00a0P\u0000\u034b\u0349"+ + "\u0001\u0000\u0000\u0000\u034b\u034c\u0001\u0000\u0000\u0000\u034c\u034d"+ + "\u0001\u0000\u0000\u0000\u034d\u034e\u0003\u00a6S\u0000\u034e\u009f\u0001"+ + "\u0000\u0000\u0000\u034f\u0354\u0003\u0004\u0002\u0000\u0350\u0351\u0005"+ + "B\u0000\u0000\u0351\u0353\u0003\u0004\u0002\u0000\u0352\u0350\u0001\u0000"+ + "\u0000\u0000\u0353\u0356\u0001\u0000\u0000\u0000\u0354\u0352\u0001\u0000"+ + "\u0000\u0000\u0354\u0355\u0001\u0000\u0000\u0000\u0355\u00a1\u0001\u0000"+ + "\u0000\u0000\u0356\u0354\u0001\u0000\u0000\u0000\u0357\u0360\u0005;\u0000"+ + "\u0000\u0358\u035d\u0003\u00a4R\u0000\u0359\u035a\u0005B\u0000\u0000\u035a"+ + "\u035c\u0003\u00a4R\u0000\u035b\u0359\u0001\u0000\u0000\u0000\u035c\u035f"+ + "\u0001\u0000\u0000\u0000\u035d\u035b\u0001\u0000\u0000\u0000\u035d\u035e"+ + "\u0001\u0000\u0000\u0000\u035e\u0361\u0001\u0000\u0000\u0000\u035f\u035d"+ + "\u0001\u0000\u0000\u0000\u0360\u0358\u0001\u0000\u0000\u0000\u0360\u0361"+ + "\u0001\u0000\u0000\u0000\u0361\u0362\u0001\u0000\u0000\u0000\u0362\u0363"+ + "\u0005<\u0000\u0000\u0363\u00a3\u0001\u0000\u0000\u0000\u0364\u0366\u0005"+ + "\u0013\u0000\u0000\u0365\u0364\u0001\u0000\u0000\u0000\u0365\u0366\u0001"+ + "\u0000\u0000\u0000\u0366\u0367\u0001\u0000\u0000\u0000\u0367\u0368\u0003"+ + " \u0010\u0000\u0368\u0369\u0003r9\u0000\u0369\u00a5\u0001\u0000\u0000"+ + "\u0000\u036a\u036b\u0003@ \u0000\u036b\u00a7\u0001\u0000\u0000\u0000Y"+ + "\u00b2\u00bc\u00c5\u00cc\u00d4\u00dc\u00e4\u00e6\u00ee\u00f6\u0100\u010c"+ + "\u010e\u011d\u0128\u0132\u013b\u0141\u015a\u015c\u0163\u016b\u016e\u0176"+ + "\u017c\u018f\u0192\u0196\u019e\u01a2\u01a4\u01aa\u01b7\u01bf\u01c2\u01c5"+ + "\u01cf\u01db\u01df\u01e3\u0207\u0210\u0215\u021c\u0225\u022b\u023d\u0241"+ + "\u0246\u0252\u0258\u025f\u0264\u026c\u0276\u027e\u0286\u0292\u029f\u02a4"+ + "\u02aa\u02b3\u02b8\u02be\u02c3\u02c9\u02cd\u02d5\u02de\u02e5\u02ee\u02f5"+ + "\u02fb\u0306\u030e\u0314\u031c\u0326\u032c\u0330\u0335\u0339\u033f\u0346"+ + "\u034b\u0354\u035d\u0360\u0365"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/Assignment-1/ExprParser.tokens b/Assignment-1/ExprParser.tokens new file mode 100644 index 0000000..3a6fe78 --- /dev/null +++ b/Assignment-1/ExprParser.tokens @@ -0,0 +1,200 @@ +WhiteSpace=1 +Comment=2 +Abstract=3 +Assert=4 +Boolean=5 +Break=6 +Byte=7 +Case=8 +Catch=9 +Char=10 +Class=11 +Const=12 +Continue=13 +Default=14 +Do=15 +Double=16 +Else=17 +Extends=18 +Final=19 +Finally=20 +Float=21 +For=22 +Goto=23 +If=24 +Implements=25 +Import=26 +InstanceOf=27 +Int=28 +Interface=29 +Long=30 +Native=31 +New=32 +Package=33 +Private=34 +Protected=35 +Public=36 +Return=37 +Short=38 +Static=39 +Strictfp=40 +Super=41 +Switch=42 +Synchronized=43 +This=44 +Throw=45 +Throws=46 +Transient=47 +Try=48 +Void=49 +Volatile=50 +While=51 +Dot=52 +IntegerLiteral=53 +FloatingPointLiteral=54 +CharacterLiteral=55 +StringLiteral=56 +BooleanLiteral=57 +NullLiteral=58 +ParenthesesLeft=59 +ParenthesesRight=60 +CurlyBracketLeft=61 +CurlyBracketRight=62 +SquareBracketLeft=63 +SquareBracketRight=64 +Semicolon=65 +Comma=66 +UnsignedRightShiftAssign=67 +EqualTo=68 +NotEqualTo=69 +LessThanEqualTo=70 +GreaterThanEqualTo=71 +ConditionalAND=72 +ConditionalOR=73 +Increment=74 +Decrement=75 +LeftShift=76 +SignedRightShift=77 +UnsignedRightShift=78 +AddAssign=79 +SubtractAssign=80 +MultiplyAssign=81 +DivideAssign=82 +BitwiseANDAssign=83 +BitwiseORAssign=84 +BitwiseXORAssign=85 +RemainderAssign=86 +LeftShiftAssign=87 +SignedRightShiftAssign=88 +Assignment=89 +BitwiseComplement=90 +LessThan=91 +GreaterThan=92 +LogicalComplement=93 +Question=94 +Colon=95 +Addition=96 +Subtraction=97 +Multiplication=98 +Division=99 +BitwiseAND=100 +BitwiseOR=101 +BitwiseXOR=102 +Remainder=103 +IDENTIFIER=104 +'abstract'=3 +'assert'=4 +'boolean'=5 +'break'=6 +'byte'=7 +'case'=8 +'catch'=9 +'char'=10 +'class'=11 +'const'=12 +'continue'=13 +'default'=14 +'do'=15 +'double'=16 +'else'=17 +'extends'=18 +'final'=19 +'finally'=20 +'float'=21 +'for'=22 +'goto'=23 +'if'=24 +'implements'=25 +'import'=26 +'instanceof'=27 +'int'=28 +'interface'=29 +'long'=30 +'native'=31 +'new'=32 +'package'=33 +'private'=34 +'protected'=35 +'public'=36 +'return'=37 +'short'=38 +'static'=39 +'strictfp'=40 +'super'=41 +'switch'=42 +'synchronized'=43 +'this'=44 +'throw'=45 +'throws'=46 +'transient'=47 +'try'=48 +'void'=49 +'volatile'=50 +'while'=51 +'.'=52 +'null'=58 +'('=59 +')'=60 +'{'=61 +'}'=62 +'['=63 +']'=64 +';'=65 +','=66 +'>>>='=67 +'=='=68 +'!='=69 +'<='=70 +'>='=71 +'&&'=72 +'||'=73 +'++'=74 +'--'=75 +'<<'=76 +'>>'=77 +'>>>'=78 +'+='=79 +'-='=80 +'*='=81 +'/='=82 +'&='=83 +'|='=84 +'^='=85 +'%='=86 +'<<='=87 +'>>='=88 +'='=89 +'~'=90 +'<'=91 +'>'=92 +'!'=93 +'?'=94 +':'=95 +'+'=96 +'-'=97 +'*'=98 +'/'=99 +'&'=100 +'|'=101 +'^'=102 +'%'=103 diff --git a/Assignment-1/ExprParserBaseListener.java b/Assignment-1/ExprParserBaseListener.java new file mode 100644 index 0000000..6851724 --- /dev/null +++ b/Assignment-1/ExprParserBaseListener.java @@ -0,0 +1,1047 @@ +// Generated from ExprParser.g4 by ANTLR 4.13.2 + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link ExprParserListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +@SuppressWarnings("CheckReturnValue") +public class ExprParserBaseListener implements ExprParserListener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterProg(ExprParser.ProgContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitProg(ExprParser.ProgContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIdentifier(ExprParser.IdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIdentifier(ExprParser.IdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterQualifiedIdentifier(ExprParser.QualifiedIdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitQualifiedIdentifier(ExprParser.QualifiedIdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLiteral(ExprParser.LiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLiteral(ExprParser.LiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExpression(ExprParser.ExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExpression(ExprParser.ExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConditionalExpr(ExprParser.ConditionalExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConditionalExpr(ExprParser.ConditionalExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLogicalOrExpr(ExprParser.LogicalOrExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLogicalOrExpr(ExprParser.LogicalOrExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLogicalAndExpr(ExprParser.LogicalAndExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLogicalAndExpr(ExprParser.LogicalAndExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEqualityExpr(ExprParser.EqualityExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEqualityExpr(ExprParser.EqualityExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRelationalExpr(ExprParser.RelationalExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRelationalExpr(ExprParser.RelationalExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAdditiveExpr(ExprParser.AdditiveExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAdditiveExpr(ExprParser.AdditiveExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMultiplicativeExpr(ExprParser.MultiplicativeExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMultiplicativeExpr(ExprParser.MultiplicativeExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterUnaryExpr(ExprParser.UnaryExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitUnaryExpr(ExprParser.UnaryExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPostfixExpr(ExprParser.PostfixExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPostfixExpr(ExprParser.PostfixExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryExpr(ExprParser.PrimaryExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryExpr(ExprParser.PrimaryExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAssignmentOperator(ExprParser.AssignmentOperatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAssignmentOperator(ExprParser.AssignmentOperatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterType(ExprParser.TypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitType(ExprParser.TypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterStatementExpression(ExprParser.StatementExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitStatementExpression(ExprParser.StatementExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstantExpression(ExprParser.ConstantExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstantExpression(ExprParser.ConstantExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIdentifierSuffix(ExprParser.IdentifierSuffixContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIdentifierSuffix(ExprParser.IdentifierSuffixContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPostfixOp(ExprParser.PostfixOpContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPostfixOp(ExprParser.PostfixOpContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimitiveType(ExprParser.PrimitiveTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimitiveType(ExprParser.PrimitiveTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArgumentsOpt(ExprParser.ArgumentsOptContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArgumentsOpt(ExprParser.ArgumentsOptContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArguments(ExprParser.ArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArguments(ExprParser.ArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBracketsOpt(ExprParser.BracketsOptContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBracketsOpt(ExprParser.BracketsOptContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCreator(ExprParser.CreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCreator(ExprParser.CreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInnerCreator(ExprParser.InnerCreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInnerCreator(ExprParser.InnerCreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArrayCreatorRest(ExprParser.ArrayCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArrayCreatorRest(ExprParser.ArrayCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassCreatorRest(ExprParser.ClassCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassCreatorRest(ExprParser.ClassCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArrayInitializer(ExprParser.ArrayInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArrayInitializer(ExprParser.ArrayInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableInitializer(ExprParser.VariableInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableInitializer(ExprParser.VariableInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterParExpression(ExprParser.ParExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitParExpression(ExprParser.ParExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBlock(ExprParser.BlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBlock(ExprParser.BlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBlockStatements(ExprParser.BlockStatementsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBlockStatements(ExprParser.BlockStatementsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBlockStatement(ExprParser.BlockStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBlockStatement(ExprParser.BlockStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLocalVariableDeclarationStatement(ExprParser.LocalVariableDeclarationStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLocalVariableDeclarationStatement(ExprParser.LocalVariableDeclarationStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterStatement(ExprParser.StatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitStatement(ExprParser.StatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterStatementIncompleteIf(ExprParser.StatementIncompleteIfContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitStatementIncompleteIf(ExprParser.StatementIncompleteIfContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCompleteIf(ExprParser.CompleteIfContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCompleteIf(ExprParser.CompleteIfContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCatches(ExprParser.CatchesContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCatches(ExprParser.CatchesContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCatchClause(ExprParser.CatchClauseContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCatchClause(ExprParser.CatchClauseContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchStatement(ExprParser.SwitchStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchStatement(ExprParser.SwitchStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchBlockStatementGroups(ExprParser.SwitchBlockStatementGroupsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchBlockStatementGroups(ExprParser.SwitchBlockStatementGroupsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchBlockStatementGroup(ExprParser.SwitchBlockStatementGroupContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchBlockStatementGroup(ExprParser.SwitchBlockStatementGroupContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchLabel(ExprParser.SwitchLabelContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchLabel(ExprParser.SwitchLabelContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMoreStatementExpressions(ExprParser.MoreStatementExpressionsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMoreStatementExpressions(ExprParser.MoreStatementExpressionsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterForInit(ExprParser.ForInitContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitForInit(ExprParser.ForInitContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterForUpdate(ExprParser.ForUpdateContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitForUpdate(ExprParser.ForUpdateContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModifiersOpt(ExprParser.ModifiersOptContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModifiersOpt(ExprParser.ModifiersOptContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModifier(ExprParser.ModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModifier(ExprParser.ModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclarators(ExprParser.VariableDeclaratorsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclarators(ExprParser.VariableDeclaratorsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclaratorsRest(ExprParser.VariableDeclaratorsRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclaratorsRest(ExprParser.VariableDeclaratorsRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstantDeclaratorsRest(ExprParser.ConstantDeclaratorsRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstantDeclaratorsRest(ExprParser.ConstantDeclaratorsRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclarator(ExprParser.VariableDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclarator(ExprParser.VariableDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstantDeclarator(ExprParser.ConstantDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstantDeclarator(ExprParser.ConstantDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclaratorRest(ExprParser.VariableDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclaratorRest(ExprParser.VariableDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstantDeclaratorRest(ExprParser.ConstantDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstantDeclaratorRest(ExprParser.ConstantDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclaratorId(ExprParser.VariableDeclaratorIdContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclaratorId(ExprParser.VariableDeclaratorIdContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCompilationUnit(ExprParser.CompilationUnitContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCompilationUnit(ExprParser.CompilationUnitContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterImportDeclaration(ExprParser.ImportDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitImportDeclaration(ExprParser.ImportDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeDeclaration(ExprParser.TypeDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeDeclaration(ExprParser.TypeDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassOrInterfaceDeclaration(ExprParser.ClassOrInterfaceDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassOrInterfaceDeclaration(ExprParser.ClassOrInterfaceDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassDeclaration(ExprParser.ClassDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassDeclaration(ExprParser.ClassDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceDeclaration(ExprParser.InterfaceDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceDeclaration(ExprParser.InterfaceDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeList(ExprParser.TypeListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeList(ExprParser.TypeListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassBody(ExprParser.ClassBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassBody(ExprParser.ClassBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceBody(ExprParser.InterfaceBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceBody(ExprParser.InterfaceBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassBodyDeclaration(ExprParser.ClassBodyDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassBodyDeclaration(ExprParser.ClassBodyDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMemberDecl(ExprParser.MemberDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMemberDecl(ExprParser.MemberDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodOrFieldDecl(ExprParser.MethodOrFieldDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodOrFieldDecl(ExprParser.MethodOrFieldDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodOrFieldRest(ExprParser.MethodOrFieldRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodOrFieldRest(ExprParser.MethodOrFieldRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceBodyDeclaration(ExprParser.InterfaceBodyDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceBodyDeclaration(ExprParser.InterfaceBodyDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceMemberDecl(ExprParser.InterfaceMemberDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceMemberDecl(ExprParser.InterfaceMemberDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceMethodOrFieldDecl(ExprParser.InterfaceMethodOrFieldDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceMethodOrFieldDecl(ExprParser.InterfaceMethodOrFieldDeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceMethodOrFieldRest(ExprParser.InterfaceMethodOrFieldRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceMethodOrFieldRest(ExprParser.InterfaceMethodOrFieldRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodDeclaratorRest(ExprParser.MethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodDeclaratorRest(ExprParser.MethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVoidMethodDeclaratorRest(ExprParser.VoidMethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVoidMethodDeclaratorRest(ExprParser.VoidMethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceMethodDeclaratorRest(ExprParser.InterfaceMethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceMethodDeclaratorRest(ExprParser.InterfaceMethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVoidInterfaceMethodDeclaratorRest(ExprParser.VoidInterfaceMethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVoidInterfaceMethodDeclaratorRest(ExprParser.VoidInterfaceMethodDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstructorDeclaratorRest(ExprParser.ConstructorDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstructorDeclaratorRest(ExprParser.ConstructorDeclaratorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterQualifiedIdentifierList(ExprParser.QualifiedIdentifierListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitQualifiedIdentifierList(ExprParser.QualifiedIdentifierListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFormalParameters(ExprParser.FormalParametersContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFormalParameters(ExprParser.FormalParametersContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFormalParameter(ExprParser.FormalParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFormalParameter(ExprParser.FormalParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodBody(ExprParser.MethodBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodBody(ExprParser.MethodBodyContext ctx) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitTerminal(TerminalNode node) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/Assignment-1/ExprParserListener.java b/Assignment-1/ExprParserListener.java new file mode 100644 index 0000000..dad8790 --- /dev/null +++ b/Assignment-1/ExprParserListener.java @@ -0,0 +1,849 @@ +// Generated from ExprParser.g4 by ANTLR 4.13.2 +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link ExprParser}. + */ +public interface ExprParserListener extends ParseTreeListener { + /** + * Enter a parse tree produced by {@link ExprParser#prog}. + * @param ctx the parse tree + */ + void enterProg(ExprParser.ProgContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#prog}. + * @param ctx the parse tree + */ + void exitProg(ExprParser.ProgContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#identifier}. + * @param ctx the parse tree + */ + void enterIdentifier(ExprParser.IdentifierContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#identifier}. + * @param ctx the parse tree + */ + void exitIdentifier(ExprParser.IdentifierContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#qualifiedIdentifier}. + * @param ctx the parse tree + */ + void enterQualifiedIdentifier(ExprParser.QualifiedIdentifierContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#qualifiedIdentifier}. + * @param ctx the parse tree + */ + void exitQualifiedIdentifier(ExprParser.QualifiedIdentifierContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#literal}. + * @param ctx the parse tree + */ + void enterLiteral(ExprParser.LiteralContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#literal}. + * @param ctx the parse tree + */ + void exitLiteral(ExprParser.LiteralContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#expression}. + * @param ctx the parse tree + */ + void enterExpression(ExprParser.ExpressionContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#expression}. + * @param ctx the parse tree + */ + void exitExpression(ExprParser.ExpressionContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#conditionalExpr}. + * @param ctx the parse tree + */ + void enterConditionalExpr(ExprParser.ConditionalExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#conditionalExpr}. + * @param ctx the parse tree + */ + void exitConditionalExpr(ExprParser.ConditionalExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#logicalOrExpr}. + * @param ctx the parse tree + */ + void enterLogicalOrExpr(ExprParser.LogicalOrExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#logicalOrExpr}. + * @param ctx the parse tree + */ + void exitLogicalOrExpr(ExprParser.LogicalOrExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#logicalAndExpr}. + * @param ctx the parse tree + */ + void enterLogicalAndExpr(ExprParser.LogicalAndExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#logicalAndExpr}. + * @param ctx the parse tree + */ + void exitLogicalAndExpr(ExprParser.LogicalAndExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#equalityExpr}. + * @param ctx the parse tree + */ + void enterEqualityExpr(ExprParser.EqualityExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#equalityExpr}. + * @param ctx the parse tree + */ + void exitEqualityExpr(ExprParser.EqualityExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#relationalExpr}. + * @param ctx the parse tree + */ + void enterRelationalExpr(ExprParser.RelationalExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#relationalExpr}. + * @param ctx the parse tree + */ + void exitRelationalExpr(ExprParser.RelationalExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#additiveExpr}. + * @param ctx the parse tree + */ + void enterAdditiveExpr(ExprParser.AdditiveExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#additiveExpr}. + * @param ctx the parse tree + */ + void exitAdditiveExpr(ExprParser.AdditiveExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#multiplicativeExpr}. + * @param ctx the parse tree + */ + void enterMultiplicativeExpr(ExprParser.MultiplicativeExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#multiplicativeExpr}. + * @param ctx the parse tree + */ + void exitMultiplicativeExpr(ExprParser.MultiplicativeExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#unaryExpr}. + * @param ctx the parse tree + */ + void enterUnaryExpr(ExprParser.UnaryExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#unaryExpr}. + * @param ctx the parse tree + */ + void exitUnaryExpr(ExprParser.UnaryExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#postfixExpr}. + * @param ctx the parse tree + */ + void enterPostfixExpr(ExprParser.PostfixExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#postfixExpr}. + * @param ctx the parse tree + */ + void exitPostfixExpr(ExprParser.PostfixExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#primaryExpr}. + * @param ctx the parse tree + */ + void enterPrimaryExpr(ExprParser.PrimaryExprContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#primaryExpr}. + * @param ctx the parse tree + */ + void exitPrimaryExpr(ExprParser.PrimaryExprContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#assignmentOperator}. + * @param ctx the parse tree + */ + void enterAssignmentOperator(ExprParser.AssignmentOperatorContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#assignmentOperator}. + * @param ctx the parse tree + */ + void exitAssignmentOperator(ExprParser.AssignmentOperatorContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#type}. + * @param ctx the parse tree + */ + void enterType(ExprParser.TypeContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#type}. + * @param ctx the parse tree + */ + void exitType(ExprParser.TypeContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#statementExpression}. + * @param ctx the parse tree + */ + void enterStatementExpression(ExprParser.StatementExpressionContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#statementExpression}. + * @param ctx the parse tree + */ + void exitStatementExpression(ExprParser.StatementExpressionContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#constantExpression}. + * @param ctx the parse tree + */ + void enterConstantExpression(ExprParser.ConstantExpressionContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#constantExpression}. + * @param ctx the parse tree + */ + void exitConstantExpression(ExprParser.ConstantExpressionContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#identifierSuffix}. + * @param ctx the parse tree + */ + void enterIdentifierSuffix(ExprParser.IdentifierSuffixContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#identifierSuffix}. + * @param ctx the parse tree + */ + void exitIdentifierSuffix(ExprParser.IdentifierSuffixContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#postfixOp}. + * @param ctx the parse tree + */ + void enterPostfixOp(ExprParser.PostfixOpContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#postfixOp}. + * @param ctx the parse tree + */ + void exitPostfixOp(ExprParser.PostfixOpContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#primitiveType}. + * @param ctx the parse tree + */ + void enterPrimitiveType(ExprParser.PrimitiveTypeContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#primitiveType}. + * @param ctx the parse tree + */ + void exitPrimitiveType(ExprParser.PrimitiveTypeContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#argumentsOpt}. + * @param ctx the parse tree + */ + void enterArgumentsOpt(ExprParser.ArgumentsOptContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#argumentsOpt}. + * @param ctx the parse tree + */ + void exitArgumentsOpt(ExprParser.ArgumentsOptContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#arguments}. + * @param ctx the parse tree + */ + void enterArguments(ExprParser.ArgumentsContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#arguments}. + * @param ctx the parse tree + */ + void exitArguments(ExprParser.ArgumentsContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#bracketsOpt}. + * @param ctx the parse tree + */ + void enterBracketsOpt(ExprParser.BracketsOptContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#bracketsOpt}. + * @param ctx the parse tree + */ + void exitBracketsOpt(ExprParser.BracketsOptContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#creator}. + * @param ctx the parse tree + */ + void enterCreator(ExprParser.CreatorContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#creator}. + * @param ctx the parse tree + */ + void exitCreator(ExprParser.CreatorContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#innerCreator}. + * @param ctx the parse tree + */ + void enterInnerCreator(ExprParser.InnerCreatorContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#innerCreator}. + * @param ctx the parse tree + */ + void exitInnerCreator(ExprParser.InnerCreatorContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#arrayCreatorRest}. + * @param ctx the parse tree + */ + void enterArrayCreatorRest(ExprParser.ArrayCreatorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#arrayCreatorRest}. + * @param ctx the parse tree + */ + void exitArrayCreatorRest(ExprParser.ArrayCreatorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#classCreatorRest}. + * @param ctx the parse tree + */ + void enterClassCreatorRest(ExprParser.ClassCreatorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#classCreatorRest}. + * @param ctx the parse tree + */ + void exitClassCreatorRest(ExprParser.ClassCreatorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#arrayInitializer}. + * @param ctx the parse tree + */ + void enterArrayInitializer(ExprParser.ArrayInitializerContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#arrayInitializer}. + * @param ctx the parse tree + */ + void exitArrayInitializer(ExprParser.ArrayInitializerContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#variableInitializer}. + * @param ctx the parse tree + */ + void enterVariableInitializer(ExprParser.VariableInitializerContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#variableInitializer}. + * @param ctx the parse tree + */ + void exitVariableInitializer(ExprParser.VariableInitializerContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#parExpression}. + * @param ctx the parse tree + */ + void enterParExpression(ExprParser.ParExpressionContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#parExpression}. + * @param ctx the parse tree + */ + void exitParExpression(ExprParser.ParExpressionContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#block}. + * @param ctx the parse tree + */ + void enterBlock(ExprParser.BlockContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#block}. + * @param ctx the parse tree + */ + void exitBlock(ExprParser.BlockContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#blockStatements}. + * @param ctx the parse tree + */ + void enterBlockStatements(ExprParser.BlockStatementsContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#blockStatements}. + * @param ctx the parse tree + */ + void exitBlockStatements(ExprParser.BlockStatementsContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#blockStatement}. + * @param ctx the parse tree + */ + void enterBlockStatement(ExprParser.BlockStatementContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#blockStatement}. + * @param ctx the parse tree + */ + void exitBlockStatement(ExprParser.BlockStatementContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#localVariableDeclarationStatement}. + * @param ctx the parse tree + */ + void enterLocalVariableDeclarationStatement(ExprParser.LocalVariableDeclarationStatementContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#localVariableDeclarationStatement}. + * @param ctx the parse tree + */ + void exitLocalVariableDeclarationStatement(ExprParser.LocalVariableDeclarationStatementContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#statement}. + * @param ctx the parse tree + */ + void enterStatement(ExprParser.StatementContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#statement}. + * @param ctx the parse tree + */ + void exitStatement(ExprParser.StatementContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#statementIncompleteIf}. + * @param ctx the parse tree + */ + void enterStatementIncompleteIf(ExprParser.StatementIncompleteIfContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#statementIncompleteIf}. + * @param ctx the parse tree + */ + void exitStatementIncompleteIf(ExprParser.StatementIncompleteIfContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#completeIf}. + * @param ctx the parse tree + */ + void enterCompleteIf(ExprParser.CompleteIfContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#completeIf}. + * @param ctx the parse tree + */ + void exitCompleteIf(ExprParser.CompleteIfContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#catches}. + * @param ctx the parse tree + */ + void enterCatches(ExprParser.CatchesContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#catches}. + * @param ctx the parse tree + */ + void exitCatches(ExprParser.CatchesContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#catchClause}. + * @param ctx the parse tree + */ + void enterCatchClause(ExprParser.CatchClauseContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#catchClause}. + * @param ctx the parse tree + */ + void exitCatchClause(ExprParser.CatchClauseContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#switchStatement}. + * @param ctx the parse tree + */ + void enterSwitchStatement(ExprParser.SwitchStatementContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#switchStatement}. + * @param ctx the parse tree + */ + void exitSwitchStatement(ExprParser.SwitchStatementContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#switchBlockStatementGroups}. + * @param ctx the parse tree + */ + void enterSwitchBlockStatementGroups(ExprParser.SwitchBlockStatementGroupsContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#switchBlockStatementGroups}. + * @param ctx the parse tree + */ + void exitSwitchBlockStatementGroups(ExprParser.SwitchBlockStatementGroupsContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#switchBlockStatementGroup}. + * @param ctx the parse tree + */ + void enterSwitchBlockStatementGroup(ExprParser.SwitchBlockStatementGroupContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#switchBlockStatementGroup}. + * @param ctx the parse tree + */ + void exitSwitchBlockStatementGroup(ExprParser.SwitchBlockStatementGroupContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#switchLabel}. + * @param ctx the parse tree + */ + void enterSwitchLabel(ExprParser.SwitchLabelContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#switchLabel}. + * @param ctx the parse tree + */ + void exitSwitchLabel(ExprParser.SwitchLabelContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#moreStatementExpressions}. + * @param ctx the parse tree + */ + void enterMoreStatementExpressions(ExprParser.MoreStatementExpressionsContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#moreStatementExpressions}. + * @param ctx the parse tree + */ + void exitMoreStatementExpressions(ExprParser.MoreStatementExpressionsContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#forInit}. + * @param ctx the parse tree + */ + void enterForInit(ExprParser.ForInitContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#forInit}. + * @param ctx the parse tree + */ + void exitForInit(ExprParser.ForInitContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#forUpdate}. + * @param ctx the parse tree + */ + void enterForUpdate(ExprParser.ForUpdateContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#forUpdate}. + * @param ctx the parse tree + */ + void exitForUpdate(ExprParser.ForUpdateContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#modifiersOpt}. + * @param ctx the parse tree + */ + void enterModifiersOpt(ExprParser.ModifiersOptContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#modifiersOpt}. + * @param ctx the parse tree + */ + void exitModifiersOpt(ExprParser.ModifiersOptContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#modifier}. + * @param ctx the parse tree + */ + void enterModifier(ExprParser.ModifierContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#modifier}. + * @param ctx the parse tree + */ + void exitModifier(ExprParser.ModifierContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#variableDeclarators}. + * @param ctx the parse tree + */ + void enterVariableDeclarators(ExprParser.VariableDeclaratorsContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#variableDeclarators}. + * @param ctx the parse tree + */ + void exitVariableDeclarators(ExprParser.VariableDeclaratorsContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#variableDeclaratorsRest}. + * @param ctx the parse tree + */ + void enterVariableDeclaratorsRest(ExprParser.VariableDeclaratorsRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#variableDeclaratorsRest}. + * @param ctx the parse tree + */ + void exitVariableDeclaratorsRest(ExprParser.VariableDeclaratorsRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#constantDeclaratorsRest}. + * @param ctx the parse tree + */ + void enterConstantDeclaratorsRest(ExprParser.ConstantDeclaratorsRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#constantDeclaratorsRest}. + * @param ctx the parse tree + */ + void exitConstantDeclaratorsRest(ExprParser.ConstantDeclaratorsRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#variableDeclarator}. + * @param ctx the parse tree + */ + void enterVariableDeclarator(ExprParser.VariableDeclaratorContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#variableDeclarator}. + * @param ctx the parse tree + */ + void exitVariableDeclarator(ExprParser.VariableDeclaratorContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#constantDeclarator}. + * @param ctx the parse tree + */ + void enterConstantDeclarator(ExprParser.ConstantDeclaratorContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#constantDeclarator}. + * @param ctx the parse tree + */ + void exitConstantDeclarator(ExprParser.ConstantDeclaratorContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#variableDeclaratorRest}. + * @param ctx the parse tree + */ + void enterVariableDeclaratorRest(ExprParser.VariableDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#variableDeclaratorRest}. + * @param ctx the parse tree + */ + void exitVariableDeclaratorRest(ExprParser.VariableDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#constantDeclaratorRest}. + * @param ctx the parse tree + */ + void enterConstantDeclaratorRest(ExprParser.ConstantDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#constantDeclaratorRest}. + * @param ctx the parse tree + */ + void exitConstantDeclaratorRest(ExprParser.ConstantDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#variableDeclaratorId}. + * @param ctx the parse tree + */ + void enterVariableDeclaratorId(ExprParser.VariableDeclaratorIdContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#variableDeclaratorId}. + * @param ctx the parse tree + */ + void exitVariableDeclaratorId(ExprParser.VariableDeclaratorIdContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#compilationUnit}. + * @param ctx the parse tree + */ + void enterCompilationUnit(ExprParser.CompilationUnitContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#compilationUnit}. + * @param ctx the parse tree + */ + void exitCompilationUnit(ExprParser.CompilationUnitContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#importDeclaration}. + * @param ctx the parse tree + */ + void enterImportDeclaration(ExprParser.ImportDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#importDeclaration}. + * @param ctx the parse tree + */ + void exitImportDeclaration(ExprParser.ImportDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#typeDeclaration}. + * @param ctx the parse tree + */ + void enterTypeDeclaration(ExprParser.TypeDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#typeDeclaration}. + * @param ctx the parse tree + */ + void exitTypeDeclaration(ExprParser.TypeDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#classOrInterfaceDeclaration}. + * @param ctx the parse tree + */ + void enterClassOrInterfaceDeclaration(ExprParser.ClassOrInterfaceDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#classOrInterfaceDeclaration}. + * @param ctx the parse tree + */ + void exitClassOrInterfaceDeclaration(ExprParser.ClassOrInterfaceDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#classDeclaration}. + * @param ctx the parse tree + */ + void enterClassDeclaration(ExprParser.ClassDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#classDeclaration}. + * @param ctx the parse tree + */ + void exitClassDeclaration(ExprParser.ClassDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceDeclaration}. + * @param ctx the parse tree + */ + void enterInterfaceDeclaration(ExprParser.InterfaceDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceDeclaration}. + * @param ctx the parse tree + */ + void exitInterfaceDeclaration(ExprParser.InterfaceDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#typeList}. + * @param ctx the parse tree + */ + void enterTypeList(ExprParser.TypeListContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#typeList}. + * @param ctx the parse tree + */ + void exitTypeList(ExprParser.TypeListContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#classBody}. + * @param ctx the parse tree + */ + void enterClassBody(ExprParser.ClassBodyContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#classBody}. + * @param ctx the parse tree + */ + void exitClassBody(ExprParser.ClassBodyContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceBody}. + * @param ctx the parse tree + */ + void enterInterfaceBody(ExprParser.InterfaceBodyContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceBody}. + * @param ctx the parse tree + */ + void exitInterfaceBody(ExprParser.InterfaceBodyContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void enterClassBodyDeclaration(ExprParser.ClassBodyDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void exitClassBodyDeclaration(ExprParser.ClassBodyDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#memberDecl}. + * @param ctx the parse tree + */ + void enterMemberDecl(ExprParser.MemberDeclContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#memberDecl}. + * @param ctx the parse tree + */ + void exitMemberDecl(ExprParser.MemberDeclContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#methodOrFieldDecl}. + * @param ctx the parse tree + */ + void enterMethodOrFieldDecl(ExprParser.MethodOrFieldDeclContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#methodOrFieldDecl}. + * @param ctx the parse tree + */ + void exitMethodOrFieldDecl(ExprParser.MethodOrFieldDeclContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#methodOrFieldRest}. + * @param ctx the parse tree + */ + void enterMethodOrFieldRest(ExprParser.MethodOrFieldRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#methodOrFieldRest}. + * @param ctx the parse tree + */ + void exitMethodOrFieldRest(ExprParser.MethodOrFieldRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceBodyDeclaration}. + * @param ctx the parse tree + */ + void enterInterfaceBodyDeclaration(ExprParser.InterfaceBodyDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceBodyDeclaration}. + * @param ctx the parse tree + */ + void exitInterfaceBodyDeclaration(ExprParser.InterfaceBodyDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceMemberDecl}. + * @param ctx the parse tree + */ + void enterInterfaceMemberDecl(ExprParser.InterfaceMemberDeclContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceMemberDecl}. + * @param ctx the parse tree + */ + void exitInterfaceMemberDecl(ExprParser.InterfaceMemberDeclContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceMethodOrFieldDecl}. + * @param ctx the parse tree + */ + void enterInterfaceMethodOrFieldDecl(ExprParser.InterfaceMethodOrFieldDeclContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceMethodOrFieldDecl}. + * @param ctx the parse tree + */ + void exitInterfaceMethodOrFieldDecl(ExprParser.InterfaceMethodOrFieldDeclContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceMethodOrFieldRest}. + * @param ctx the parse tree + */ + void enterInterfaceMethodOrFieldRest(ExprParser.InterfaceMethodOrFieldRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceMethodOrFieldRest}. + * @param ctx the parse tree + */ + void exitInterfaceMethodOrFieldRest(ExprParser.InterfaceMethodOrFieldRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#methodDeclaratorRest}. + * @param ctx the parse tree + */ + void enterMethodDeclaratorRest(ExprParser.MethodDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#methodDeclaratorRest}. + * @param ctx the parse tree + */ + void exitMethodDeclaratorRest(ExprParser.MethodDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#voidMethodDeclaratorRest}. + * @param ctx the parse tree + */ + void enterVoidMethodDeclaratorRest(ExprParser.VoidMethodDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#voidMethodDeclaratorRest}. + * @param ctx the parse tree + */ + void exitVoidMethodDeclaratorRest(ExprParser.VoidMethodDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#interfaceMethodDeclaratorRest}. + * @param ctx the parse tree + */ + void enterInterfaceMethodDeclaratorRest(ExprParser.InterfaceMethodDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#interfaceMethodDeclaratorRest}. + * @param ctx the parse tree + */ + void exitInterfaceMethodDeclaratorRest(ExprParser.InterfaceMethodDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#voidInterfaceMethodDeclaratorRest}. + * @param ctx the parse tree + */ + void enterVoidInterfaceMethodDeclaratorRest(ExprParser.VoidInterfaceMethodDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#voidInterfaceMethodDeclaratorRest}. + * @param ctx the parse tree + */ + void exitVoidInterfaceMethodDeclaratorRest(ExprParser.VoidInterfaceMethodDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#constructorDeclaratorRest}. + * @param ctx the parse tree + */ + void enterConstructorDeclaratorRest(ExprParser.ConstructorDeclaratorRestContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#constructorDeclaratorRest}. + * @param ctx the parse tree + */ + void exitConstructorDeclaratorRest(ExprParser.ConstructorDeclaratorRestContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#qualifiedIdentifierList}. + * @param ctx the parse tree + */ + void enterQualifiedIdentifierList(ExprParser.QualifiedIdentifierListContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#qualifiedIdentifierList}. + * @param ctx the parse tree + */ + void exitQualifiedIdentifierList(ExprParser.QualifiedIdentifierListContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#formalParameters}. + * @param ctx the parse tree + */ + void enterFormalParameters(ExprParser.FormalParametersContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#formalParameters}. + * @param ctx the parse tree + */ + void exitFormalParameters(ExprParser.FormalParametersContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#formalParameter}. + * @param ctx the parse tree + */ + void enterFormalParameter(ExprParser.FormalParameterContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#formalParameter}. + * @param ctx the parse tree + */ + void exitFormalParameter(ExprParser.FormalParameterContext ctx); + /** + * Enter a parse tree produced by {@link ExprParser#methodBody}. + * @param ctx the parse tree + */ + void enterMethodBody(ExprParser.MethodBodyContext ctx); + /** + * Exit a parse tree produced by {@link ExprParser#methodBody}. + * @param ctx the parse tree + */ + void exitMethodBody(ExprParser.MethodBodyContext ctx); +} \ No newline at end of file diff --git a/Assignment-2/.DS_Store b/Assignment-2/.DS_Store index 3f8fe43..1215e36 100644 Binary files a/Assignment-2/.DS_Store and b/Assignment-2/.DS_Store differ diff --git a/Assignment-2/.vscode/settings.json b/Assignment-2/.vscode/settings.json new file mode 100644 index 0000000..f9a5742 --- /dev/null +++ b/Assignment-2/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.fontSize": 12 +} \ No newline at end of file diff --git a/Assignment-2/Java-8/.DS_Store b/Assignment-2/Java-8/.DS_Store new file mode 100644 index 0000000..afc5506 Binary files /dev/null and b/Assignment-2/Java-8/.DS_Store differ diff --git a/Assignment-2/Java-8/Java8Lexer.interp b/Assignment-2/Java-8/.antlr/Java8Lexer.interp similarity index 100% rename from Assignment-2/Java-8/Java8Lexer.interp rename to Assignment-2/Java-8/.antlr/Java8Lexer.interp diff --git a/Assignment-2/Java-8/Java8Lexer.java b/Assignment-2/Java-8/.antlr/Java8Lexer.java similarity index 99% rename from Assignment-2/Java-8/Java8Lexer.java rename to Assignment-2/Java-8/.antlr/Java8Lexer.java index b911e53..150f42f 100644 --- a/Assignment-2/Java-8/Java8Lexer.java +++ b/Assignment-2/Java-8/.antlr/Java8Lexer.java @@ -1,4 +1,4 @@ -// Generated from Java-8/Java8Lexer.g4 by ANTLR 4.13.2 +// Generated from /Users/mannpatel/Desktop/University/25-Fall/CPSC499/CPSC-499 Assignment/Assignment-2/Java-8/Java8Lexer.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Token; @@ -10,7 +10,7 @@ import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) public class Java8Lexer extends Lexer { - static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); } + static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = diff --git a/Assignment-2/Java-8/Java8Lexer.tokens b/Assignment-2/Java-8/.antlr/Java8Lexer.tokens similarity index 100% rename from Assignment-2/Java-8/Java8Lexer.tokens rename to Assignment-2/Java-8/.antlr/Java8Lexer.tokens diff --git a/Assignment-2/Java-8/ExprTool.java b/Assignment-2/Java-8/ExprTool.java new file mode 100644 index 0000000..3e97073 --- /dev/null +++ b/Assignment-2/Java-8/ExprTool.java @@ -0,0 +1,102 @@ +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Scanner; + +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.tree.*; +import org.antlr.v4.runtime.misc.ParseCancellationException; + +public class ExprTool { + public static void main(String[] args) throws Exception { + if (args.length == 0) { + // If no files given then read from stdin + Scanner scanner = new Scanner(System.in); + StringBuilder inputBuilder = new StringBuilder(); + while (scanner.hasNextLine()) { + inputBuilder.append(scanner.nextLine()).append("\n"); + } + scanner.close(); + + parseAndWalk(inputBuilder.toString(), ""); + } else { + // for Loop through all given file paths + for (String filePath : args) { + try { + String inputText = new String(Files.readAllBytes(Paths.get(filePath))); + parseAndWalk(inputText, filePath); + } catch (IOException e) { + System.err.println("Error reading file: " + filePath); + } + } + } + } + private static void parseAndWalk(String inputText, String sourceName) { + try { + // Create char stream + CharStream input = CharStreams.fromString(inputText, sourceName); + Java8Lexer lexer = new Java8Lexer(input); + lexer.removeErrorListeners(); + lexer.addErrorListener(new ThrowingErrorListener()); + + CommonTokenStream tokens = new CommonTokenStream(lexer); + Java8Parser parser = new Java8Parser(tokens); + parser.removeErrorListeners(); + parser.addErrorListener(new ThrowingErrorListener()); + + ParseTree tree = parser.compilationUnit(); + ParseTreeWalker walker = new ParseTreeWalker(); + walker.walk(new ClassPrinter(sourceName), tree); + + } catch (RuntimeException e) { + System.err.println("Parsing File Failed: " + e.getMessage()); + } + } + + public static class ClassPrinter extends Java8ParserBaseListener { + private final String sourceName; + + public ClassPrinter(String sourceName) { + this.sourceName = sourceName; + } + + @Override + public void enterClassDeclaration(Java8Parser.ClassDeclarationContext ctx) { + int line = ctx.getStart().getLine(); + int col = ctx.getStart().getCharPositionInLine(); + String class_name = ""; + + if(ctx.normalClassDeclaration() != null){ + class_name = ctx.normalClassDeclaration().Identifier().getText(); + }else if(ctx.enumDeclaration() != null){ + class_name = ctx.normalClassDeclaration().Identifier().getText(); + } + + //String className = ctx.identifier().getText(); + System.out.printf("Class %s, file %s, line %d, column %d%n", + class_name, sourceName, line, col); + } + } + + // Custom error listener + public static class ThrowingErrorListener extends BaseErrorListener { + @Override + public void syntaxError(Recognizer recognizer, + Object offendingSymbol, + int line, int charPositionInLine, + String msg, + RecognitionException e) { + String sourceName = recognizer.getInputStream().getSourceName(); + if (sourceName == null || sourceName.isEmpty()) { + sourceName = ""; + } + + String formatted = String.format( + " file %s, line %d, column %d, error-msg: %s", + sourceName, line, charPositionInLine, msg + ); + + throw new ParseCancellationException(formatted); + } + } +} diff --git a/Assignment-2/Java-8/Java8Lexer.class b/Assignment-2/Java-8/Java8Lexer.class deleted file mode 100644 index 652c803..0000000 Binary files a/Assignment-2/Java-8/Java8Lexer.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AdditionalBoundContext.class b/Assignment-2/Java-8/Java8Parser$AdditionalBoundContext.class deleted file mode 100644 index d57efe7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AdditionalBoundContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AdditiveExpressionContext.class b/Assignment-2/Java-8/Java8Parser$AdditiveExpressionContext.class deleted file mode 100644 index 7522bcd..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AdditiveExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AmbiguousNameContext.class b/Assignment-2/Java-8/Java8Parser$AmbiguousNameContext.class deleted file mode 100644 index d82a775..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AmbiguousNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AndExpressionContext.class b/Assignment-2/Java-8/Java8Parser$AndExpressionContext.class deleted file mode 100644 index b6cfdd6..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AndExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AnnotationContext.class b/Assignment-2/Java-8/Java8Parser$AnnotationContext.class deleted file mode 100644 index 53e06cd..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AnnotationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AnnotationTypeBodyContext.class b/Assignment-2/Java-8/Java8Parser$AnnotationTypeBodyContext.class deleted file mode 100644 index e304baa..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AnnotationTypeBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AnnotationTypeDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$AnnotationTypeDeclarationContext.class deleted file mode 100644 index 38d8b6c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AnnotationTypeDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AnnotationTypeElementDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$AnnotationTypeElementDeclarationContext.class deleted file mode 100644 index 7838dde..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AnnotationTypeElementDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AnnotationTypeElementModifierContext.class b/Assignment-2/Java-8/Java8Parser$AnnotationTypeElementModifierContext.class deleted file mode 100644 index a4b5093..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AnnotationTypeElementModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AnnotationTypeMemberDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$AnnotationTypeMemberDeclarationContext.class deleted file mode 100644 index 8e282e7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AnnotationTypeMemberDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArgumentListContext.class b/Assignment-2/Java-8/Java8Parser$ArgumentListContext.class deleted file mode 100644 index 0bd116c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArgumentListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArrayAccessContext.class b/Assignment-2/Java-8/Java8Parser$ArrayAccessContext.class deleted file mode 100644 index 427b963..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArrayAccessContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArrayAccess_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$ArrayAccess_lf_primaryContext.class deleted file mode 100644 index 9f88bc7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArrayAccess_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArrayAccess_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$ArrayAccess_lfno_primaryContext.class deleted file mode 100644 index 4f0f62a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArrayAccess_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArrayCreationExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ArrayCreationExpressionContext.class deleted file mode 100644 index c97b067..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArrayCreationExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArrayInitializerContext.class b/Assignment-2/Java-8/Java8Parser$ArrayInitializerContext.class deleted file mode 100644 index 9eb8a55..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArrayInitializerContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ArrayTypeContext.class b/Assignment-2/Java-8/Java8Parser$ArrayTypeContext.class deleted file mode 100644 index b166598..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ArrayTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AssertStatementContext.class b/Assignment-2/Java-8/Java8Parser$AssertStatementContext.class deleted file mode 100644 index 6e06835..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AssertStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AssignmentContext.class b/Assignment-2/Java-8/Java8Parser$AssignmentContext.class deleted file mode 100644 index 1a45419..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AssignmentContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AssignmentExpressionContext.class b/Assignment-2/Java-8/Java8Parser$AssignmentExpressionContext.class deleted file mode 100644 index a1bd943..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AssignmentExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$AssignmentOperatorContext.class b/Assignment-2/Java-8/Java8Parser$AssignmentOperatorContext.class deleted file mode 100644 index 4b24d3d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$AssignmentOperatorContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$BasicForStatementContext.class b/Assignment-2/Java-8/Java8Parser$BasicForStatementContext.class deleted file mode 100644 index a1fd9c3..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$BasicForStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$BasicForStatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$BasicForStatementNoShortIfContext.class deleted file mode 100644 index da9810f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$BasicForStatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$BlockContext.class b/Assignment-2/Java-8/Java8Parser$BlockContext.class deleted file mode 100644 index d472d78..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$BlockContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$BlockStatementContext.class b/Assignment-2/Java-8/Java8Parser$BlockStatementContext.class deleted file mode 100644 index 61c35e7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$BlockStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$BlockStatementsContext.class b/Assignment-2/Java-8/Java8Parser$BlockStatementsContext.class deleted file mode 100644 index a2a8e4f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$BlockStatementsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$BreakStatementContext.class b/Assignment-2/Java-8/Java8Parser$BreakStatementContext.class deleted file mode 100644 index 3afe1b1..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$BreakStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$CastExpressionContext.class b/Assignment-2/Java-8/Java8Parser$CastExpressionContext.class deleted file mode 100644 index 8c13a64..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$CastExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$CatchClauseContext.class b/Assignment-2/Java-8/Java8Parser$CatchClauseContext.class deleted file mode 100644 index 66122ac..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$CatchClauseContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$CatchFormalParameterContext.class b/Assignment-2/Java-8/Java8Parser$CatchFormalParameterContext.class deleted file mode 100644 index 71d409e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$CatchFormalParameterContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$CatchTypeContext.class b/Assignment-2/Java-8/Java8Parser$CatchTypeContext.class deleted file mode 100644 index 7d0c1cc..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$CatchTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$CatchesContext.class b/Assignment-2/Java-8/Java8Parser$CatchesContext.class deleted file mode 100644 index a559f56..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$CatchesContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassBodyContext.class b/Assignment-2/Java-8/Java8Parser$ClassBodyContext.class deleted file mode 100644 index d1aed1e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassBodyDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$ClassBodyDeclarationContext.class deleted file mode 100644 index 22653de..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassBodyDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$ClassDeclarationContext.class deleted file mode 100644 index c3ce44b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpressionContext.class deleted file mode 100644 index 039b75a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpression_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpression_lf_primaryContext.class deleted file mode 100644 index 9b833a6..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpression_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpression_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpression_lfno_primaryContext.class deleted file mode 100644 index a43bcc9..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassInstanceCreationExpression_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassMemberDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$ClassMemberDeclarationContext.class deleted file mode 100644 index 355ea0b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassMemberDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassModifierContext.class b/Assignment-2/Java-8/Java8Parser$ClassModifierContext.class deleted file mode 100644 index 47a6b65..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$ClassOrInterfaceTypeContext.class deleted file mode 100644 index 31c1993..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassTypeContext.class b/Assignment-2/Java-8/Java8Parser$ClassTypeContext.class deleted file mode 100644 index 8baa7e9..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassType_lf_classOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$ClassType_lf_classOrInterfaceTypeContext.class deleted file mode 100644 index f4e1574..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassType_lf_classOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ClassType_lfno_classOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$ClassType_lfno_classOrInterfaceTypeContext.class deleted file mode 100644 index dd414b8..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ClassType_lfno_classOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$CompilationUnitContext.class b/Assignment-2/Java-8/Java8Parser$CompilationUnitContext.class deleted file mode 100644 index a5c0873..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$CompilationUnitContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConditionalAndExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ConditionalAndExpressionContext.class deleted file mode 100644 index b02b634..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConditionalAndExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConditionalExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ConditionalExpressionContext.class deleted file mode 100644 index d22d063..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConditionalExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConditionalOrExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ConditionalOrExpressionContext.class deleted file mode 100644 index 7caa736..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConditionalOrExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstantDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$ConstantDeclarationContext.class deleted file mode 100644 index b7bbaeb..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstantDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstantExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ConstantExpressionContext.class deleted file mode 100644 index e92b735..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstantExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstantModifierContext.class b/Assignment-2/Java-8/Java8Parser$ConstantModifierContext.class deleted file mode 100644 index 9c30c16..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstantModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstructorBodyContext.class b/Assignment-2/Java-8/Java8Parser$ConstructorBodyContext.class deleted file mode 100644 index a56f928..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstructorBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstructorDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$ConstructorDeclarationContext.class deleted file mode 100644 index 477a5df..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstructorDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstructorDeclaratorContext.class b/Assignment-2/Java-8/Java8Parser$ConstructorDeclaratorContext.class deleted file mode 100644 index 997ea92..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstructorDeclaratorContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ConstructorModifierContext.class b/Assignment-2/Java-8/Java8Parser$ConstructorModifierContext.class deleted file mode 100644 index 171f1e4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ConstructorModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ContinueStatementContext.class b/Assignment-2/Java-8/Java8Parser$ContinueStatementContext.class deleted file mode 100644 index a45fcd4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ContinueStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$DefaultValueContext.class b/Assignment-2/Java-8/Java8Parser$DefaultValueContext.class deleted file mode 100644 index 9c7d48b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$DefaultValueContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$DimExprContext.class b/Assignment-2/Java-8/Java8Parser$DimExprContext.class deleted file mode 100644 index 0f0dce2..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$DimExprContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$DimExprsContext.class b/Assignment-2/Java-8/Java8Parser$DimExprsContext.class deleted file mode 100644 index 9e5e37a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$DimExprsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$DimsContext.class b/Assignment-2/Java-8/Java8Parser$DimsContext.class deleted file mode 100644 index 78b129e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$DimsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$DoStatementContext.class b/Assignment-2/Java-8/Java8Parser$DoStatementContext.class deleted file mode 100644 index 046031d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$DoStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ElementValueArrayInitializerContext.class b/Assignment-2/Java-8/Java8Parser$ElementValueArrayInitializerContext.class deleted file mode 100644 index 3a50de3..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ElementValueArrayInitializerContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ElementValueContext.class b/Assignment-2/Java-8/Java8Parser$ElementValueContext.class deleted file mode 100644 index c0538c0..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ElementValueContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ElementValueListContext.class b/Assignment-2/Java-8/Java8Parser$ElementValueListContext.class deleted file mode 100644 index edf47a5..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ElementValueListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ElementValuePairContext.class b/Assignment-2/Java-8/Java8Parser$ElementValuePairContext.class deleted file mode 100644 index 79fbdb1..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ElementValuePairContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ElementValuePairListContext.class b/Assignment-2/Java-8/Java8Parser$ElementValuePairListContext.class deleted file mode 100644 index cb6013a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ElementValuePairListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EmptyStatement_Context.class b/Assignment-2/Java-8/Java8Parser$EmptyStatement_Context.class deleted file mode 100644 index 2e5af86..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EmptyStatement_Context.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnhancedForStatementContext.class b/Assignment-2/Java-8/Java8Parser$EnhancedForStatementContext.class deleted file mode 100644 index 283235d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnhancedForStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnhancedForStatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$EnhancedForStatementNoShortIfContext.class deleted file mode 100644 index d1d90b9..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnhancedForStatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumBodyContext.class b/Assignment-2/Java-8/Java8Parser$EnumBodyContext.class deleted file mode 100644 index 21c35fb..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumBodyDeclarationsContext.class b/Assignment-2/Java-8/Java8Parser$EnumBodyDeclarationsContext.class deleted file mode 100644 index 7be60c7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumBodyDeclarationsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumConstantContext.class b/Assignment-2/Java-8/Java8Parser$EnumConstantContext.class deleted file mode 100644 index acb0f42..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumConstantContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumConstantListContext.class b/Assignment-2/Java-8/Java8Parser$EnumConstantListContext.class deleted file mode 100644 index e691c6f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumConstantListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumConstantModifierContext.class b/Assignment-2/Java-8/Java8Parser$EnumConstantModifierContext.class deleted file mode 100644 index ac2869d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumConstantModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumConstantNameContext.class b/Assignment-2/Java-8/Java8Parser$EnumConstantNameContext.class deleted file mode 100644 index e81cbb7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumConstantNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EnumDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$EnumDeclarationContext.class deleted file mode 100644 index f0b43ac..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EnumDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$EqualityExpressionContext.class b/Assignment-2/Java-8/Java8Parser$EqualityExpressionContext.class deleted file mode 100644 index 2fcfcb3..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$EqualityExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExceptionTypeContext.class b/Assignment-2/Java-8/Java8Parser$ExceptionTypeContext.class deleted file mode 100644 index 2a1916c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExceptionTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExceptionTypeListContext.class b/Assignment-2/Java-8/Java8Parser$ExceptionTypeListContext.class deleted file mode 100644 index 9a35ee4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExceptionTypeListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExclusiveOrExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ExclusiveOrExpressionContext.class deleted file mode 100644 index 2c58f3c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExclusiveOrExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExplicitConstructorInvocationContext.class b/Assignment-2/Java-8/Java8Parser$ExplicitConstructorInvocationContext.class deleted file mode 100644 index 3cbbbf2..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExplicitConstructorInvocationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ExpressionContext.class deleted file mode 100644 index 1ecd282..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExpressionNameContext.class b/Assignment-2/Java-8/Java8Parser$ExpressionNameContext.class deleted file mode 100644 index fe6aecc..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExpressionNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExpressionStatementContext.class b/Assignment-2/Java-8/Java8Parser$ExpressionStatementContext.class deleted file mode 100644 index ffe9fe9..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExpressionStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ExtendsInterfacesContext.class b/Assignment-2/Java-8/Java8Parser$ExtendsInterfacesContext.class deleted file mode 100644 index 208f9ab..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ExtendsInterfacesContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FieldAccessContext.class b/Assignment-2/Java-8/Java8Parser$FieldAccessContext.class deleted file mode 100644 index 0fdfb44..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FieldAccessContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FieldAccess_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$FieldAccess_lf_primaryContext.class deleted file mode 100644 index 32a4561..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FieldAccess_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FieldAccess_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$FieldAccess_lfno_primaryContext.class deleted file mode 100644 index bb6bf84..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FieldAccess_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FieldDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$FieldDeclarationContext.class deleted file mode 100644 index cafed4b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FieldDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FieldModifierContext.class b/Assignment-2/Java-8/Java8Parser$FieldModifierContext.class deleted file mode 100644 index 8740b96..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FieldModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$Finally_Context.class b/Assignment-2/Java-8/Java8Parser$Finally_Context.class deleted file mode 100644 index 8508ac2..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$Finally_Context.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FloatingPointTypeContext.class b/Assignment-2/Java-8/Java8Parser$FloatingPointTypeContext.class deleted file mode 100644 index 6074f87..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FloatingPointTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ForInitContext.class b/Assignment-2/Java-8/Java8Parser$ForInitContext.class deleted file mode 100644 index 6f8ebbd..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ForInitContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ForStatementContext.class b/Assignment-2/Java-8/Java8Parser$ForStatementContext.class deleted file mode 100644 index 6545e43..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ForStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ForStatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$ForStatementNoShortIfContext.class deleted file mode 100644 index e843018..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ForStatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ForUpdateContext.class b/Assignment-2/Java-8/Java8Parser$ForUpdateContext.class deleted file mode 100644 index 4eb74b8..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ForUpdateContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FormalParameterContext.class b/Assignment-2/Java-8/Java8Parser$FormalParameterContext.class deleted file mode 100644 index ec33d2b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FormalParameterContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FormalParameterListContext.class b/Assignment-2/Java-8/Java8Parser$FormalParameterListContext.class deleted file mode 100644 index 209afcc..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FormalParameterListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$FormalParametersContext.class b/Assignment-2/Java-8/Java8Parser$FormalParametersContext.class deleted file mode 100644 index bd00712..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$FormalParametersContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$IfThenElseStatementContext.class b/Assignment-2/Java-8/Java8Parser$IfThenElseStatementContext.class deleted file mode 100644 index c18a733..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$IfThenElseStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$IfThenElseStatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$IfThenElseStatementNoShortIfContext.class deleted file mode 100644 index 15d0adf..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$IfThenElseStatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$IfThenStatementContext.class b/Assignment-2/Java-8/Java8Parser$IfThenStatementContext.class deleted file mode 100644 index 5ff092d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$IfThenStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ImportDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$ImportDeclarationContext.class deleted file mode 100644 index a97210c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ImportDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InclusiveOrExpressionContext.class b/Assignment-2/Java-8/Java8Parser$InclusiveOrExpressionContext.class deleted file mode 100644 index aeac95e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InclusiveOrExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InferredFormalParameterListContext.class b/Assignment-2/Java-8/Java8Parser$InferredFormalParameterListContext.class deleted file mode 100644 index 643e532..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InferredFormalParameterListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InstanceInitializerContext.class b/Assignment-2/Java-8/Java8Parser$InstanceInitializerContext.class deleted file mode 100644 index 70adf8e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InstanceInitializerContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$IntegralTypeContext.class b/Assignment-2/Java-8/Java8Parser$IntegralTypeContext.class deleted file mode 100644 index 99b62ed..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$IntegralTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceBodyContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceBodyContext.class deleted file mode 100644 index 4fe577e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceDeclarationContext.class deleted file mode 100644 index 810cdd0..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceMemberDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceMemberDeclarationContext.class deleted file mode 100644 index 884688e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceMemberDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceMethodDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceMethodDeclarationContext.class deleted file mode 100644 index c7953d1..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceMethodDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceMethodModifierContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceMethodModifierContext.class deleted file mode 100644 index c43291b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceMethodModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceModifierContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceModifierContext.class deleted file mode 100644 index 220d906..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceTypeContext.class deleted file mode 100644 index 0cfb481..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceTypeListContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceTypeListContext.class deleted file mode 100644 index 81c9304..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceTypeListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceType_lf_classOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceType_lf_classOrInterfaceTypeContext.class deleted file mode 100644 index 1791abe..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceType_lf_classOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$InterfaceType_lfno_classOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$InterfaceType_lfno_classOrInterfaceTypeContext.class deleted file mode 100644 index fabec9e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$InterfaceType_lfno_classOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LabeledStatementContext.class b/Assignment-2/Java-8/Java8Parser$LabeledStatementContext.class deleted file mode 100644 index fac9129..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LabeledStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LabeledStatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$LabeledStatementNoShortIfContext.class deleted file mode 100644 index af6e1ae..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LabeledStatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LambdaBodyContext.class b/Assignment-2/Java-8/Java8Parser$LambdaBodyContext.class deleted file mode 100644 index 9c1ebd0..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LambdaBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LambdaExpressionContext.class b/Assignment-2/Java-8/Java8Parser$LambdaExpressionContext.class deleted file mode 100644 index 234526f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LambdaExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LambdaParametersContext.class b/Assignment-2/Java-8/Java8Parser$LambdaParametersContext.class deleted file mode 100644 index 56b0112..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LambdaParametersContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LastFormalParameterContext.class b/Assignment-2/Java-8/Java8Parser$LastFormalParameterContext.class deleted file mode 100644 index 6cf0aff..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LastFormalParameterContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LeftHandSideContext.class b/Assignment-2/Java-8/Java8Parser$LeftHandSideContext.class deleted file mode 100644 index 4c24aaa..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LeftHandSideContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LiteralContext.class b/Assignment-2/Java-8/Java8Parser$LiteralContext.class deleted file mode 100644 index bb55236..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LiteralContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LocalVariableDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$LocalVariableDeclarationContext.class deleted file mode 100644 index 80718d4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LocalVariableDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$LocalVariableDeclarationStatementContext.class b/Assignment-2/Java-8/Java8Parser$LocalVariableDeclarationStatementContext.class deleted file mode 100644 index 1cf7c0c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$LocalVariableDeclarationStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MarkerAnnotationContext.class b/Assignment-2/Java-8/Java8Parser$MarkerAnnotationContext.class deleted file mode 100644 index 540859d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MarkerAnnotationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodBodyContext.class b/Assignment-2/Java-8/Java8Parser$MethodBodyContext.class deleted file mode 100644 index 4cd6600..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodBodyContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$MethodDeclarationContext.class deleted file mode 100644 index a986f7b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodDeclaratorContext.class b/Assignment-2/Java-8/Java8Parser$MethodDeclaratorContext.class deleted file mode 100644 index 2f4207d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodDeclaratorContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodHeaderContext.class b/Assignment-2/Java-8/Java8Parser$MethodHeaderContext.class deleted file mode 100644 index 20ac7ee..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodHeaderContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodInvocationContext.class b/Assignment-2/Java-8/Java8Parser$MethodInvocationContext.class deleted file mode 100644 index f1a8b6c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodInvocationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodInvocation_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$MethodInvocation_lf_primaryContext.class deleted file mode 100644 index 30a6529..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodInvocation_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodInvocation_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$MethodInvocation_lfno_primaryContext.class deleted file mode 100644 index 34a8c79..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodInvocation_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodModifierContext.class b/Assignment-2/Java-8/Java8Parser$MethodModifierContext.class deleted file mode 100644 index ffe4f2a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodNameContext.class b/Assignment-2/Java-8/Java8Parser$MethodNameContext.class deleted file mode 100644 index d8d07de..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodReferenceContext.class b/Assignment-2/Java-8/Java8Parser$MethodReferenceContext.class deleted file mode 100644 index f03a731..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodReferenceContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodReference_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$MethodReference_lf_primaryContext.class deleted file mode 100644 index c498909..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodReference_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MethodReference_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$MethodReference_lfno_primaryContext.class deleted file mode 100644 index da25a4c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MethodReference_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$MultiplicativeExpressionContext.class b/Assignment-2/Java-8/Java8Parser$MultiplicativeExpressionContext.class deleted file mode 100644 index 8cf8c78..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$MultiplicativeExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$NormalAnnotationContext.class b/Assignment-2/Java-8/Java8Parser$NormalAnnotationContext.class deleted file mode 100644 index 7c8674d..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$NormalAnnotationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$NormalClassDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$NormalClassDeclarationContext.class deleted file mode 100644 index 329cbd6..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$NormalClassDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$NormalInterfaceDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$NormalInterfaceDeclarationContext.class deleted file mode 100644 index 13c11eb..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$NormalInterfaceDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$NumericTypeContext.class b/Assignment-2/Java-8/Java8Parser$NumericTypeContext.class deleted file mode 100644 index 312321e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$NumericTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PackageDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$PackageDeclarationContext.class deleted file mode 100644 index aa6ab88..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PackageDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PackageModifierContext.class b/Assignment-2/Java-8/Java8Parser$PackageModifierContext.class deleted file mode 100644 index 4edf380..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PackageModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PackageNameContext.class b/Assignment-2/Java-8/Java8Parser$PackageNameContext.class deleted file mode 100644 index 1e85403..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PackageNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PackageOrTypeNameContext.class b/Assignment-2/Java-8/Java8Parser$PackageOrTypeNameContext.class deleted file mode 100644 index de9c889..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PackageOrTypeNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PostDecrementExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PostDecrementExpressionContext.class deleted file mode 100644 index 3d6c4a4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PostDecrementExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PostDecrementExpression_lf_postfixExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PostDecrementExpression_lf_postfixExpressionContext.class deleted file mode 100644 index 941768b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PostDecrementExpression_lf_postfixExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PostIncrementExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PostIncrementExpressionContext.class deleted file mode 100644 index 0e92784..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PostIncrementExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PostIncrementExpression_lf_postfixExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PostIncrementExpression_lf_postfixExpressionContext.class deleted file mode 100644 index b8cea74..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PostIncrementExpression_lf_postfixExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PostfixExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PostfixExpressionContext.class deleted file mode 100644 index fe0cba5..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PostfixExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PreDecrementExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PreDecrementExpressionContext.class deleted file mode 100644 index eeec5c5..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PreDecrementExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PreIncrementExpressionContext.class b/Assignment-2/Java-8/Java8Parser$PreIncrementExpressionContext.class deleted file mode 100644 index c2a317f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PreIncrementExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryContext.class deleted file mode 100644 index 4a21bc1..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArrayContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArrayContext.class deleted file mode 100644 index 32ba6e6..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArrayContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_arrayAccessContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_arrayAccessContext.class deleted file mode 100644 index 85733ec..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_arrayAccessContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primaryContext.class deleted file mode 100644 index 32cea53..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext.class deleted file mode 100644 index 873c011..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext.class deleted file mode 100644 index 19a1586..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_arrayAccessContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_arrayAccessContext.class deleted file mode 100644 index 3d29c2a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_arrayAccessContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primaryContext.class deleted file mode 100644 index a06911c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext.class deleted file mode 100644 index 08545f1..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext.class b/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext.class deleted file mode 100644 index 535d382..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$PrimitiveTypeContext.class b/Assignment-2/Java-8/Java8Parser$PrimitiveTypeContext.class deleted file mode 100644 index 70982a3..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$PrimitiveTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ReceiverParameterContext.class b/Assignment-2/Java-8/Java8Parser$ReceiverParameterContext.class deleted file mode 100644 index 40ef5ad..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ReceiverParameterContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ReferenceTypeContext.class b/Assignment-2/Java-8/Java8Parser$ReferenceTypeContext.class deleted file mode 100644 index a4eeec0..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ReferenceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$RelationalExpressionContext.class b/Assignment-2/Java-8/Java8Parser$RelationalExpressionContext.class deleted file mode 100644 index 99c8613..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$RelationalExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ResourceContext.class b/Assignment-2/Java-8/Java8Parser$ResourceContext.class deleted file mode 100644 index e6f2d26..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ResourceContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ResourceListContext.class b/Assignment-2/Java-8/Java8Parser$ResourceListContext.class deleted file mode 100644 index 7202564..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ResourceListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ResourceSpecificationContext.class b/Assignment-2/Java-8/Java8Parser$ResourceSpecificationContext.class deleted file mode 100644 index f99eb6f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ResourceSpecificationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ResultContext.class b/Assignment-2/Java-8/Java8Parser$ResultContext.class deleted file mode 100644 index a9fd889..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ResultContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ReturnStatementContext.class b/Assignment-2/Java-8/Java8Parser$ReturnStatementContext.class deleted file mode 100644 index a196a2c..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ReturnStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ShiftExpressionContext.class b/Assignment-2/Java-8/Java8Parser$ShiftExpressionContext.class deleted file mode 100644 index fb29b54..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ShiftExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SimpleTypeNameContext.class b/Assignment-2/Java-8/Java8Parser$SimpleTypeNameContext.class deleted file mode 100644 index 4c4dea4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SimpleTypeNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SingleElementAnnotationContext.class b/Assignment-2/Java-8/Java8Parser$SingleElementAnnotationContext.class deleted file mode 100644 index be855ec..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SingleElementAnnotationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SingleStaticImportDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$SingleStaticImportDeclarationContext.class deleted file mode 100644 index be68180..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SingleStaticImportDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SingleTypeImportDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$SingleTypeImportDeclarationContext.class deleted file mode 100644 index b2badd9..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SingleTypeImportDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StatementContext.class b/Assignment-2/Java-8/Java8Parser$StatementContext.class deleted file mode 100644 index 3620859..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StatementExpressionContext.class b/Assignment-2/Java-8/Java8Parser$StatementExpressionContext.class deleted file mode 100644 index 9ae0b81..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StatementExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StatementExpressionListContext.class b/Assignment-2/Java-8/Java8Parser$StatementExpressionListContext.class deleted file mode 100644 index 23ef047..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StatementExpressionListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$StatementNoShortIfContext.class deleted file mode 100644 index 45af5f0..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StatementWithoutTrailingSubstatementContext.class b/Assignment-2/Java-8/Java8Parser$StatementWithoutTrailingSubstatementContext.class deleted file mode 100644 index 76bd131..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StatementWithoutTrailingSubstatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StaticImportOnDemandDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$StaticImportOnDemandDeclarationContext.class deleted file mode 100644 index 822e30e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StaticImportOnDemandDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$StaticInitializerContext.class b/Assignment-2/Java-8/Java8Parser$StaticInitializerContext.class deleted file mode 100644 index 612d6d0..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$StaticInitializerContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SuperclassContext.class b/Assignment-2/Java-8/Java8Parser$SuperclassContext.class deleted file mode 100644 index d8fbb47..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SuperclassContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SuperinterfacesContext.class b/Assignment-2/Java-8/Java8Parser$SuperinterfacesContext.class deleted file mode 100644 index 7eee1c7..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SuperinterfacesContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SwitchBlockContext.class b/Assignment-2/Java-8/Java8Parser$SwitchBlockContext.class deleted file mode 100644 index 49f1227..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SwitchBlockContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SwitchBlockStatementGroupContext.class b/Assignment-2/Java-8/Java8Parser$SwitchBlockStatementGroupContext.class deleted file mode 100644 index 1b24608..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SwitchBlockStatementGroupContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SwitchLabelContext.class b/Assignment-2/Java-8/Java8Parser$SwitchLabelContext.class deleted file mode 100644 index 31bb541..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SwitchLabelContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SwitchLabelsContext.class b/Assignment-2/Java-8/Java8Parser$SwitchLabelsContext.class deleted file mode 100644 index 7efe716..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SwitchLabelsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SwitchStatementContext.class b/Assignment-2/Java-8/Java8Parser$SwitchStatementContext.class deleted file mode 100644 index 6086931..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SwitchStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$SynchronizedStatementContext.class b/Assignment-2/Java-8/Java8Parser$SynchronizedStatementContext.class deleted file mode 100644 index 871d5b6..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$SynchronizedStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$ThrowStatementContext.class b/Assignment-2/Java-8/Java8Parser$ThrowStatementContext.class deleted file mode 100644 index 36fba6a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$ThrowStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$Throws_Context.class b/Assignment-2/Java-8/Java8Parser$Throws_Context.class deleted file mode 100644 index 05d39e3..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$Throws_Context.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TryStatementContext.class b/Assignment-2/Java-8/Java8Parser$TryStatementContext.class deleted file mode 100644 index 1153cc4..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TryStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TryWithResourcesStatementContext.class b/Assignment-2/Java-8/Java8Parser$TryWithResourcesStatementContext.class deleted file mode 100644 index ba2e56a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TryWithResourcesStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeArgumentContext.class b/Assignment-2/Java-8/Java8Parser$TypeArgumentContext.class deleted file mode 100644 index 2d6e71a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeArgumentContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeArgumentListContext.class b/Assignment-2/Java-8/Java8Parser$TypeArgumentListContext.class deleted file mode 100644 index 1227a1a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeArgumentListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeArgumentsContext.class b/Assignment-2/Java-8/Java8Parser$TypeArgumentsContext.class deleted file mode 100644 index 6a8d426..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeArgumentsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeArgumentsOrDiamondContext.class b/Assignment-2/Java-8/Java8Parser$TypeArgumentsOrDiamondContext.class deleted file mode 100644 index bf753ab..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeArgumentsOrDiamondContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeBoundContext.class b/Assignment-2/Java-8/Java8Parser$TypeBoundContext.class deleted file mode 100644 index dee3974..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeBoundContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$TypeDeclarationContext.class deleted file mode 100644 index 4c41805..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeImportOnDemandDeclarationContext.class b/Assignment-2/Java-8/Java8Parser$TypeImportOnDemandDeclarationContext.class deleted file mode 100644 index 1286d66..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeImportOnDemandDeclarationContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeNameContext.class b/Assignment-2/Java-8/Java8Parser$TypeNameContext.class deleted file mode 100644 index b52aea5..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeNameContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeParameterContext.class b/Assignment-2/Java-8/Java8Parser$TypeParameterContext.class deleted file mode 100644 index cbefa80..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeParameterContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeParameterListContext.class b/Assignment-2/Java-8/Java8Parser$TypeParameterListContext.class deleted file mode 100644 index 8948d87..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeParameterListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeParameterModifierContext.class b/Assignment-2/Java-8/Java8Parser$TypeParameterModifierContext.class deleted file mode 100644 index c3f5aca..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeParameterModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeParametersContext.class b/Assignment-2/Java-8/Java8Parser$TypeParametersContext.class deleted file mode 100644 index 18a93ad..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeParametersContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$TypeVariableContext.class b/Assignment-2/Java-8/Java8Parser$TypeVariableContext.class deleted file mode 100644 index fce46cd..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$TypeVariableContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannArrayTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannArrayTypeContext.class deleted file mode 100644 index 3f607cd..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannArrayTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannClassOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannClassOrInterfaceTypeContext.class deleted file mode 100644 index 46c4b77..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannClassOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannClassTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannClassTypeContext.class deleted file mode 100644 index b8bcee6..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannClassTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannClassType_lf_unannClassOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannClassType_lf_unannClassOrInterfaceTypeContext.class deleted file mode 100644 index 4c28241..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannClassType_lf_unannClassOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannClassType_lfno_unannClassOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannClassType_lfno_unannClassOrInterfaceTypeContext.class deleted file mode 100644 index 553c867..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannClassType_lfno_unannClassOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannInterfaceTypeContext.class deleted file mode 100644 index 5b0bf2b..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannInterfaceType_lf_unannClassOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannInterfaceType_lf_unannClassOrInterfaceTypeContext.class deleted file mode 100644 index 3771a8a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannInterfaceType_lf_unannClassOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext.class deleted file mode 100644 index 3f9f925..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannPrimitiveTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannPrimitiveTypeContext.class deleted file mode 100644 index e71d7f3..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannPrimitiveTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannReferenceTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannReferenceTypeContext.class deleted file mode 100644 index a129e8e..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannReferenceTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannTypeContext.class b/Assignment-2/Java-8/Java8Parser$UnannTypeContext.class deleted file mode 100644 index 54e6b71..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannTypeContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnannTypeVariableContext.class b/Assignment-2/Java-8/Java8Parser$UnannTypeVariableContext.class deleted file mode 100644 index 29e9f45..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnannTypeVariableContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnaryExpressionContext.class b/Assignment-2/Java-8/Java8Parser$UnaryExpressionContext.class deleted file mode 100644 index 87dc040..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnaryExpressionContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$UnaryExpressionNotPlusMinusContext.class b/Assignment-2/Java-8/Java8Parser$UnaryExpressionNotPlusMinusContext.class deleted file mode 100644 index b8c4595..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$UnaryExpressionNotPlusMinusContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$VariableDeclaratorContext.class b/Assignment-2/Java-8/Java8Parser$VariableDeclaratorContext.class deleted file mode 100644 index b4e4c73..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$VariableDeclaratorContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$VariableDeclaratorIdContext.class b/Assignment-2/Java-8/Java8Parser$VariableDeclaratorIdContext.class deleted file mode 100644 index 0eb6407..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$VariableDeclaratorIdContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$VariableDeclaratorListContext.class b/Assignment-2/Java-8/Java8Parser$VariableDeclaratorListContext.class deleted file mode 100644 index 02c6e58..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$VariableDeclaratorListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$VariableInitializerContext.class b/Assignment-2/Java-8/Java8Parser$VariableInitializerContext.class deleted file mode 100644 index 7555e60..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$VariableInitializerContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$VariableInitializerListContext.class b/Assignment-2/Java-8/Java8Parser$VariableInitializerListContext.class deleted file mode 100644 index 2f83581..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$VariableInitializerListContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$VariableModifierContext.class b/Assignment-2/Java-8/Java8Parser$VariableModifierContext.class deleted file mode 100644 index cef4e67..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$VariableModifierContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$WhileStatementContext.class b/Assignment-2/Java-8/Java8Parser$WhileStatementContext.class deleted file mode 100644 index 3ebaff2..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$WhileStatementContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$WhileStatementNoShortIfContext.class b/Assignment-2/Java-8/Java8Parser$WhileStatementNoShortIfContext.class deleted file mode 100644 index a9b1831..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$WhileStatementNoShortIfContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$WildcardBoundsContext.class b/Assignment-2/Java-8/Java8Parser$WildcardBoundsContext.class deleted file mode 100644 index 002c15f..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$WildcardBoundsContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser$WildcardContext.class b/Assignment-2/Java-8/Java8Parser$WildcardContext.class deleted file mode 100644 index 654f49a..0000000 Binary files a/Assignment-2/Java-8/Java8Parser$WildcardContext.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser.class b/Assignment-2/Java-8/Java8Parser.class deleted file mode 100644 index c185c66..0000000 Binary files a/Assignment-2/Java-8/Java8Parser.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8Parser.interp b/Assignment-2/Java-8/Java8Parser.interp deleted file mode 100644 index ab8fc6d..0000000 --- a/Assignment-2/Java-8/Java8Parser.interp +++ /dev/null @@ -1,461 +0,0 @@ -token literal names: -null -'abstract' -'assert' -'boolean' -'break' -'byte' -'case' -'catch' -'char' -'class' -'const' -'continue' -'default' -'do' -'double' -'else' -'enum' -'extends' -'final' -'finally' -'float' -'for' -'if' -'goto' -'implements' -'import' -'instanceof' -'int' -'interface' -'long' -'native' -'new' -'package' -'private' -'protected' -'public' -'return' -'short' -'static' -'strictfp' -'super' -'switch' -'synchronized' -'this' -'throw' -'throws' -'transient' -'try' -'void' -'volatile' -'while' -null -null -null -null -null -'null' -'(' -')' -'{' -'}' -'[' -']' -';' -',' -'.' -'=' -'>' -'<' -'!' -'~' -'?' -':' -'==' -'<=' -'>=' -'!=' -'&&' -'||' -'++' -'--' -'+' -'-' -'*' -'/' -'&' -'|' -'^' -'%' -'->' -'::' -'+=' -'-=' -'*=' -'/=' -'&=' -'|=' -'^=' -'%=' -'<<=' -'>>=' -'>>>=' -null -'@' -'...' -null -null -null - -token symbolic names: -null -ABSTRACT -ASSERT -BOOLEAN -BREAK -BYTE -CASE -CATCH -CHAR -CLASS -CONST -CONTINUE -DEFAULT -DO -DOUBLE -ELSE -ENUM -EXTENDS -FINAL -FINALLY -FLOAT -FOR -IF -GOTO -IMPLEMENTS -IMPORT -INSTANCEOF -INT -INTERFACE -LONG -NATIVE -NEW -PACKAGE -PRIVATE -PROTECTED -PUBLIC -RETURN -SHORT -STATIC -STRICTFP -SUPER -SWITCH -SYNCHRONIZED -THIS -THROW -THROWS -TRANSIENT -TRY -VOID -VOLATILE -WHILE -IntegerLiteral -FloatingPointLiteral -BooleanLiteral -CharacterLiteral -StringLiteral -NullLiteral -LPAREN -RPAREN -LBRACE -RBRACE -LBRACK -RBRACK -SEMI -COMMA -DOT -ASSIGN -GT -LT -BANG -TILDE -QUESTION -COLON -EQUAL -LE -GE -NOTEQUAL -AND -OR -INC -DEC -ADD -SUB -MUL -DIV -BITAND -BITOR -CARET -MOD -ARROW -COLONCOLON -ADD_ASSIGN -SUB_ASSIGN -MUL_ASSIGN -DIV_ASSIGN -AND_ASSIGN -OR_ASSIGN -XOR_ASSIGN -MOD_ASSIGN -LSHIFT_ASSIGN -RSHIFT_ASSIGN -URSHIFT_ASSIGN -Identifier -AT -ELLIPSIS -WS -COMMENT -LINE_COMMENT - -rule names: -literal -primitiveType -numericType -integralType -floatingPointType -referenceType -classOrInterfaceType -classType -classType_lf_classOrInterfaceType -classType_lfno_classOrInterfaceType -interfaceType -interfaceType_lf_classOrInterfaceType -interfaceType_lfno_classOrInterfaceType -typeVariable -arrayType -dims -typeParameter -typeParameterModifier -typeBound -additionalBound -typeArguments -typeArgumentList -typeArgument -wildcard -wildcardBounds -packageName -typeName -packageOrTypeName -expressionName -methodName -ambiguousName -compilationUnit -packageDeclaration -packageModifier -importDeclaration -singleTypeImportDeclaration -typeImportOnDemandDeclaration -singleStaticImportDeclaration -staticImportOnDemandDeclaration -typeDeclaration -classDeclaration -normalClassDeclaration -classModifier -typeParameters -typeParameterList -superclass -superinterfaces -interfaceTypeList -classBody -classBodyDeclaration -classMemberDeclaration -fieldDeclaration -fieldModifier -variableDeclaratorList -variableDeclarator -variableDeclaratorId -variableInitializer -unannType -unannPrimitiveType -unannReferenceType -unannClassOrInterfaceType -unannClassType -unannClassType_lf_unannClassOrInterfaceType -unannClassType_lfno_unannClassOrInterfaceType -unannInterfaceType -unannInterfaceType_lf_unannClassOrInterfaceType -unannInterfaceType_lfno_unannClassOrInterfaceType -unannTypeVariable -unannArrayType -methodDeclaration -methodModifier -methodHeader -result -methodDeclarator -formalParameterList -formalParameters -formalParameter -variableModifier -lastFormalParameter -receiverParameter -throws_ -exceptionTypeList -exceptionType -methodBody -instanceInitializer -staticInitializer -constructorDeclaration -constructorModifier -constructorDeclarator -simpleTypeName -constructorBody -explicitConstructorInvocation -enumDeclaration -enumBody -enumConstantList -enumConstant -enumConstantModifier -enumBodyDeclarations -interfaceDeclaration -normalInterfaceDeclaration -interfaceModifier -extendsInterfaces -interfaceBody -interfaceMemberDeclaration -constantDeclaration -constantModifier -interfaceMethodDeclaration -interfaceMethodModifier -annotationTypeDeclaration -annotationTypeBody -annotationTypeMemberDeclaration -annotationTypeElementDeclaration -annotationTypeElementModifier -defaultValue -annotation -normalAnnotation -elementValuePairList -elementValuePair -elementValue -elementValueArrayInitializer -elementValueList -markerAnnotation -singleElementAnnotation -arrayInitializer -variableInitializerList -block -blockStatements -blockStatement -localVariableDeclarationStatement -localVariableDeclaration -statement -statementNoShortIf -statementWithoutTrailingSubstatement -emptyStatement_ -labeledStatement -labeledStatementNoShortIf -expressionStatement -statementExpression -ifThenStatement -ifThenElseStatement -ifThenElseStatementNoShortIf -assertStatement -switchStatement -switchBlock -switchBlockStatementGroup -switchLabels -switchLabel -enumConstantName -whileStatement -whileStatementNoShortIf -doStatement -forStatement -forStatementNoShortIf -basicForStatement -basicForStatementNoShortIf -forInit -forUpdate -statementExpressionList -enhancedForStatement -enhancedForStatementNoShortIf -breakStatement -continueStatement -returnStatement -throwStatement -synchronizedStatement -tryStatement -catches -catchClause -catchFormalParameter -catchType -finally_ -tryWithResourcesStatement -resourceSpecification -resourceList -resource -primary -primaryNoNewArray -primaryNoNewArray_lf_arrayAccess -primaryNoNewArray_lfno_arrayAccess -primaryNoNewArray_lf_primary -primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary -primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary -primaryNoNewArray_lfno_primary -primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary -primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary -classInstanceCreationExpression -classInstanceCreationExpression_lf_primary -classInstanceCreationExpression_lfno_primary -typeArgumentsOrDiamond -fieldAccess -fieldAccess_lf_primary -fieldAccess_lfno_primary -arrayAccess -arrayAccess_lf_primary -arrayAccess_lfno_primary -methodInvocation -methodInvocation_lf_primary -methodInvocation_lfno_primary -argumentList -methodReference -methodReference_lf_primary -methodReference_lfno_primary -arrayCreationExpression -dimExprs -dimExpr -constantExpression -expression -lambdaExpression -lambdaParameters -inferredFormalParameterList -lambdaBody -assignmentExpression -assignment -leftHandSide -assignmentOperator -conditionalExpression -conditionalOrExpression -conditionalAndExpression -inclusiveOrExpression -exclusiveOrExpression -andExpression -equalityExpression -relationalExpression -shiftExpression -additiveExpression -multiplicativeExpression -unaryExpression -preIncrementExpression -preDecrementExpression -unaryExpressionNotPlusMinus -postfixExpression -postIncrementExpression -postIncrementExpression_lf_postfixExpression -postDecrementExpression -postDecrementExpression_lf_postfixExpression -castExpression - - -atn: -[4, 1, 107, 2843, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 2, 225, 7, 225, 2, 226, 7, 226, 2, 227, 7, 227, 2, 228, 7, 228, 2, 229, 7, 229, 2, 230, 7, 230, 2, 231, 7, 231, 2, 232, 7, 232, 2, 233, 7, 233, 2, 234, 7, 234, 2, 235, 7, 235, 1, 0, 1, 0, 1, 1, 5, 1, 476, 8, 1, 10, 1, 12, 1, 479, 9, 1, 1, 1, 1, 1, 5, 1, 483, 8, 1, 10, 1, 12, 1, 486, 9, 1, 1, 1, 3, 1, 489, 8, 1, 1, 2, 1, 2, 3, 2, 493, 8, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 3, 5, 502, 8, 5, 1, 6, 1, 6, 3, 6, 506, 8, 6, 1, 6, 1, 6, 5, 6, 510, 8, 6, 10, 6, 12, 6, 513, 9, 6, 1, 7, 5, 7, 516, 8, 7, 10, 7, 12, 7, 519, 9, 7, 1, 7, 1, 7, 3, 7, 523, 8, 7, 1, 7, 1, 7, 1, 7, 5, 7, 528, 8, 7, 10, 7, 12, 7, 531, 9, 7, 1, 7, 1, 7, 3, 7, 535, 8, 7, 3, 7, 537, 8, 7, 1, 8, 1, 8, 5, 8, 541, 8, 8, 10, 8, 12, 8, 544, 9, 8, 1, 8, 1, 8, 3, 8, 548, 8, 8, 1, 9, 5, 9, 551, 8, 9, 10, 9, 12, 9, 554, 9, 9, 1, 9, 1, 9, 3, 9, 558, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 5, 13, 567, 8, 13, 10, 13, 12, 13, 570, 9, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 583, 8, 14, 1, 15, 5, 15, 586, 8, 15, 10, 15, 12, 15, 589, 9, 15, 1, 15, 1, 15, 1, 15, 5, 15, 594, 8, 15, 10, 15, 12, 15, 597, 9, 15, 1, 15, 1, 15, 5, 15, 601, 8, 15, 10, 15, 12, 15, 604, 9, 15, 1, 16, 5, 16, 607, 8, 16, 10, 16, 12, 16, 610, 9, 16, 1, 16, 1, 16, 3, 16, 614, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 5, 18, 623, 8, 18, 10, 18, 12, 18, 626, 9, 18, 3, 18, 628, 8, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 640, 8, 21, 10, 21, 12, 21, 643, 9, 21, 1, 22, 1, 22, 3, 22, 647, 8, 22, 1, 23, 5, 23, 650, 8, 23, 10, 23, 12, 23, 653, 9, 23, 1, 23, 1, 23, 3, 23, 657, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 663, 8, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 671, 8, 25, 10, 25, 12, 25, 674, 9, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 681, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 5, 27, 689, 8, 27, 10, 27, 12, 27, 692, 9, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 699, 8, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 709, 8, 30, 10, 30, 12, 30, 712, 9, 30, 1, 31, 3, 31, 715, 8, 31, 1, 31, 5, 31, 718, 8, 31, 10, 31, 12, 31, 721, 9, 31, 1, 31, 5, 31, 724, 8, 31, 10, 31, 12, 31, 727, 9, 31, 1, 31, 1, 31, 1, 32, 5, 32, 732, 8, 32, 10, 32, 12, 32, 735, 9, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 747, 8, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 3, 39, 776, 8, 39, 1, 40, 1, 40, 3, 40, 780, 8, 40, 1, 41, 5, 41, 783, 8, 41, 10, 41, 12, 41, 786, 9, 41, 1, 41, 1, 41, 1, 41, 3, 41, 791, 8, 41, 1, 41, 3, 41, 794, 8, 41, 1, 41, 3, 41, 797, 8, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 3, 42, 809, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 5, 44, 818, 8, 44, 10, 44, 12, 44, 821, 9, 44, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 5, 47, 832, 8, 47, 10, 47, 12, 47, 835, 9, 47, 1, 48, 1, 48, 5, 48, 839, 8, 48, 10, 48, 12, 48, 842, 9, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 850, 8, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 3, 50, 857, 8, 50, 1, 51, 5, 51, 860, 8, 51, 10, 51, 12, 51, 863, 9, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 877, 8, 52, 1, 53, 1, 53, 1, 53, 5, 53, 882, 8, 53, 10, 53, 12, 53, 885, 9, 53, 1, 54, 1, 54, 1, 54, 3, 54, 890, 8, 54, 1, 55, 1, 55, 3, 55, 894, 8, 55, 1, 56, 1, 56, 3, 56, 898, 8, 56, 1, 57, 1, 57, 3, 57, 902, 8, 57, 1, 58, 1, 58, 3, 58, 906, 8, 58, 1, 59, 1, 59, 1, 59, 3, 59, 911, 8, 59, 1, 60, 1, 60, 3, 60, 915, 8, 60, 1, 60, 1, 60, 5, 60, 919, 8, 60, 10, 60, 12, 60, 922, 9, 60, 1, 61, 1, 61, 3, 61, 926, 8, 61, 1, 61, 1, 61, 1, 61, 5, 61, 931, 8, 61, 10, 61, 12, 61, 934, 9, 61, 1, 61, 1, 61, 3, 61, 938, 8, 61, 3, 61, 940, 8, 61, 1, 62, 1, 62, 5, 62, 944, 8, 62, 10, 62, 12, 62, 947, 9, 62, 1, 62, 1, 62, 3, 62, 951, 8, 62, 1, 63, 1, 63, 3, 63, 955, 8, 63, 1, 64, 1, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 974, 8, 68, 1, 69, 5, 69, 977, 8, 69, 10, 69, 12, 69, 980, 9, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 3, 70, 995, 8, 70, 1, 71, 1, 71, 1, 71, 3, 71, 1000, 8, 71, 1, 71, 1, 71, 5, 71, 1004, 8, 71, 10, 71, 12, 71, 1007, 9, 71, 1, 71, 1, 71, 1, 71, 3, 71, 1012, 8, 71, 3, 71, 1014, 8, 71, 1, 72, 1, 72, 3, 72, 1018, 8, 72, 1, 73, 1, 73, 1, 73, 3, 73, 1023, 8, 73, 1, 73, 1, 73, 3, 73, 1027, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1035, 8, 74, 1, 75, 1, 75, 1, 75, 5, 75, 1040, 8, 75, 10, 75, 12, 75, 1043, 9, 75, 1, 75, 1, 75, 1, 75, 5, 75, 1048, 8, 75, 10, 75, 12, 75, 1051, 9, 75, 3, 75, 1053, 8, 75, 1, 76, 5, 76, 1056, 8, 76, 10, 76, 12, 76, 1059, 9, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 3, 77, 1066, 8, 77, 1, 78, 5, 78, 1069, 8, 78, 10, 78, 12, 78, 1072, 9, 78, 1, 78, 1, 78, 5, 78, 1076, 8, 78, 10, 78, 12, 78, 1079, 9, 78, 1, 78, 1, 78, 1, 78, 1, 78, 3, 78, 1085, 8, 78, 1, 79, 5, 79, 1088, 8, 79, 10, 79, 12, 79, 1091, 9, 79, 1, 79, 1, 79, 1, 79, 3, 79, 1096, 8, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 5, 81, 1106, 8, 81, 10, 81, 12, 81, 1109, 9, 81, 1, 82, 1, 82, 3, 82, 1113, 8, 82, 1, 83, 1, 83, 3, 83, 1117, 8, 83, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 86, 5, 86, 1125, 8, 86, 10, 86, 12, 86, 1128, 9, 86, 1, 86, 1, 86, 3, 86, 1132, 8, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 3, 87, 1140, 8, 87, 1, 88, 3, 88, 1143, 8, 88, 1, 88, 1, 88, 1, 88, 3, 88, 1148, 8, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 90, 1, 90, 3, 90, 1156, 8, 90, 1, 90, 3, 90, 1159, 8, 90, 1, 90, 1, 90, 1, 91, 3, 91, 1164, 8, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1169, 8, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1174, 8, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1179, 8, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1186, 8, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1191, 8, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1199, 8, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1204, 8, 91, 1, 91, 1, 91, 1, 91, 3, 91, 1209, 8, 91, 1, 92, 5, 92, 1212, 8, 92, 10, 92, 12, 92, 1215, 9, 92, 1, 92, 1, 92, 1, 92, 3, 92, 1220, 8, 92, 1, 92, 1, 92, 1, 93, 1, 93, 3, 93, 1226, 8, 93, 1, 93, 3, 93, 1229, 8, 93, 1, 93, 3, 93, 1232, 8, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 5, 94, 1239, 8, 94, 10, 94, 12, 94, 1242, 9, 94, 1, 95, 5, 95, 1245, 8, 95, 10, 95, 12, 95, 1248, 9, 95, 1, 95, 1, 95, 1, 95, 3, 95, 1253, 8, 95, 1, 95, 3, 95, 1256, 8, 95, 1, 95, 3, 95, 1259, 8, 95, 1, 96, 1, 96, 1, 97, 1, 97, 5, 97, 1265, 8, 97, 10, 97, 12, 97, 1268, 9, 97, 1, 98, 1, 98, 3, 98, 1272, 8, 98, 1, 99, 5, 99, 1275, 8, 99, 10, 99, 12, 99, 1278, 9, 99, 1, 99, 1, 99, 1, 99, 3, 99, 1283, 8, 99, 1, 99, 3, 99, 1286, 8, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 3, 100, 1297, 8, 100, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 5, 102, 1304, 8, 102, 10, 102, 12, 102, 1307, 9, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 3, 103, 1316, 8, 103, 1, 104, 5, 104, 1319, 8, 104, 10, 104, 12, 104, 1322, 9, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1332, 8, 105, 1, 106, 5, 106, 1335, 8, 106, 10, 106, 12, 106, 1338, 9, 106, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 1349, 8, 107, 1, 108, 5, 108, 1352, 8, 108, 10, 108, 12, 108, 1355, 9, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 5, 109, 1364, 8, 109, 10, 109, 12, 109, 1367, 9, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 3, 110, 1376, 8, 110, 1, 111, 5, 111, 1379, 8, 111, 10, 111, 12, 111, 1382, 9, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 3, 111, 1389, 8, 111, 1, 111, 3, 111, 1392, 8, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 3, 112, 1399, 8, 112, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 3, 114, 1407, 8, 114, 1, 115, 1, 115, 1, 115, 1, 115, 3, 115, 1413, 8, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 5, 116, 1420, 8, 116, 10, 116, 12, 116, 1423, 9, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 3, 118, 1432, 8, 118, 1, 119, 1, 119, 3, 119, 1436, 8, 119, 1, 119, 3, 119, 1439, 8, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 5, 120, 1446, 8, 120, 10, 120, 12, 120, 1449, 9, 120, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 3, 123, 1462, 8, 123, 1, 123, 3, 123, 1465, 8, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 5, 124, 1472, 8, 124, 10, 124, 12, 124, 1475, 9, 124, 1, 125, 1, 125, 3, 125, 1479, 8, 125, 1, 125, 1, 125, 1, 126, 4, 126, 1484, 8, 126, 11, 126, 12, 126, 1485, 1, 127, 1, 127, 1, 127, 3, 127, 1491, 8, 127, 1, 128, 1, 128, 1, 128, 1, 129, 5, 129, 1497, 8, 129, 10, 129, 12, 129, 1500, 9, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 3, 130, 1511, 8, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 3, 131, 1518, 8, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 3, 132, 1532, 8, 132, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 1554, 8, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 3, 141, 1588, 8, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 5, 143, 1598, 8, 143, 10, 143, 12, 143, 1601, 9, 143, 1, 143, 5, 143, 1604, 8, 143, 10, 143, 12, 143, 1607, 9, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 5, 145, 1616, 8, 145, 10, 145, 12, 145, 1619, 9, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 3, 146, 1631, 8, 146, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 3, 151, 1657, 8, 151, 1, 152, 1, 152, 3, 152, 1661, 8, 152, 1, 153, 1, 153, 1, 153, 3, 153, 1666, 8, 153, 1, 153, 1, 153, 3, 153, 1670, 8, 153, 1, 153, 1, 153, 3, 153, 1674, 8, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 3, 154, 1682, 8, 154, 1, 154, 1, 154, 3, 154, 1686, 8, 154, 1, 154, 1, 154, 3, 154, 1690, 8, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 3, 155, 1697, 8, 155, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 5, 157, 1704, 8, 157, 10, 157, 12, 157, 1707, 9, 157, 1, 158, 1, 158, 1, 158, 5, 158, 1712, 8, 158, 10, 158, 12, 158, 1715, 9, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 5, 159, 1727, 8, 159, 10, 159, 12, 159, 1730, 9, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 3, 160, 1741, 8, 160, 1, 160, 1, 160, 1, 161, 1, 161, 3, 161, 1747, 8, 161, 1, 161, 1, 161, 1, 162, 1, 162, 3, 162, 1753, 8, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 3, 165, 1774, 8, 165, 1, 165, 1, 165, 1, 165, 3, 165, 1779, 8, 165, 1, 166, 1, 166, 5, 166, 1783, 8, 166, 10, 166, 12, 166, 1786, 9, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 5, 168, 1795, 8, 168, 10, 168, 12, 168, 1798, 9, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 5, 169, 1806, 8, 169, 10, 169, 12, 169, 1809, 9, 169, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 3, 171, 1818, 8, 171, 1, 171, 3, 171, 1821, 8, 171, 1, 172, 1, 172, 1, 172, 3, 172, 1826, 8, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 5, 173, 1833, 8, 173, 10, 173, 12, 173, 1836, 9, 173, 1, 174, 5, 174, 1839, 8, 174, 10, 174, 12, 174, 1842, 9, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 3, 175, 1851, 8, 175, 1, 175, 5, 175, 1854, 8, 175, 10, 175, 12, 175, 1857, 9, 175, 1, 176, 1, 176, 1, 176, 1, 176, 5, 176, 1863, 8, 176, 10, 176, 12, 176, 1866, 9, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 3, 176, 1888, 8, 176, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 5, 178, 1896, 8, 178, 10, 178, 12, 178, 1899, 9, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 3, 178, 1920, 8, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 3, 179, 1927, 8, 179, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 3, 181, 1935, 8, 181, 1, 182, 1, 182, 1, 182, 1, 182, 5, 182, 1941, 8, 182, 10, 182, 12, 182, 1944, 9, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 5, 182, 1952, 8, 182, 10, 182, 12, 182, 1955, 9, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 3, 182, 1977, 8, 182, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 5, 184, 1985, 8, 184, 10, 184, 12, 184, 1988, 9, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 5, 184, 1996, 8, 184, 10, 184, 12, 184, 1999, 9, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 3, 184, 2020, 8, 184, 1, 185, 1, 185, 3, 185, 2024, 8, 185, 1, 185, 5, 185, 2027, 8, 185, 10, 185, 12, 185, 2030, 9, 185, 1, 185, 1, 185, 1, 185, 5, 185, 2035, 8, 185, 10, 185, 12, 185, 2038, 9, 185, 1, 185, 5, 185, 2041, 8, 185, 10, 185, 12, 185, 2044, 9, 185, 1, 185, 3, 185, 2047, 8, 185, 1, 185, 1, 185, 3, 185, 2051, 8, 185, 1, 185, 1, 185, 3, 185, 2055, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 2061, 8, 185, 1, 185, 5, 185, 2064, 8, 185, 10, 185, 12, 185, 2067, 9, 185, 1, 185, 1, 185, 3, 185, 2071, 8, 185, 1, 185, 1, 185, 3, 185, 2075, 8, 185, 1, 185, 1, 185, 3, 185, 2079, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 2085, 8, 185, 1, 185, 5, 185, 2088, 8, 185, 10, 185, 12, 185, 2091, 9, 185, 1, 185, 1, 185, 3, 185, 2095, 8, 185, 1, 185, 1, 185, 3, 185, 2099, 8, 185, 1, 185, 1, 185, 3, 185, 2103, 8, 185, 3, 185, 2105, 8, 185, 1, 186, 1, 186, 1, 186, 3, 186, 2110, 8, 186, 1, 186, 5, 186, 2113, 8, 186, 10, 186, 12, 186, 2116, 9, 186, 1, 186, 1, 186, 3, 186, 2120, 8, 186, 1, 186, 1, 186, 3, 186, 2124, 8, 186, 1, 186, 1, 186, 3, 186, 2128, 8, 186, 1, 187, 1, 187, 3, 187, 2132, 8, 187, 1, 187, 5, 187, 2135, 8, 187, 10, 187, 12, 187, 2138, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 2143, 8, 187, 10, 187, 12, 187, 2146, 9, 187, 1, 187, 5, 187, 2149, 8, 187, 10, 187, 12, 187, 2152, 9, 187, 1, 187, 3, 187, 2155, 8, 187, 1, 187, 1, 187, 3, 187, 2159, 8, 187, 1, 187, 1, 187, 3, 187, 2163, 8, 187, 1, 187, 1, 187, 1, 187, 1, 187, 3, 187, 2169, 8, 187, 1, 187, 5, 187, 2172, 8, 187, 10, 187, 12, 187, 2175, 9, 187, 1, 187, 1, 187, 3, 187, 2179, 8, 187, 1, 187, 1, 187, 3, 187, 2183, 8, 187, 1, 187, 1, 187, 3, 187, 2187, 8, 187, 3, 187, 2189, 8, 187, 1, 188, 1, 188, 1, 188, 3, 188, 2194, 8, 188, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 3, 189, 2209, 8, 189, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 3, 191, 2223, 8, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 3, 192, 2235, 8, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 5, 192, 2242, 8, 192, 10, 192, 12, 192, 2245, 9, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 5, 193, 2256, 8, 193, 10, 193, 12, 193, 2259, 9, 193, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 3, 194, 2271, 8, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 5, 194, 2278, 8, 194, 10, 194, 12, 194, 2281, 9, 194, 1, 195, 1, 195, 1, 195, 3, 195, 2286, 8, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2293, 8, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2298, 8, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2305, 8, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2310, 8, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2317, 8, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2322, 8, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2329, 8, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2334, 8, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2342, 8, 195, 1, 195, 1, 195, 1, 195, 3, 195, 2347, 8, 195, 1, 195, 1, 195, 3, 195, 2351, 8, 195, 1, 196, 1, 196, 3, 196, 2355, 8, 196, 1, 196, 1, 196, 1, 196, 3, 196, 2360, 8, 196, 1, 196, 1, 196, 1, 197, 1, 197, 1, 197, 3, 197, 2367, 8, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2374, 8, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2379, 8, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2386, 8, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2391, 8, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2398, 8, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2403, 8, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2411, 8, 197, 1, 197, 1, 197, 1, 197, 3, 197, 2416, 8, 197, 1, 197, 1, 197, 3, 197, 2420, 8, 197, 1, 198, 1, 198, 1, 198, 5, 198, 2425, 8, 198, 10, 198, 12, 198, 2428, 9, 198, 1, 199, 1, 199, 1, 199, 3, 199, 2433, 8, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 3, 199, 2440, 8, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 3, 199, 2447, 8, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 3, 199, 2454, 8, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 3, 199, 2462, 8, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 3, 199, 2469, 8, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 3, 199, 2477, 8, 199, 1, 200, 1, 200, 3, 200, 2481, 8, 200, 1, 200, 1, 200, 1, 201, 1, 201, 1, 201, 3, 201, 2488, 8, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 3, 201, 2495, 8, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 3, 201, 2502, 8, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 3, 201, 2510, 8, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 3, 201, 2517, 8, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 3, 201, 2525, 8, 201, 1, 202, 1, 202, 1, 202, 1, 202, 3, 202, 2531, 8, 202, 1, 202, 1, 202, 1, 202, 1, 202, 3, 202, 2537, 8, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 3, 202, 2549, 8, 202, 1, 203, 1, 203, 5, 203, 2553, 8, 203, 10, 203, 12, 203, 2556, 9, 203, 1, 204, 5, 204, 2559, 8, 204, 10, 204, 12, 204, 2562, 9, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 3, 206, 2572, 8, 206, 1, 207, 1, 207, 1, 207, 1, 207, 1, 208, 1, 208, 1, 208, 3, 208, 2581, 8, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 3, 208, 2588, 8, 208, 1, 209, 1, 209, 1, 209, 5, 209, 2593, 8, 209, 10, 209, 12, 209, 2596, 9, 209, 1, 210, 1, 210, 3, 210, 2600, 8, 210, 1, 211, 1, 211, 3, 211, 2604, 8, 211, 1, 212, 1, 212, 1, 212, 1, 212, 1, 213, 1, 213, 1, 213, 3, 213, 2613, 8, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 3, 215, 2624, 8, 215, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 5, 216, 2632, 8, 216, 10, 216, 12, 216, 2635, 9, 216, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 5, 217, 2643, 8, 217, 10, 217, 12, 217, 2646, 9, 217, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 5, 218, 2654, 8, 218, 10, 218, 12, 218, 2657, 9, 218, 1, 219, 1, 219, 1, 219, 1, 219, 1, 219, 1, 219, 5, 219, 2665, 8, 219, 10, 219, 12, 219, 2668, 9, 219, 1, 220, 1, 220, 1, 220, 1, 220, 1, 220, 1, 220, 5, 220, 2676, 8, 220, 10, 220, 12, 220, 2679, 9, 220, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 5, 221, 2690, 8, 221, 10, 221, 12, 221, 2693, 9, 221, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 5, 222, 2713, 8, 222, 10, 222, 12, 222, 2716, 9, 222, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 5, 223, 2734, 8, 223, 10, 223, 12, 223, 2737, 9, 223, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 5, 224, 2748, 8, 224, 10, 224, 12, 224, 2751, 9, 224, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 5, 225, 2765, 8, 225, 10, 225, 12, 225, 2768, 9, 225, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 3, 226, 2777, 8, 226, 1, 227, 1, 227, 1, 227, 1, 228, 1, 228, 1, 228, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 3, 229, 2791, 8, 229, 1, 230, 1, 230, 3, 230, 2795, 8, 230, 1, 230, 1, 230, 5, 230, 2799, 8, 230, 10, 230, 12, 230, 2802, 9, 230, 1, 231, 1, 231, 1, 231, 1, 232, 1, 232, 1, 233, 1, 233, 1, 233, 1, 234, 1, 234, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 5, 235, 2822, 8, 235, 10, 235, 12, 235, 2825, 9, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 5, 235, 2833, 8, 235, 10, 235, 12, 235, 2836, 9, 235, 1, 235, 1, 235, 1, 235, 3, 235, 2841, 8, 235, 1, 235, 0, 13, 50, 54, 60, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 236, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 0, 4, 1, 0, 51, 56, 5, 0, 5, 5, 8, 8, 27, 27, 29, 29, 37, 37, 2, 0, 14, 14, 20, 20, 2, 0, 66, 66, 91, 101, 3084, 0, 472, 1, 0, 0, 0, 2, 488, 1, 0, 0, 0, 4, 492, 1, 0, 0, 0, 6, 494, 1, 0, 0, 0, 8, 496, 1, 0, 0, 0, 10, 501, 1, 0, 0, 0, 12, 505, 1, 0, 0, 0, 14, 536, 1, 0, 0, 0, 16, 538, 1, 0, 0, 0, 18, 552, 1, 0, 0, 0, 20, 559, 1, 0, 0, 0, 22, 561, 1, 0, 0, 0, 24, 563, 1, 0, 0, 0, 26, 568, 1, 0, 0, 0, 28, 582, 1, 0, 0, 0, 30, 587, 1, 0, 0, 0, 32, 608, 1, 0, 0, 0, 34, 615, 1, 0, 0, 0, 36, 627, 1, 0, 0, 0, 38, 629, 1, 0, 0, 0, 40, 632, 1, 0, 0, 0, 42, 636, 1, 0, 0, 0, 44, 646, 1, 0, 0, 0, 46, 651, 1, 0, 0, 0, 48, 662, 1, 0, 0, 0, 50, 664, 1, 0, 0, 0, 52, 680, 1, 0, 0, 0, 54, 682, 1, 0, 0, 0, 56, 698, 1, 0, 0, 0, 58, 700, 1, 0, 0, 0, 60, 702, 1, 0, 0, 0, 62, 714, 1, 0, 0, 0, 64, 733, 1, 0, 0, 0, 66, 740, 1, 0, 0, 0, 68, 746, 1, 0, 0, 0, 70, 748, 1, 0, 0, 0, 72, 752, 1, 0, 0, 0, 74, 758, 1, 0, 0, 0, 76, 765, 1, 0, 0, 0, 78, 775, 1, 0, 0, 0, 80, 779, 1, 0, 0, 0, 82, 784, 1, 0, 0, 0, 84, 808, 1, 0, 0, 0, 86, 810, 1, 0, 0, 0, 88, 814, 1, 0, 0, 0, 90, 822, 1, 0, 0, 0, 92, 825, 1, 0, 0, 0, 94, 828, 1, 0, 0, 0, 96, 836, 1, 0, 0, 0, 98, 849, 1, 0, 0, 0, 100, 856, 1, 0, 0, 0, 102, 861, 1, 0, 0, 0, 104, 876, 1, 0, 0, 0, 106, 878, 1, 0, 0, 0, 108, 886, 1, 0, 0, 0, 110, 891, 1, 0, 0, 0, 112, 897, 1, 0, 0, 0, 114, 901, 1, 0, 0, 0, 116, 905, 1, 0, 0, 0, 118, 910, 1, 0, 0, 0, 120, 914, 1, 0, 0, 0, 122, 939, 1, 0, 0, 0, 124, 941, 1, 0, 0, 0, 126, 952, 1, 0, 0, 0, 128, 956, 1, 0, 0, 0, 130, 958, 1, 0, 0, 0, 132, 960, 1, 0, 0, 0, 134, 962, 1, 0, 0, 0, 136, 973, 1, 0, 0, 0, 138, 978, 1, 0, 0, 0, 140, 994, 1, 0, 0, 0, 142, 1013, 1, 0, 0, 0, 144, 1017, 1, 0, 0, 0, 146, 1019, 1, 0, 0, 0, 148, 1034, 1, 0, 0, 0, 150, 1052, 1, 0, 0, 0, 152, 1057, 1, 0, 0, 0, 154, 1065, 1, 0, 0, 0, 156, 1084, 1, 0, 0, 0, 158, 1089, 1, 0, 0, 0, 160, 1099, 1, 0, 0, 0, 162, 1102, 1, 0, 0, 0, 164, 1112, 1, 0, 0, 0, 166, 1116, 1, 0, 0, 0, 168, 1118, 1, 0, 0, 0, 170, 1120, 1, 0, 0, 0, 172, 1126, 1, 0, 0, 0, 174, 1139, 1, 0, 0, 0, 176, 1142, 1, 0, 0, 0, 178, 1151, 1, 0, 0, 0, 180, 1153, 1, 0, 0, 0, 182, 1208, 1, 0, 0, 0, 184, 1213, 1, 0, 0, 0, 186, 1223, 1, 0, 0, 0, 188, 1235, 1, 0, 0, 0, 190, 1246, 1, 0, 0, 0, 192, 1260, 1, 0, 0, 0, 194, 1262, 1, 0, 0, 0, 196, 1271, 1, 0, 0, 0, 198, 1276, 1, 0, 0, 0, 200, 1296, 1, 0, 0, 0, 202, 1298, 1, 0, 0, 0, 204, 1301, 1, 0, 0, 0, 206, 1315, 1, 0, 0, 0, 208, 1320, 1, 0, 0, 0, 210, 1331, 1, 0, 0, 0, 212, 1336, 1, 0, 0, 0, 214, 1348, 1, 0, 0, 0, 216, 1353, 1, 0, 0, 0, 218, 1361, 1, 0, 0, 0, 220, 1375, 1, 0, 0, 0, 222, 1380, 1, 0, 0, 0, 224, 1398, 1, 0, 0, 0, 226, 1400, 1, 0, 0, 0, 228, 1406, 1, 0, 0, 0, 230, 1408, 1, 0, 0, 0, 232, 1416, 1, 0, 0, 0, 234, 1424, 1, 0, 0, 0, 236, 1431, 1, 0, 0, 0, 238, 1433, 1, 0, 0, 0, 240, 1442, 1, 0, 0, 0, 242, 1450, 1, 0, 0, 0, 244, 1453, 1, 0, 0, 0, 246, 1459, 1, 0, 0, 0, 248, 1468, 1, 0, 0, 0, 250, 1476, 1, 0, 0, 0, 252, 1483, 1, 0, 0, 0, 254, 1490, 1, 0, 0, 0, 256, 1492, 1, 0, 0, 0, 258, 1498, 1, 0, 0, 0, 260, 1510, 1, 0, 0, 0, 262, 1517, 1, 0, 0, 0, 264, 1531, 1, 0, 0, 0, 266, 1533, 1, 0, 0, 0, 268, 1535, 1, 0, 0, 0, 270, 1539, 1, 0, 0, 0, 272, 1543, 1, 0, 0, 0, 274, 1553, 1, 0, 0, 0, 276, 1555, 1, 0, 0, 0, 278, 1561, 1, 0, 0, 0, 280, 1569, 1, 0, 0, 0, 282, 1587, 1, 0, 0, 0, 284, 1589, 1, 0, 0, 0, 286, 1595, 1, 0, 0, 0, 288, 1610, 1, 0, 0, 0, 290, 1613, 1, 0, 0, 0, 292, 1630, 1, 0, 0, 0, 294, 1632, 1, 0, 0, 0, 296, 1634, 1, 0, 0, 0, 298, 1640, 1, 0, 0, 0, 300, 1646, 1, 0, 0, 0, 302, 1656, 1, 0, 0, 0, 304, 1660, 1, 0, 0, 0, 306, 1662, 1, 0, 0, 0, 308, 1678, 1, 0, 0, 0, 310, 1696, 1, 0, 0, 0, 312, 1698, 1, 0, 0, 0, 314, 1700, 1, 0, 0, 0, 316, 1708, 1, 0, 0, 0, 318, 1723, 1, 0, 0, 0, 320, 1738, 1, 0, 0, 0, 322, 1744, 1, 0, 0, 0, 324, 1750, 1, 0, 0, 0, 326, 1756, 1, 0, 0, 0, 328, 1760, 1, 0, 0, 0, 330, 1778, 1, 0, 0, 0, 332, 1780, 1, 0, 0, 0, 334, 1787, 1, 0, 0, 0, 336, 1796, 1, 0, 0, 0, 338, 1802, 1, 0, 0, 0, 340, 1810, 1, 0, 0, 0, 342, 1813, 1, 0, 0, 0, 344, 1822, 1, 0, 0, 0, 346, 1829, 1, 0, 0, 0, 348, 1840, 1, 0, 0, 0, 350, 1850, 1, 0, 0, 0, 352, 1887, 1, 0, 0, 0, 354, 1889, 1, 0, 0, 0, 356, 1919, 1, 0, 0, 0, 358, 1926, 1, 0, 0, 0, 360, 1928, 1, 0, 0, 0, 362, 1934, 1, 0, 0, 0, 364, 1976, 1, 0, 0, 0, 366, 1978, 1, 0, 0, 0, 368, 2019, 1, 0, 0, 0, 370, 2104, 1, 0, 0, 0, 372, 2106, 1, 0, 0, 0, 374, 2188, 1, 0, 0, 0, 376, 2193, 1, 0, 0, 0, 378, 2208, 1, 0, 0, 0, 380, 2210, 1, 0, 0, 0, 382, 2222, 1, 0, 0, 0, 384, 2234, 1, 0, 0, 0, 386, 2246, 1, 0, 0, 0, 388, 2270, 1, 0, 0, 0, 390, 2350, 1, 0, 0, 0, 392, 2352, 1, 0, 0, 0, 394, 2419, 1, 0, 0, 0, 396, 2421, 1, 0, 0, 0, 398, 2476, 1, 0, 0, 0, 400, 2478, 1, 0, 0, 0, 402, 2524, 1, 0, 0, 0, 404, 2548, 1, 0, 0, 0, 406, 2550, 1, 0, 0, 0, 408, 2560, 1, 0, 0, 0, 410, 2567, 1, 0, 0, 0, 412, 2571, 1, 0, 0, 0, 414, 2573, 1, 0, 0, 0, 416, 2587, 1, 0, 0, 0, 418, 2589, 1, 0, 0, 0, 420, 2599, 1, 0, 0, 0, 422, 2603, 1, 0, 0, 0, 424, 2605, 1, 0, 0, 0, 426, 2612, 1, 0, 0, 0, 428, 2614, 1, 0, 0, 0, 430, 2623, 1, 0, 0, 0, 432, 2625, 1, 0, 0, 0, 434, 2636, 1, 0, 0, 0, 436, 2647, 1, 0, 0, 0, 438, 2658, 1, 0, 0, 0, 440, 2669, 1, 0, 0, 0, 442, 2680, 1, 0, 0, 0, 444, 2694, 1, 0, 0, 0, 446, 2717, 1, 0, 0, 0, 448, 2738, 1, 0, 0, 0, 450, 2752, 1, 0, 0, 0, 452, 2776, 1, 0, 0, 0, 454, 2778, 1, 0, 0, 0, 456, 2781, 1, 0, 0, 0, 458, 2790, 1, 0, 0, 0, 460, 2794, 1, 0, 0, 0, 462, 2803, 1, 0, 0, 0, 464, 2806, 1, 0, 0, 0, 466, 2808, 1, 0, 0, 0, 468, 2811, 1, 0, 0, 0, 470, 2840, 1, 0, 0, 0, 472, 473, 7, 0, 0, 0, 473, 1, 1, 0, 0, 0, 474, 476, 3, 228, 114, 0, 475, 474, 1, 0, 0, 0, 476, 479, 1, 0, 0, 0, 477, 475, 1, 0, 0, 0, 477, 478, 1, 0, 0, 0, 478, 480, 1, 0, 0, 0, 479, 477, 1, 0, 0, 0, 480, 489, 3, 4, 2, 0, 481, 483, 3, 228, 114, 0, 482, 481, 1, 0, 0, 0, 483, 486, 1, 0, 0, 0, 484, 482, 1, 0, 0, 0, 484, 485, 1, 0, 0, 0, 485, 487, 1, 0, 0, 0, 486, 484, 1, 0, 0, 0, 487, 489, 5, 3, 0, 0, 488, 477, 1, 0, 0, 0, 488, 484, 1, 0, 0, 0, 489, 3, 1, 0, 0, 0, 490, 493, 3, 6, 3, 0, 491, 493, 3, 8, 4, 0, 492, 490, 1, 0, 0, 0, 492, 491, 1, 0, 0, 0, 493, 5, 1, 0, 0, 0, 494, 495, 7, 1, 0, 0, 495, 7, 1, 0, 0, 0, 496, 497, 7, 2, 0, 0, 497, 9, 1, 0, 0, 0, 498, 502, 3, 12, 6, 0, 499, 502, 3, 26, 13, 0, 500, 502, 3, 28, 14, 0, 501, 498, 1, 0, 0, 0, 501, 499, 1, 0, 0, 0, 501, 500, 1, 0, 0, 0, 502, 11, 1, 0, 0, 0, 503, 506, 3, 18, 9, 0, 504, 506, 3, 24, 12, 0, 505, 503, 1, 0, 0, 0, 505, 504, 1, 0, 0, 0, 506, 511, 1, 0, 0, 0, 507, 510, 3, 16, 8, 0, 508, 510, 3, 22, 11, 0, 509, 507, 1, 0, 0, 0, 509, 508, 1, 0, 0, 0, 510, 513, 1, 0, 0, 0, 511, 509, 1, 0, 0, 0, 511, 512, 1, 0, 0, 0, 512, 13, 1, 0, 0, 0, 513, 511, 1, 0, 0, 0, 514, 516, 3, 228, 114, 0, 515, 514, 1, 0, 0, 0, 516, 519, 1, 0, 0, 0, 517, 515, 1, 0, 0, 0, 517, 518, 1, 0, 0, 0, 518, 520, 1, 0, 0, 0, 519, 517, 1, 0, 0, 0, 520, 522, 5, 102, 0, 0, 521, 523, 3, 40, 20, 0, 522, 521, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 537, 1, 0, 0, 0, 524, 525, 3, 12, 6, 0, 525, 529, 5, 65, 0, 0, 526, 528, 3, 228, 114, 0, 527, 526, 1, 0, 0, 0, 528, 531, 1, 0, 0, 0, 529, 527, 1, 0, 0, 0, 529, 530, 1, 0, 0, 0, 530, 532, 1, 0, 0, 0, 531, 529, 1, 0, 0, 0, 532, 534, 5, 102, 0, 0, 533, 535, 3, 40, 20, 0, 534, 533, 1, 0, 0, 0, 534, 535, 1, 0, 0, 0, 535, 537, 1, 0, 0, 0, 536, 517, 1, 0, 0, 0, 536, 524, 1, 0, 0, 0, 537, 15, 1, 0, 0, 0, 538, 542, 5, 65, 0, 0, 539, 541, 3, 228, 114, 0, 540, 539, 1, 0, 0, 0, 541, 544, 1, 0, 0, 0, 542, 540, 1, 0, 0, 0, 542, 543, 1, 0, 0, 0, 543, 545, 1, 0, 0, 0, 544, 542, 1, 0, 0, 0, 545, 547, 5, 102, 0, 0, 546, 548, 3, 40, 20, 0, 547, 546, 1, 0, 0, 0, 547, 548, 1, 0, 0, 0, 548, 17, 1, 0, 0, 0, 549, 551, 3, 228, 114, 0, 550, 549, 1, 0, 0, 0, 551, 554, 1, 0, 0, 0, 552, 550, 1, 0, 0, 0, 552, 553, 1, 0, 0, 0, 553, 555, 1, 0, 0, 0, 554, 552, 1, 0, 0, 0, 555, 557, 5, 102, 0, 0, 556, 558, 3, 40, 20, 0, 557, 556, 1, 0, 0, 0, 557, 558, 1, 0, 0, 0, 558, 19, 1, 0, 0, 0, 559, 560, 3, 14, 7, 0, 560, 21, 1, 0, 0, 0, 561, 562, 3, 16, 8, 0, 562, 23, 1, 0, 0, 0, 563, 564, 3, 18, 9, 0, 564, 25, 1, 0, 0, 0, 565, 567, 3, 228, 114, 0, 566, 565, 1, 0, 0, 0, 567, 570, 1, 0, 0, 0, 568, 566, 1, 0, 0, 0, 568, 569, 1, 0, 0, 0, 569, 571, 1, 0, 0, 0, 570, 568, 1, 0, 0, 0, 571, 572, 5, 102, 0, 0, 572, 27, 1, 0, 0, 0, 573, 574, 3, 2, 1, 0, 574, 575, 3, 30, 15, 0, 575, 583, 1, 0, 0, 0, 576, 577, 3, 12, 6, 0, 577, 578, 3, 30, 15, 0, 578, 583, 1, 0, 0, 0, 579, 580, 3, 26, 13, 0, 580, 581, 3, 30, 15, 0, 581, 583, 1, 0, 0, 0, 582, 573, 1, 0, 0, 0, 582, 576, 1, 0, 0, 0, 582, 579, 1, 0, 0, 0, 583, 29, 1, 0, 0, 0, 584, 586, 3, 228, 114, 0, 585, 584, 1, 0, 0, 0, 586, 589, 1, 0, 0, 0, 587, 585, 1, 0, 0, 0, 587, 588, 1, 0, 0, 0, 588, 590, 1, 0, 0, 0, 589, 587, 1, 0, 0, 0, 590, 591, 5, 61, 0, 0, 591, 602, 5, 62, 0, 0, 592, 594, 3, 228, 114, 0, 593, 592, 1, 0, 0, 0, 594, 597, 1, 0, 0, 0, 595, 593, 1, 0, 0, 0, 595, 596, 1, 0, 0, 0, 596, 598, 1, 0, 0, 0, 597, 595, 1, 0, 0, 0, 598, 599, 5, 61, 0, 0, 599, 601, 5, 62, 0, 0, 600, 595, 1, 0, 0, 0, 601, 604, 1, 0, 0, 0, 602, 600, 1, 0, 0, 0, 602, 603, 1, 0, 0, 0, 603, 31, 1, 0, 0, 0, 604, 602, 1, 0, 0, 0, 605, 607, 3, 34, 17, 0, 606, 605, 1, 0, 0, 0, 607, 610, 1, 0, 0, 0, 608, 606, 1, 0, 0, 0, 608, 609, 1, 0, 0, 0, 609, 611, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 611, 613, 5, 102, 0, 0, 612, 614, 3, 36, 18, 0, 613, 612, 1, 0, 0, 0, 613, 614, 1, 0, 0, 0, 614, 33, 1, 0, 0, 0, 615, 616, 3, 228, 114, 0, 616, 35, 1, 0, 0, 0, 617, 618, 5, 17, 0, 0, 618, 628, 3, 26, 13, 0, 619, 620, 5, 17, 0, 0, 620, 624, 3, 12, 6, 0, 621, 623, 3, 38, 19, 0, 622, 621, 1, 0, 0, 0, 623, 626, 1, 0, 0, 0, 624, 622, 1, 0, 0, 0, 624, 625, 1, 0, 0, 0, 625, 628, 1, 0, 0, 0, 626, 624, 1, 0, 0, 0, 627, 617, 1, 0, 0, 0, 627, 619, 1, 0, 0, 0, 628, 37, 1, 0, 0, 0, 629, 630, 5, 85, 0, 0, 630, 631, 3, 20, 10, 0, 631, 39, 1, 0, 0, 0, 632, 633, 5, 68, 0, 0, 633, 634, 3, 42, 21, 0, 634, 635, 5, 67, 0, 0, 635, 41, 1, 0, 0, 0, 636, 641, 3, 44, 22, 0, 637, 638, 5, 64, 0, 0, 638, 640, 3, 44, 22, 0, 639, 637, 1, 0, 0, 0, 640, 643, 1, 0, 0, 0, 641, 639, 1, 0, 0, 0, 641, 642, 1, 0, 0, 0, 642, 43, 1, 0, 0, 0, 643, 641, 1, 0, 0, 0, 644, 647, 3, 10, 5, 0, 645, 647, 3, 46, 23, 0, 646, 644, 1, 0, 0, 0, 646, 645, 1, 0, 0, 0, 647, 45, 1, 0, 0, 0, 648, 650, 3, 228, 114, 0, 649, 648, 1, 0, 0, 0, 650, 653, 1, 0, 0, 0, 651, 649, 1, 0, 0, 0, 651, 652, 1, 0, 0, 0, 652, 654, 1, 0, 0, 0, 653, 651, 1, 0, 0, 0, 654, 656, 5, 71, 0, 0, 655, 657, 3, 48, 24, 0, 656, 655, 1, 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 47, 1, 0, 0, 0, 658, 659, 5, 17, 0, 0, 659, 663, 3, 10, 5, 0, 660, 661, 5, 40, 0, 0, 661, 663, 3, 10, 5, 0, 662, 658, 1, 0, 0, 0, 662, 660, 1, 0, 0, 0, 663, 49, 1, 0, 0, 0, 664, 665, 6, 25, -1, 0, 665, 666, 5, 102, 0, 0, 666, 672, 1, 0, 0, 0, 667, 668, 10, 1, 0, 0, 668, 669, 5, 65, 0, 0, 669, 671, 5, 102, 0, 0, 670, 667, 1, 0, 0, 0, 671, 674, 1, 0, 0, 0, 672, 670, 1, 0, 0, 0, 672, 673, 1, 0, 0, 0, 673, 51, 1, 0, 0, 0, 674, 672, 1, 0, 0, 0, 675, 681, 5, 102, 0, 0, 676, 677, 3, 54, 27, 0, 677, 678, 5, 65, 0, 0, 678, 679, 5, 102, 0, 0, 679, 681, 1, 0, 0, 0, 680, 675, 1, 0, 0, 0, 680, 676, 1, 0, 0, 0, 681, 53, 1, 0, 0, 0, 682, 683, 6, 27, -1, 0, 683, 684, 5, 102, 0, 0, 684, 690, 1, 0, 0, 0, 685, 686, 10, 1, 0, 0, 686, 687, 5, 65, 0, 0, 687, 689, 5, 102, 0, 0, 688, 685, 1, 0, 0, 0, 689, 692, 1, 0, 0, 0, 690, 688, 1, 0, 0, 0, 690, 691, 1, 0, 0, 0, 691, 55, 1, 0, 0, 0, 692, 690, 1, 0, 0, 0, 693, 699, 5, 102, 0, 0, 694, 695, 3, 60, 30, 0, 695, 696, 5, 65, 0, 0, 696, 697, 5, 102, 0, 0, 697, 699, 1, 0, 0, 0, 698, 693, 1, 0, 0, 0, 698, 694, 1, 0, 0, 0, 699, 57, 1, 0, 0, 0, 700, 701, 5, 102, 0, 0, 701, 59, 1, 0, 0, 0, 702, 703, 6, 30, -1, 0, 703, 704, 5, 102, 0, 0, 704, 710, 1, 0, 0, 0, 705, 706, 10, 1, 0, 0, 706, 707, 5, 65, 0, 0, 707, 709, 5, 102, 0, 0, 708, 705, 1, 0, 0, 0, 709, 712, 1, 0, 0, 0, 710, 708, 1, 0, 0, 0, 710, 711, 1, 0, 0, 0, 711, 61, 1, 0, 0, 0, 712, 710, 1, 0, 0, 0, 713, 715, 3, 64, 32, 0, 714, 713, 1, 0, 0, 0, 714, 715, 1, 0, 0, 0, 715, 719, 1, 0, 0, 0, 716, 718, 3, 68, 34, 0, 717, 716, 1, 0, 0, 0, 718, 721, 1, 0, 0, 0, 719, 717, 1, 0, 0, 0, 719, 720, 1, 0, 0, 0, 720, 725, 1, 0, 0, 0, 721, 719, 1, 0, 0, 0, 722, 724, 3, 78, 39, 0, 723, 722, 1, 0, 0, 0, 724, 727, 1, 0, 0, 0, 725, 723, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 728, 1, 0, 0, 0, 727, 725, 1, 0, 0, 0, 728, 729, 5, 0, 0, 1, 729, 63, 1, 0, 0, 0, 730, 732, 3, 66, 33, 0, 731, 730, 1, 0, 0, 0, 732, 735, 1, 0, 0, 0, 733, 731, 1, 0, 0, 0, 733, 734, 1, 0, 0, 0, 734, 736, 1, 0, 0, 0, 735, 733, 1, 0, 0, 0, 736, 737, 5, 32, 0, 0, 737, 738, 3, 50, 25, 0, 738, 739, 5, 63, 0, 0, 739, 65, 1, 0, 0, 0, 740, 741, 3, 228, 114, 0, 741, 67, 1, 0, 0, 0, 742, 747, 3, 70, 35, 0, 743, 747, 3, 72, 36, 0, 744, 747, 3, 74, 37, 0, 745, 747, 3, 76, 38, 0, 746, 742, 1, 0, 0, 0, 746, 743, 1, 0, 0, 0, 746, 744, 1, 0, 0, 0, 746, 745, 1, 0, 0, 0, 747, 69, 1, 0, 0, 0, 748, 749, 5, 25, 0, 0, 749, 750, 3, 52, 26, 0, 750, 751, 5, 63, 0, 0, 751, 71, 1, 0, 0, 0, 752, 753, 5, 25, 0, 0, 753, 754, 3, 54, 27, 0, 754, 755, 5, 65, 0, 0, 755, 756, 5, 83, 0, 0, 756, 757, 5, 63, 0, 0, 757, 73, 1, 0, 0, 0, 758, 759, 5, 25, 0, 0, 759, 760, 5, 38, 0, 0, 760, 761, 3, 52, 26, 0, 761, 762, 5, 65, 0, 0, 762, 763, 5, 102, 0, 0, 763, 764, 5, 63, 0, 0, 764, 75, 1, 0, 0, 0, 765, 766, 5, 25, 0, 0, 766, 767, 5, 38, 0, 0, 767, 768, 3, 52, 26, 0, 768, 769, 5, 65, 0, 0, 769, 770, 5, 83, 0, 0, 770, 771, 5, 63, 0, 0, 771, 77, 1, 0, 0, 0, 772, 776, 3, 80, 40, 0, 773, 776, 3, 196, 98, 0, 774, 776, 5, 63, 0, 0, 775, 772, 1, 0, 0, 0, 775, 773, 1, 0, 0, 0, 775, 774, 1, 0, 0, 0, 776, 79, 1, 0, 0, 0, 777, 780, 3, 82, 41, 0, 778, 780, 3, 184, 92, 0, 779, 777, 1, 0, 0, 0, 779, 778, 1, 0, 0, 0, 780, 81, 1, 0, 0, 0, 781, 783, 3, 84, 42, 0, 782, 781, 1, 0, 0, 0, 783, 786, 1, 0, 0, 0, 784, 782, 1, 0, 0, 0, 784, 785, 1, 0, 0, 0, 785, 787, 1, 0, 0, 0, 786, 784, 1, 0, 0, 0, 787, 788, 5, 9, 0, 0, 788, 790, 5, 102, 0, 0, 789, 791, 3, 86, 43, 0, 790, 789, 1, 0, 0, 0, 790, 791, 1, 0, 0, 0, 791, 793, 1, 0, 0, 0, 792, 794, 3, 90, 45, 0, 793, 792, 1, 0, 0, 0, 793, 794, 1, 0, 0, 0, 794, 796, 1, 0, 0, 0, 795, 797, 3, 92, 46, 0, 796, 795, 1, 0, 0, 0, 796, 797, 1, 0, 0, 0, 797, 798, 1, 0, 0, 0, 798, 799, 3, 96, 48, 0, 799, 83, 1, 0, 0, 0, 800, 809, 3, 228, 114, 0, 801, 809, 5, 35, 0, 0, 802, 809, 5, 34, 0, 0, 803, 809, 5, 33, 0, 0, 804, 809, 5, 1, 0, 0, 805, 809, 5, 38, 0, 0, 806, 809, 5, 18, 0, 0, 807, 809, 5, 39, 0, 0, 808, 800, 1, 0, 0, 0, 808, 801, 1, 0, 0, 0, 808, 802, 1, 0, 0, 0, 808, 803, 1, 0, 0, 0, 808, 804, 1, 0, 0, 0, 808, 805, 1, 0, 0, 0, 808, 806, 1, 0, 0, 0, 808, 807, 1, 0, 0, 0, 809, 85, 1, 0, 0, 0, 810, 811, 5, 68, 0, 0, 811, 812, 3, 88, 44, 0, 812, 813, 5, 67, 0, 0, 813, 87, 1, 0, 0, 0, 814, 819, 3, 32, 16, 0, 815, 816, 5, 64, 0, 0, 816, 818, 3, 32, 16, 0, 817, 815, 1, 0, 0, 0, 818, 821, 1, 0, 0, 0, 819, 817, 1, 0, 0, 0, 819, 820, 1, 0, 0, 0, 820, 89, 1, 0, 0, 0, 821, 819, 1, 0, 0, 0, 822, 823, 5, 17, 0, 0, 823, 824, 3, 14, 7, 0, 824, 91, 1, 0, 0, 0, 825, 826, 5, 24, 0, 0, 826, 827, 3, 94, 47, 0, 827, 93, 1, 0, 0, 0, 828, 833, 3, 20, 10, 0, 829, 830, 5, 64, 0, 0, 830, 832, 3, 20, 10, 0, 831, 829, 1, 0, 0, 0, 832, 835, 1, 0, 0, 0, 833, 831, 1, 0, 0, 0, 833, 834, 1, 0, 0, 0, 834, 95, 1, 0, 0, 0, 835, 833, 1, 0, 0, 0, 836, 840, 5, 59, 0, 0, 837, 839, 3, 98, 49, 0, 838, 837, 1, 0, 0, 0, 839, 842, 1, 0, 0, 0, 840, 838, 1, 0, 0, 0, 840, 841, 1, 0, 0, 0, 841, 843, 1, 0, 0, 0, 842, 840, 1, 0, 0, 0, 843, 844, 5, 60, 0, 0, 844, 97, 1, 0, 0, 0, 845, 850, 3, 100, 50, 0, 846, 850, 3, 168, 84, 0, 847, 850, 3, 170, 85, 0, 848, 850, 3, 172, 86, 0, 849, 845, 1, 0, 0, 0, 849, 846, 1, 0, 0, 0, 849, 847, 1, 0, 0, 0, 849, 848, 1, 0, 0, 0, 850, 99, 1, 0, 0, 0, 851, 857, 3, 102, 51, 0, 852, 857, 3, 138, 69, 0, 853, 857, 3, 80, 40, 0, 854, 857, 3, 196, 98, 0, 855, 857, 5, 63, 0, 0, 856, 851, 1, 0, 0, 0, 856, 852, 1, 0, 0, 0, 856, 853, 1, 0, 0, 0, 856, 854, 1, 0, 0, 0, 856, 855, 1, 0, 0, 0, 857, 101, 1, 0, 0, 0, 858, 860, 3, 104, 52, 0, 859, 858, 1, 0, 0, 0, 860, 863, 1, 0, 0, 0, 861, 859, 1, 0, 0, 0, 861, 862, 1, 0, 0, 0, 862, 864, 1, 0, 0, 0, 863, 861, 1, 0, 0, 0, 864, 865, 3, 114, 57, 0, 865, 866, 3, 106, 53, 0, 866, 867, 5, 63, 0, 0, 867, 103, 1, 0, 0, 0, 868, 877, 3, 228, 114, 0, 869, 877, 5, 35, 0, 0, 870, 877, 5, 34, 0, 0, 871, 877, 5, 33, 0, 0, 872, 877, 5, 38, 0, 0, 873, 877, 5, 18, 0, 0, 874, 877, 5, 46, 0, 0, 875, 877, 5, 49, 0, 0, 876, 868, 1, 0, 0, 0, 876, 869, 1, 0, 0, 0, 876, 870, 1, 0, 0, 0, 876, 871, 1, 0, 0, 0, 876, 872, 1, 0, 0, 0, 876, 873, 1, 0, 0, 0, 876, 874, 1, 0, 0, 0, 876, 875, 1, 0, 0, 0, 877, 105, 1, 0, 0, 0, 878, 883, 3, 108, 54, 0, 879, 880, 5, 64, 0, 0, 880, 882, 3, 108, 54, 0, 881, 879, 1, 0, 0, 0, 882, 885, 1, 0, 0, 0, 883, 881, 1, 0, 0, 0, 883, 884, 1, 0, 0, 0, 884, 107, 1, 0, 0, 0, 885, 883, 1, 0, 0, 0, 886, 889, 3, 110, 55, 0, 887, 888, 5, 66, 0, 0, 888, 890, 3, 112, 56, 0, 889, 887, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 109, 1, 0, 0, 0, 891, 893, 5, 102, 0, 0, 892, 894, 3, 30, 15, 0, 893, 892, 1, 0, 0, 0, 893, 894, 1, 0, 0, 0, 894, 111, 1, 0, 0, 0, 895, 898, 3, 412, 206, 0, 896, 898, 3, 246, 123, 0, 897, 895, 1, 0, 0, 0, 897, 896, 1, 0, 0, 0, 898, 113, 1, 0, 0, 0, 899, 902, 3, 116, 58, 0, 900, 902, 3, 118, 59, 0, 901, 899, 1, 0, 0, 0, 901, 900, 1, 0, 0, 0, 902, 115, 1, 0, 0, 0, 903, 906, 3, 4, 2, 0, 904, 906, 5, 3, 0, 0, 905, 903, 1, 0, 0, 0, 905, 904, 1, 0, 0, 0, 906, 117, 1, 0, 0, 0, 907, 911, 3, 120, 60, 0, 908, 911, 3, 134, 67, 0, 909, 911, 3, 136, 68, 0, 910, 907, 1, 0, 0, 0, 910, 908, 1, 0, 0, 0, 910, 909, 1, 0, 0, 0, 911, 119, 1, 0, 0, 0, 912, 915, 3, 126, 63, 0, 913, 915, 3, 132, 66, 0, 914, 912, 1, 0, 0, 0, 914, 913, 1, 0, 0, 0, 915, 920, 1, 0, 0, 0, 916, 919, 3, 124, 62, 0, 917, 919, 3, 130, 65, 0, 918, 916, 1, 0, 0, 0, 918, 917, 1, 0, 0, 0, 919, 922, 1, 0, 0, 0, 920, 918, 1, 0, 0, 0, 920, 921, 1, 0, 0, 0, 921, 121, 1, 0, 0, 0, 922, 920, 1, 0, 0, 0, 923, 925, 5, 102, 0, 0, 924, 926, 3, 40, 20, 0, 925, 924, 1, 0, 0, 0, 925, 926, 1, 0, 0, 0, 926, 940, 1, 0, 0, 0, 927, 928, 3, 120, 60, 0, 928, 932, 5, 65, 0, 0, 929, 931, 3, 228, 114, 0, 930, 929, 1, 0, 0, 0, 931, 934, 1, 0, 0, 0, 932, 930, 1, 0, 0, 0, 932, 933, 1, 0, 0, 0, 933, 935, 1, 0, 0, 0, 934, 932, 1, 0, 0, 0, 935, 937, 5, 102, 0, 0, 936, 938, 3, 40, 20, 0, 937, 936, 1, 0, 0, 0, 937, 938, 1, 0, 0, 0, 938, 940, 1, 0, 0, 0, 939, 923, 1, 0, 0, 0, 939, 927, 1, 0, 0, 0, 940, 123, 1, 0, 0, 0, 941, 945, 5, 65, 0, 0, 942, 944, 3, 228, 114, 0, 943, 942, 1, 0, 0, 0, 944, 947, 1, 0, 0, 0, 945, 943, 1, 0, 0, 0, 945, 946, 1, 0, 0, 0, 946, 948, 1, 0, 0, 0, 947, 945, 1, 0, 0, 0, 948, 950, 5, 102, 0, 0, 949, 951, 3, 40, 20, 0, 950, 949, 1, 0, 0, 0, 950, 951, 1, 0, 0, 0, 951, 125, 1, 0, 0, 0, 952, 954, 5, 102, 0, 0, 953, 955, 3, 40, 20, 0, 954, 953, 1, 0, 0, 0, 954, 955, 1, 0, 0, 0, 955, 127, 1, 0, 0, 0, 956, 957, 3, 122, 61, 0, 957, 129, 1, 0, 0, 0, 958, 959, 3, 124, 62, 0, 959, 131, 1, 0, 0, 0, 960, 961, 3, 126, 63, 0, 961, 133, 1, 0, 0, 0, 962, 963, 5, 102, 0, 0, 963, 135, 1, 0, 0, 0, 964, 965, 3, 116, 58, 0, 965, 966, 3, 30, 15, 0, 966, 974, 1, 0, 0, 0, 967, 968, 3, 120, 60, 0, 968, 969, 3, 30, 15, 0, 969, 974, 1, 0, 0, 0, 970, 971, 3, 134, 67, 0, 971, 972, 3, 30, 15, 0, 972, 974, 1, 0, 0, 0, 973, 964, 1, 0, 0, 0, 973, 967, 1, 0, 0, 0, 973, 970, 1, 0, 0, 0, 974, 137, 1, 0, 0, 0, 975, 977, 3, 140, 70, 0, 976, 975, 1, 0, 0, 0, 977, 980, 1, 0, 0, 0, 978, 976, 1, 0, 0, 0, 978, 979, 1, 0, 0, 0, 979, 981, 1, 0, 0, 0, 980, 978, 1, 0, 0, 0, 981, 982, 3, 142, 71, 0, 982, 983, 3, 166, 83, 0, 983, 139, 1, 0, 0, 0, 984, 995, 3, 228, 114, 0, 985, 995, 5, 35, 0, 0, 986, 995, 5, 34, 0, 0, 987, 995, 5, 33, 0, 0, 988, 995, 5, 1, 0, 0, 989, 995, 5, 38, 0, 0, 990, 995, 5, 18, 0, 0, 991, 995, 5, 42, 0, 0, 992, 995, 5, 30, 0, 0, 993, 995, 5, 39, 0, 0, 994, 984, 1, 0, 0, 0, 994, 985, 1, 0, 0, 0, 994, 986, 1, 0, 0, 0, 994, 987, 1, 0, 0, 0, 994, 988, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 994, 990, 1, 0, 0, 0, 994, 991, 1, 0, 0, 0, 994, 992, 1, 0, 0, 0, 994, 993, 1, 0, 0, 0, 995, 141, 1, 0, 0, 0, 996, 997, 3, 144, 72, 0, 997, 999, 3, 146, 73, 0, 998, 1000, 3, 160, 80, 0, 999, 998, 1, 0, 0, 0, 999, 1000, 1, 0, 0, 0, 1000, 1014, 1, 0, 0, 0, 1001, 1005, 3, 86, 43, 0, 1002, 1004, 3, 228, 114, 0, 1003, 1002, 1, 0, 0, 0, 1004, 1007, 1, 0, 0, 0, 1005, 1003, 1, 0, 0, 0, 1005, 1006, 1, 0, 0, 0, 1006, 1008, 1, 0, 0, 0, 1007, 1005, 1, 0, 0, 0, 1008, 1009, 3, 144, 72, 0, 1009, 1011, 3, 146, 73, 0, 1010, 1012, 3, 160, 80, 0, 1011, 1010, 1, 0, 0, 0, 1011, 1012, 1, 0, 0, 0, 1012, 1014, 1, 0, 0, 0, 1013, 996, 1, 0, 0, 0, 1013, 1001, 1, 0, 0, 0, 1014, 143, 1, 0, 0, 0, 1015, 1018, 3, 114, 57, 0, 1016, 1018, 5, 48, 0, 0, 1017, 1015, 1, 0, 0, 0, 1017, 1016, 1, 0, 0, 0, 1018, 145, 1, 0, 0, 0, 1019, 1020, 5, 102, 0, 0, 1020, 1022, 5, 57, 0, 0, 1021, 1023, 3, 148, 74, 0, 1022, 1021, 1, 0, 0, 0, 1022, 1023, 1, 0, 0, 0, 1023, 1024, 1, 0, 0, 0, 1024, 1026, 5, 58, 0, 0, 1025, 1027, 3, 30, 15, 0, 1026, 1025, 1, 0, 0, 0, 1026, 1027, 1, 0, 0, 0, 1027, 147, 1, 0, 0, 0, 1028, 1035, 3, 158, 79, 0, 1029, 1030, 3, 150, 75, 0, 1030, 1031, 5, 64, 0, 0, 1031, 1032, 3, 156, 78, 0, 1032, 1035, 1, 0, 0, 0, 1033, 1035, 3, 156, 78, 0, 1034, 1028, 1, 0, 0, 0, 1034, 1029, 1, 0, 0, 0, 1034, 1033, 1, 0, 0, 0, 1035, 149, 1, 0, 0, 0, 1036, 1041, 3, 152, 76, 0, 1037, 1038, 5, 64, 0, 0, 1038, 1040, 3, 152, 76, 0, 1039, 1037, 1, 0, 0, 0, 1040, 1043, 1, 0, 0, 0, 1041, 1039, 1, 0, 0, 0, 1041, 1042, 1, 0, 0, 0, 1042, 1053, 1, 0, 0, 0, 1043, 1041, 1, 0, 0, 0, 1044, 1049, 3, 158, 79, 0, 1045, 1046, 5, 64, 0, 0, 1046, 1048, 3, 152, 76, 0, 1047, 1045, 1, 0, 0, 0, 1048, 1051, 1, 0, 0, 0, 1049, 1047, 1, 0, 0, 0, 1049, 1050, 1, 0, 0, 0, 1050, 1053, 1, 0, 0, 0, 1051, 1049, 1, 0, 0, 0, 1052, 1036, 1, 0, 0, 0, 1052, 1044, 1, 0, 0, 0, 1053, 151, 1, 0, 0, 0, 1054, 1056, 3, 154, 77, 0, 1055, 1054, 1, 0, 0, 0, 1056, 1059, 1, 0, 0, 0, 1057, 1055, 1, 0, 0, 0, 1057, 1058, 1, 0, 0, 0, 1058, 1060, 1, 0, 0, 0, 1059, 1057, 1, 0, 0, 0, 1060, 1061, 3, 114, 57, 0, 1061, 1062, 3, 110, 55, 0, 1062, 153, 1, 0, 0, 0, 1063, 1066, 3, 228, 114, 0, 1064, 1066, 5, 18, 0, 0, 1065, 1063, 1, 0, 0, 0, 1065, 1064, 1, 0, 0, 0, 1066, 155, 1, 0, 0, 0, 1067, 1069, 3, 154, 77, 0, 1068, 1067, 1, 0, 0, 0, 1069, 1072, 1, 0, 0, 0, 1070, 1068, 1, 0, 0, 0, 1070, 1071, 1, 0, 0, 0, 1071, 1073, 1, 0, 0, 0, 1072, 1070, 1, 0, 0, 0, 1073, 1077, 3, 114, 57, 0, 1074, 1076, 3, 228, 114, 0, 1075, 1074, 1, 0, 0, 0, 1076, 1079, 1, 0, 0, 0, 1077, 1075, 1, 0, 0, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1080, 1, 0, 0, 0, 1079, 1077, 1, 0, 0, 0, 1080, 1081, 5, 104, 0, 0, 1081, 1082, 3, 110, 55, 0, 1082, 1085, 1, 0, 0, 0, 1083, 1085, 3, 152, 76, 0, 1084, 1070, 1, 0, 0, 0, 1084, 1083, 1, 0, 0, 0, 1085, 157, 1, 0, 0, 0, 1086, 1088, 3, 228, 114, 0, 1087, 1086, 1, 0, 0, 0, 1088, 1091, 1, 0, 0, 0, 1089, 1087, 1, 0, 0, 0, 1089, 1090, 1, 0, 0, 0, 1090, 1092, 1, 0, 0, 0, 1091, 1089, 1, 0, 0, 0, 1092, 1095, 3, 114, 57, 0, 1093, 1094, 5, 102, 0, 0, 1094, 1096, 5, 65, 0, 0, 1095, 1093, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, 1097, 1, 0, 0, 0, 1097, 1098, 5, 43, 0, 0, 1098, 159, 1, 0, 0, 0, 1099, 1100, 5, 45, 0, 0, 1100, 1101, 3, 162, 81, 0, 1101, 161, 1, 0, 0, 0, 1102, 1107, 3, 164, 82, 0, 1103, 1104, 5, 64, 0, 0, 1104, 1106, 3, 164, 82, 0, 1105, 1103, 1, 0, 0, 0, 1106, 1109, 1, 0, 0, 0, 1107, 1105, 1, 0, 0, 0, 1107, 1108, 1, 0, 0, 0, 1108, 163, 1, 0, 0, 0, 1109, 1107, 1, 0, 0, 0, 1110, 1113, 3, 14, 7, 0, 1111, 1113, 3, 26, 13, 0, 1112, 1110, 1, 0, 0, 0, 1112, 1111, 1, 0, 0, 0, 1113, 165, 1, 0, 0, 0, 1114, 1117, 3, 250, 125, 0, 1115, 1117, 5, 63, 0, 0, 1116, 1114, 1, 0, 0, 0, 1116, 1115, 1, 0, 0, 0, 1117, 167, 1, 0, 0, 0, 1118, 1119, 3, 250, 125, 0, 1119, 169, 1, 0, 0, 0, 1120, 1121, 5, 38, 0, 0, 1121, 1122, 3, 250, 125, 0, 1122, 171, 1, 0, 0, 0, 1123, 1125, 3, 174, 87, 0, 1124, 1123, 1, 0, 0, 0, 1125, 1128, 1, 0, 0, 0, 1126, 1124, 1, 0, 0, 0, 1126, 1127, 1, 0, 0, 0, 1127, 1129, 1, 0, 0, 0, 1128, 1126, 1, 0, 0, 0, 1129, 1131, 3, 176, 88, 0, 1130, 1132, 3, 160, 80, 0, 1131, 1130, 1, 0, 0, 0, 1131, 1132, 1, 0, 0, 0, 1132, 1133, 1, 0, 0, 0, 1133, 1134, 3, 180, 90, 0, 1134, 173, 1, 0, 0, 0, 1135, 1140, 3, 228, 114, 0, 1136, 1140, 5, 35, 0, 0, 1137, 1140, 5, 34, 0, 0, 1138, 1140, 5, 33, 0, 0, 1139, 1135, 1, 0, 0, 0, 1139, 1136, 1, 0, 0, 0, 1139, 1137, 1, 0, 0, 0, 1139, 1138, 1, 0, 0, 0, 1140, 175, 1, 0, 0, 0, 1141, 1143, 3, 86, 43, 0, 1142, 1141, 1, 0, 0, 0, 1142, 1143, 1, 0, 0, 0, 1143, 1144, 1, 0, 0, 0, 1144, 1145, 3, 178, 89, 0, 1145, 1147, 5, 57, 0, 0, 1146, 1148, 3, 148, 74, 0, 1147, 1146, 1, 0, 0, 0, 1147, 1148, 1, 0, 0, 0, 1148, 1149, 1, 0, 0, 0, 1149, 1150, 5, 58, 0, 0, 1150, 177, 1, 0, 0, 0, 1151, 1152, 5, 102, 0, 0, 1152, 179, 1, 0, 0, 0, 1153, 1155, 5, 59, 0, 0, 1154, 1156, 3, 182, 91, 0, 1155, 1154, 1, 0, 0, 0, 1155, 1156, 1, 0, 0, 0, 1156, 1158, 1, 0, 0, 0, 1157, 1159, 3, 252, 126, 0, 1158, 1157, 1, 0, 0, 0, 1158, 1159, 1, 0, 0, 0, 1159, 1160, 1, 0, 0, 0, 1160, 1161, 5, 60, 0, 0, 1161, 181, 1, 0, 0, 0, 1162, 1164, 3, 40, 20, 0, 1163, 1162, 1, 0, 0, 0, 1163, 1164, 1, 0, 0, 0, 1164, 1165, 1, 0, 0, 0, 1165, 1166, 5, 43, 0, 0, 1166, 1168, 5, 57, 0, 0, 1167, 1169, 3, 396, 198, 0, 1168, 1167, 1, 0, 0, 0, 1168, 1169, 1, 0, 0, 0, 1169, 1170, 1, 0, 0, 0, 1170, 1171, 5, 58, 0, 0, 1171, 1209, 5, 63, 0, 0, 1172, 1174, 3, 40, 20, 0, 1173, 1172, 1, 0, 0, 0, 1173, 1174, 1, 0, 0, 0, 1174, 1175, 1, 0, 0, 0, 1175, 1176, 5, 40, 0, 0, 1176, 1178, 5, 57, 0, 0, 1177, 1179, 3, 396, 198, 0, 1178, 1177, 1, 0, 0, 0, 1178, 1179, 1, 0, 0, 0, 1179, 1180, 1, 0, 0, 0, 1180, 1181, 5, 58, 0, 0, 1181, 1209, 5, 63, 0, 0, 1182, 1183, 3, 56, 28, 0, 1183, 1185, 5, 65, 0, 0, 1184, 1186, 3, 40, 20, 0, 1185, 1184, 1, 0, 0, 0, 1185, 1186, 1, 0, 0, 0, 1186, 1187, 1, 0, 0, 0, 1187, 1188, 5, 40, 0, 0, 1188, 1190, 5, 57, 0, 0, 1189, 1191, 3, 396, 198, 0, 1190, 1189, 1, 0, 0, 0, 1190, 1191, 1, 0, 0, 0, 1191, 1192, 1, 0, 0, 0, 1192, 1193, 5, 58, 0, 0, 1193, 1194, 5, 63, 0, 0, 1194, 1209, 1, 0, 0, 0, 1195, 1196, 3, 350, 175, 0, 1196, 1198, 5, 65, 0, 0, 1197, 1199, 3, 40, 20, 0, 1198, 1197, 1, 0, 0, 0, 1198, 1199, 1, 0, 0, 0, 1199, 1200, 1, 0, 0, 0, 1200, 1201, 5, 40, 0, 0, 1201, 1203, 5, 57, 0, 0, 1202, 1204, 3, 396, 198, 0, 1203, 1202, 1, 0, 0, 0, 1203, 1204, 1, 0, 0, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1206, 5, 58, 0, 0, 1206, 1207, 5, 63, 0, 0, 1207, 1209, 1, 0, 0, 0, 1208, 1163, 1, 0, 0, 0, 1208, 1173, 1, 0, 0, 0, 1208, 1182, 1, 0, 0, 0, 1208, 1195, 1, 0, 0, 0, 1209, 183, 1, 0, 0, 0, 1210, 1212, 3, 84, 42, 0, 1211, 1210, 1, 0, 0, 0, 1212, 1215, 1, 0, 0, 0, 1213, 1211, 1, 0, 0, 0, 1213, 1214, 1, 0, 0, 0, 1214, 1216, 1, 0, 0, 0, 1215, 1213, 1, 0, 0, 0, 1216, 1217, 5, 16, 0, 0, 1217, 1219, 5, 102, 0, 0, 1218, 1220, 3, 92, 46, 0, 1219, 1218, 1, 0, 0, 0, 1219, 1220, 1, 0, 0, 0, 1220, 1221, 1, 0, 0, 0, 1221, 1222, 3, 186, 93, 0, 1222, 185, 1, 0, 0, 0, 1223, 1225, 5, 59, 0, 0, 1224, 1226, 3, 188, 94, 0, 1225, 1224, 1, 0, 0, 0, 1225, 1226, 1, 0, 0, 0, 1226, 1228, 1, 0, 0, 0, 1227, 1229, 5, 64, 0, 0, 1228, 1227, 1, 0, 0, 0, 1228, 1229, 1, 0, 0, 0, 1229, 1231, 1, 0, 0, 0, 1230, 1232, 3, 194, 97, 0, 1231, 1230, 1, 0, 0, 0, 1231, 1232, 1, 0, 0, 0, 1232, 1233, 1, 0, 0, 0, 1233, 1234, 5, 60, 0, 0, 1234, 187, 1, 0, 0, 0, 1235, 1240, 3, 190, 95, 0, 1236, 1237, 5, 64, 0, 0, 1237, 1239, 3, 190, 95, 0, 1238, 1236, 1, 0, 0, 0, 1239, 1242, 1, 0, 0, 0, 1240, 1238, 1, 0, 0, 0, 1240, 1241, 1, 0, 0, 0, 1241, 189, 1, 0, 0, 0, 1242, 1240, 1, 0, 0, 0, 1243, 1245, 3, 192, 96, 0, 1244, 1243, 1, 0, 0, 0, 1245, 1248, 1, 0, 0, 0, 1246, 1244, 1, 0, 0, 0, 1246, 1247, 1, 0, 0, 0, 1247, 1249, 1, 0, 0, 0, 1248, 1246, 1, 0, 0, 0, 1249, 1255, 5, 102, 0, 0, 1250, 1252, 5, 57, 0, 0, 1251, 1253, 3, 396, 198, 0, 1252, 1251, 1, 0, 0, 0, 1252, 1253, 1, 0, 0, 0, 1253, 1254, 1, 0, 0, 0, 1254, 1256, 5, 58, 0, 0, 1255, 1250, 1, 0, 0, 0, 1255, 1256, 1, 0, 0, 0, 1256, 1258, 1, 0, 0, 0, 1257, 1259, 3, 96, 48, 0, 1258, 1257, 1, 0, 0, 0, 1258, 1259, 1, 0, 0, 0, 1259, 191, 1, 0, 0, 0, 1260, 1261, 3, 228, 114, 0, 1261, 193, 1, 0, 0, 0, 1262, 1266, 5, 63, 0, 0, 1263, 1265, 3, 98, 49, 0, 1264, 1263, 1, 0, 0, 0, 1265, 1268, 1, 0, 0, 0, 1266, 1264, 1, 0, 0, 0, 1266, 1267, 1, 0, 0, 0, 1267, 195, 1, 0, 0, 0, 1268, 1266, 1, 0, 0, 0, 1269, 1272, 3, 198, 99, 0, 1270, 1272, 3, 216, 108, 0, 1271, 1269, 1, 0, 0, 0, 1271, 1270, 1, 0, 0, 0, 1272, 197, 1, 0, 0, 0, 1273, 1275, 3, 200, 100, 0, 1274, 1273, 1, 0, 0, 0, 1275, 1278, 1, 0, 0, 0, 1276, 1274, 1, 0, 0, 0, 1276, 1277, 1, 0, 0, 0, 1277, 1279, 1, 0, 0, 0, 1278, 1276, 1, 0, 0, 0, 1279, 1280, 5, 28, 0, 0, 1280, 1282, 5, 102, 0, 0, 1281, 1283, 3, 86, 43, 0, 1282, 1281, 1, 0, 0, 0, 1282, 1283, 1, 0, 0, 0, 1283, 1285, 1, 0, 0, 0, 1284, 1286, 3, 202, 101, 0, 1285, 1284, 1, 0, 0, 0, 1285, 1286, 1, 0, 0, 0, 1286, 1287, 1, 0, 0, 0, 1287, 1288, 3, 204, 102, 0, 1288, 199, 1, 0, 0, 0, 1289, 1297, 3, 228, 114, 0, 1290, 1297, 5, 35, 0, 0, 1291, 1297, 5, 34, 0, 0, 1292, 1297, 5, 33, 0, 0, 1293, 1297, 5, 1, 0, 0, 1294, 1297, 5, 38, 0, 0, 1295, 1297, 5, 39, 0, 0, 1296, 1289, 1, 0, 0, 0, 1296, 1290, 1, 0, 0, 0, 1296, 1291, 1, 0, 0, 0, 1296, 1292, 1, 0, 0, 0, 1296, 1293, 1, 0, 0, 0, 1296, 1294, 1, 0, 0, 0, 1296, 1295, 1, 0, 0, 0, 1297, 201, 1, 0, 0, 0, 1298, 1299, 5, 17, 0, 0, 1299, 1300, 3, 94, 47, 0, 1300, 203, 1, 0, 0, 0, 1301, 1305, 5, 59, 0, 0, 1302, 1304, 3, 206, 103, 0, 1303, 1302, 1, 0, 0, 0, 1304, 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1305, 1306, 1, 0, 0, 0, 1306, 1308, 1, 0, 0, 0, 1307, 1305, 1, 0, 0, 0, 1308, 1309, 5, 60, 0, 0, 1309, 205, 1, 0, 0, 0, 1310, 1316, 3, 208, 104, 0, 1311, 1316, 3, 212, 106, 0, 1312, 1316, 3, 80, 40, 0, 1313, 1316, 3, 196, 98, 0, 1314, 1316, 5, 63, 0, 0, 1315, 1310, 1, 0, 0, 0, 1315, 1311, 1, 0, 0, 0, 1315, 1312, 1, 0, 0, 0, 1315, 1313, 1, 0, 0, 0, 1315, 1314, 1, 0, 0, 0, 1316, 207, 1, 0, 0, 0, 1317, 1319, 3, 210, 105, 0, 1318, 1317, 1, 0, 0, 0, 1319, 1322, 1, 0, 0, 0, 1320, 1318, 1, 0, 0, 0, 1320, 1321, 1, 0, 0, 0, 1321, 1323, 1, 0, 0, 0, 1322, 1320, 1, 0, 0, 0, 1323, 1324, 3, 114, 57, 0, 1324, 1325, 3, 106, 53, 0, 1325, 1326, 5, 63, 0, 0, 1326, 209, 1, 0, 0, 0, 1327, 1332, 3, 228, 114, 0, 1328, 1332, 5, 35, 0, 0, 1329, 1332, 5, 38, 0, 0, 1330, 1332, 5, 18, 0, 0, 1331, 1327, 1, 0, 0, 0, 1331, 1328, 1, 0, 0, 0, 1331, 1329, 1, 0, 0, 0, 1331, 1330, 1, 0, 0, 0, 1332, 211, 1, 0, 0, 0, 1333, 1335, 3, 214, 107, 0, 1334, 1333, 1, 0, 0, 0, 1335, 1338, 1, 0, 0, 0, 1336, 1334, 1, 0, 0, 0, 1336, 1337, 1, 0, 0, 0, 1337, 1339, 1, 0, 0, 0, 1338, 1336, 1, 0, 0, 0, 1339, 1340, 3, 142, 71, 0, 1340, 1341, 3, 166, 83, 0, 1341, 213, 1, 0, 0, 0, 1342, 1349, 3, 228, 114, 0, 1343, 1349, 5, 35, 0, 0, 1344, 1349, 5, 1, 0, 0, 1345, 1349, 5, 12, 0, 0, 1346, 1349, 5, 38, 0, 0, 1347, 1349, 5, 39, 0, 0, 1348, 1342, 1, 0, 0, 0, 1348, 1343, 1, 0, 0, 0, 1348, 1344, 1, 0, 0, 0, 1348, 1345, 1, 0, 0, 0, 1348, 1346, 1, 0, 0, 0, 1348, 1347, 1, 0, 0, 0, 1349, 215, 1, 0, 0, 0, 1350, 1352, 3, 200, 100, 0, 1351, 1350, 1, 0, 0, 0, 1352, 1355, 1, 0, 0, 0, 1353, 1351, 1, 0, 0, 0, 1353, 1354, 1, 0, 0, 0, 1354, 1356, 1, 0, 0, 0, 1355, 1353, 1, 0, 0, 0, 1356, 1357, 5, 103, 0, 0, 1357, 1358, 5, 28, 0, 0, 1358, 1359, 5, 102, 0, 0, 1359, 1360, 3, 218, 109, 0, 1360, 217, 1, 0, 0, 0, 1361, 1365, 5, 59, 0, 0, 1362, 1364, 3, 220, 110, 0, 1363, 1362, 1, 0, 0, 0, 1364, 1367, 1, 0, 0, 0, 1365, 1363, 1, 0, 0, 0, 1365, 1366, 1, 0, 0, 0, 1366, 1368, 1, 0, 0, 0, 1367, 1365, 1, 0, 0, 0, 1368, 1369, 5, 60, 0, 0, 1369, 219, 1, 0, 0, 0, 1370, 1376, 3, 222, 111, 0, 1371, 1376, 3, 208, 104, 0, 1372, 1376, 3, 80, 40, 0, 1373, 1376, 3, 196, 98, 0, 1374, 1376, 5, 63, 0, 0, 1375, 1370, 1, 0, 0, 0, 1375, 1371, 1, 0, 0, 0, 1375, 1372, 1, 0, 0, 0, 1375, 1373, 1, 0, 0, 0, 1375, 1374, 1, 0, 0, 0, 1376, 221, 1, 0, 0, 0, 1377, 1379, 3, 224, 112, 0, 1378, 1377, 1, 0, 0, 0, 1379, 1382, 1, 0, 0, 0, 1380, 1378, 1, 0, 0, 0, 1380, 1381, 1, 0, 0, 0, 1381, 1383, 1, 0, 0, 0, 1382, 1380, 1, 0, 0, 0, 1383, 1384, 3, 114, 57, 0, 1384, 1385, 5, 102, 0, 0, 1385, 1386, 5, 57, 0, 0, 1386, 1388, 5, 58, 0, 0, 1387, 1389, 3, 30, 15, 0, 1388, 1387, 1, 0, 0, 0, 1388, 1389, 1, 0, 0, 0, 1389, 1391, 1, 0, 0, 0, 1390, 1392, 3, 226, 113, 0, 1391, 1390, 1, 0, 0, 0, 1391, 1392, 1, 0, 0, 0, 1392, 1393, 1, 0, 0, 0, 1393, 1394, 5, 63, 0, 0, 1394, 223, 1, 0, 0, 0, 1395, 1399, 3, 228, 114, 0, 1396, 1399, 5, 35, 0, 0, 1397, 1399, 5, 1, 0, 0, 1398, 1395, 1, 0, 0, 0, 1398, 1396, 1, 0, 0, 0, 1398, 1397, 1, 0, 0, 0, 1399, 225, 1, 0, 0, 0, 1400, 1401, 5, 12, 0, 0, 1401, 1402, 3, 236, 118, 0, 1402, 227, 1, 0, 0, 0, 1403, 1407, 3, 230, 115, 0, 1404, 1407, 3, 242, 121, 0, 1405, 1407, 3, 244, 122, 0, 1406, 1403, 1, 0, 0, 0, 1406, 1404, 1, 0, 0, 0, 1406, 1405, 1, 0, 0, 0, 1407, 229, 1, 0, 0, 0, 1408, 1409, 5, 103, 0, 0, 1409, 1410, 3, 52, 26, 0, 1410, 1412, 5, 57, 0, 0, 1411, 1413, 3, 232, 116, 0, 1412, 1411, 1, 0, 0, 0, 1412, 1413, 1, 0, 0, 0, 1413, 1414, 1, 0, 0, 0, 1414, 1415, 5, 58, 0, 0, 1415, 231, 1, 0, 0, 0, 1416, 1421, 3, 234, 117, 0, 1417, 1418, 5, 64, 0, 0, 1418, 1420, 3, 234, 117, 0, 1419, 1417, 1, 0, 0, 0, 1420, 1423, 1, 0, 0, 0, 1421, 1419, 1, 0, 0, 0, 1421, 1422, 1, 0, 0, 0, 1422, 233, 1, 0, 0, 0, 1423, 1421, 1, 0, 0, 0, 1424, 1425, 5, 102, 0, 0, 1425, 1426, 5, 66, 0, 0, 1426, 1427, 3, 236, 118, 0, 1427, 235, 1, 0, 0, 0, 1428, 1432, 3, 430, 215, 0, 1429, 1432, 3, 238, 119, 0, 1430, 1432, 3, 228, 114, 0, 1431, 1428, 1, 0, 0, 0, 1431, 1429, 1, 0, 0, 0, 1431, 1430, 1, 0, 0, 0, 1432, 237, 1, 0, 0, 0, 1433, 1435, 5, 59, 0, 0, 1434, 1436, 3, 240, 120, 0, 1435, 1434, 1, 0, 0, 0, 1435, 1436, 1, 0, 0, 0, 1436, 1438, 1, 0, 0, 0, 1437, 1439, 5, 64, 0, 0, 1438, 1437, 1, 0, 0, 0, 1438, 1439, 1, 0, 0, 0, 1439, 1440, 1, 0, 0, 0, 1440, 1441, 5, 60, 0, 0, 1441, 239, 1, 0, 0, 0, 1442, 1447, 3, 236, 118, 0, 1443, 1444, 5, 64, 0, 0, 1444, 1446, 3, 236, 118, 0, 1445, 1443, 1, 0, 0, 0, 1446, 1449, 1, 0, 0, 0, 1447, 1445, 1, 0, 0, 0, 1447, 1448, 1, 0, 0, 0, 1448, 241, 1, 0, 0, 0, 1449, 1447, 1, 0, 0, 0, 1450, 1451, 5, 103, 0, 0, 1451, 1452, 3, 52, 26, 0, 1452, 243, 1, 0, 0, 0, 1453, 1454, 5, 103, 0, 0, 1454, 1455, 3, 52, 26, 0, 1455, 1456, 5, 57, 0, 0, 1456, 1457, 3, 236, 118, 0, 1457, 1458, 5, 58, 0, 0, 1458, 245, 1, 0, 0, 0, 1459, 1461, 5, 59, 0, 0, 1460, 1462, 3, 248, 124, 0, 1461, 1460, 1, 0, 0, 0, 1461, 1462, 1, 0, 0, 0, 1462, 1464, 1, 0, 0, 0, 1463, 1465, 5, 64, 0, 0, 1464, 1463, 1, 0, 0, 0, 1464, 1465, 1, 0, 0, 0, 1465, 1466, 1, 0, 0, 0, 1466, 1467, 5, 60, 0, 0, 1467, 247, 1, 0, 0, 0, 1468, 1473, 3, 112, 56, 0, 1469, 1470, 5, 64, 0, 0, 1470, 1472, 3, 112, 56, 0, 1471, 1469, 1, 0, 0, 0, 1472, 1475, 1, 0, 0, 0, 1473, 1471, 1, 0, 0, 0, 1473, 1474, 1, 0, 0, 0, 1474, 249, 1, 0, 0, 0, 1475, 1473, 1, 0, 0, 0, 1476, 1478, 5, 59, 0, 0, 1477, 1479, 3, 252, 126, 0, 1478, 1477, 1, 0, 0, 0, 1478, 1479, 1, 0, 0, 0, 1479, 1480, 1, 0, 0, 0, 1480, 1481, 5, 60, 0, 0, 1481, 251, 1, 0, 0, 0, 1482, 1484, 3, 254, 127, 0, 1483, 1482, 1, 0, 0, 0, 1484, 1485, 1, 0, 0, 0, 1485, 1483, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 253, 1, 0, 0, 0, 1487, 1491, 3, 256, 128, 0, 1488, 1491, 3, 80, 40, 0, 1489, 1491, 3, 260, 130, 0, 1490, 1487, 1, 0, 0, 0, 1490, 1488, 1, 0, 0, 0, 1490, 1489, 1, 0, 0, 0, 1491, 255, 1, 0, 0, 0, 1492, 1493, 3, 258, 129, 0, 1493, 1494, 5, 63, 0, 0, 1494, 257, 1, 0, 0, 0, 1495, 1497, 3, 154, 77, 0, 1496, 1495, 1, 0, 0, 0, 1497, 1500, 1, 0, 0, 0, 1498, 1496, 1, 0, 0, 0, 1498, 1499, 1, 0, 0, 0, 1499, 1501, 1, 0, 0, 0, 1500, 1498, 1, 0, 0, 0, 1501, 1502, 3, 114, 57, 0, 1502, 1503, 3, 106, 53, 0, 1503, 259, 1, 0, 0, 0, 1504, 1511, 3, 264, 132, 0, 1505, 1511, 3, 268, 134, 0, 1506, 1511, 3, 276, 138, 0, 1507, 1511, 3, 278, 139, 0, 1508, 1511, 3, 296, 148, 0, 1509, 1511, 3, 302, 151, 0, 1510, 1504, 1, 0, 0, 0, 1510, 1505, 1, 0, 0, 0, 1510, 1506, 1, 0, 0, 0, 1510, 1507, 1, 0, 0, 0, 1510, 1508, 1, 0, 0, 0, 1510, 1509, 1, 0, 0, 0, 1511, 261, 1, 0, 0, 0, 1512, 1518, 3, 264, 132, 0, 1513, 1518, 3, 270, 135, 0, 1514, 1518, 3, 280, 140, 0, 1515, 1518, 3, 298, 149, 0, 1516, 1518, 3, 304, 152, 0, 1517, 1512, 1, 0, 0, 0, 1517, 1513, 1, 0, 0, 0, 1517, 1514, 1, 0, 0, 0, 1517, 1515, 1, 0, 0, 0, 1517, 1516, 1, 0, 0, 0, 1518, 263, 1, 0, 0, 0, 1519, 1532, 3, 250, 125, 0, 1520, 1532, 3, 266, 133, 0, 1521, 1532, 3, 272, 136, 0, 1522, 1532, 3, 282, 141, 0, 1523, 1532, 3, 284, 142, 0, 1524, 1532, 3, 300, 150, 0, 1525, 1532, 3, 320, 160, 0, 1526, 1532, 3, 322, 161, 0, 1527, 1532, 3, 324, 162, 0, 1528, 1532, 3, 328, 164, 0, 1529, 1532, 3, 326, 163, 0, 1530, 1532, 3, 330, 165, 0, 1531, 1519, 1, 0, 0, 0, 1531, 1520, 1, 0, 0, 0, 1531, 1521, 1, 0, 0, 0, 1531, 1522, 1, 0, 0, 0, 1531, 1523, 1, 0, 0, 0, 1531, 1524, 1, 0, 0, 0, 1531, 1525, 1, 0, 0, 0, 1531, 1526, 1, 0, 0, 0, 1531, 1527, 1, 0, 0, 0, 1531, 1528, 1, 0, 0, 0, 1531, 1529, 1, 0, 0, 0, 1531, 1530, 1, 0, 0, 0, 1532, 265, 1, 0, 0, 0, 1533, 1534, 5, 63, 0, 0, 1534, 267, 1, 0, 0, 0, 1535, 1536, 5, 102, 0, 0, 1536, 1537, 5, 72, 0, 0, 1537, 1538, 3, 260, 130, 0, 1538, 269, 1, 0, 0, 0, 1539, 1540, 5, 102, 0, 0, 1540, 1541, 5, 72, 0, 0, 1541, 1542, 3, 262, 131, 0, 1542, 271, 1, 0, 0, 0, 1543, 1544, 3, 274, 137, 0, 1544, 1545, 5, 63, 0, 0, 1545, 273, 1, 0, 0, 0, 1546, 1554, 3, 424, 212, 0, 1547, 1554, 3, 454, 227, 0, 1548, 1554, 3, 456, 228, 0, 1549, 1554, 3, 462, 231, 0, 1550, 1554, 3, 466, 233, 0, 1551, 1554, 3, 390, 195, 0, 1552, 1554, 3, 370, 185, 0, 1553, 1546, 1, 0, 0, 0, 1553, 1547, 1, 0, 0, 0, 1553, 1548, 1, 0, 0, 0, 1553, 1549, 1, 0, 0, 0, 1553, 1550, 1, 0, 0, 0, 1553, 1551, 1, 0, 0, 0, 1553, 1552, 1, 0, 0, 0, 1554, 275, 1, 0, 0, 0, 1555, 1556, 5, 22, 0, 0, 1556, 1557, 5, 57, 0, 0, 1557, 1558, 3, 412, 206, 0, 1558, 1559, 5, 58, 0, 0, 1559, 1560, 3, 260, 130, 0, 1560, 277, 1, 0, 0, 0, 1561, 1562, 5, 22, 0, 0, 1562, 1563, 5, 57, 0, 0, 1563, 1564, 3, 412, 206, 0, 1564, 1565, 5, 58, 0, 0, 1565, 1566, 3, 262, 131, 0, 1566, 1567, 5, 15, 0, 0, 1567, 1568, 3, 260, 130, 0, 1568, 279, 1, 0, 0, 0, 1569, 1570, 5, 22, 0, 0, 1570, 1571, 5, 57, 0, 0, 1571, 1572, 3, 412, 206, 0, 1572, 1573, 5, 58, 0, 0, 1573, 1574, 3, 262, 131, 0, 1574, 1575, 5, 15, 0, 0, 1575, 1576, 3, 262, 131, 0, 1576, 281, 1, 0, 0, 0, 1577, 1578, 5, 2, 0, 0, 1578, 1579, 3, 412, 206, 0, 1579, 1580, 5, 63, 0, 0, 1580, 1588, 1, 0, 0, 0, 1581, 1582, 5, 2, 0, 0, 1582, 1583, 3, 412, 206, 0, 1583, 1584, 5, 72, 0, 0, 1584, 1585, 3, 412, 206, 0, 1585, 1586, 5, 63, 0, 0, 1586, 1588, 1, 0, 0, 0, 1587, 1577, 1, 0, 0, 0, 1587, 1581, 1, 0, 0, 0, 1588, 283, 1, 0, 0, 0, 1589, 1590, 5, 41, 0, 0, 1590, 1591, 5, 57, 0, 0, 1591, 1592, 3, 412, 206, 0, 1592, 1593, 5, 58, 0, 0, 1593, 1594, 3, 286, 143, 0, 1594, 285, 1, 0, 0, 0, 1595, 1599, 5, 59, 0, 0, 1596, 1598, 3, 288, 144, 0, 1597, 1596, 1, 0, 0, 0, 1598, 1601, 1, 0, 0, 0, 1599, 1597, 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1605, 1, 0, 0, 0, 1601, 1599, 1, 0, 0, 0, 1602, 1604, 3, 292, 146, 0, 1603, 1602, 1, 0, 0, 0, 1604, 1607, 1, 0, 0, 0, 1605, 1603, 1, 0, 0, 0, 1605, 1606, 1, 0, 0, 0, 1606, 1608, 1, 0, 0, 0, 1607, 1605, 1, 0, 0, 0, 1608, 1609, 5, 60, 0, 0, 1609, 287, 1, 0, 0, 0, 1610, 1611, 3, 290, 145, 0, 1611, 1612, 3, 252, 126, 0, 1612, 289, 1, 0, 0, 0, 1613, 1617, 3, 292, 146, 0, 1614, 1616, 3, 292, 146, 0, 1615, 1614, 1, 0, 0, 0, 1616, 1619, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1617, 1618, 1, 0, 0, 0, 1618, 291, 1, 0, 0, 0, 1619, 1617, 1, 0, 0, 0, 1620, 1621, 5, 6, 0, 0, 1621, 1622, 3, 410, 205, 0, 1622, 1623, 5, 72, 0, 0, 1623, 1631, 1, 0, 0, 0, 1624, 1625, 5, 6, 0, 0, 1625, 1626, 3, 294, 147, 0, 1626, 1627, 5, 72, 0, 0, 1627, 1631, 1, 0, 0, 0, 1628, 1629, 5, 12, 0, 0, 1629, 1631, 5, 72, 0, 0, 1630, 1620, 1, 0, 0, 0, 1630, 1624, 1, 0, 0, 0, 1630, 1628, 1, 0, 0, 0, 1631, 293, 1, 0, 0, 0, 1632, 1633, 5, 102, 0, 0, 1633, 295, 1, 0, 0, 0, 1634, 1635, 5, 50, 0, 0, 1635, 1636, 5, 57, 0, 0, 1636, 1637, 3, 412, 206, 0, 1637, 1638, 5, 58, 0, 0, 1638, 1639, 3, 260, 130, 0, 1639, 297, 1, 0, 0, 0, 1640, 1641, 5, 50, 0, 0, 1641, 1642, 5, 57, 0, 0, 1642, 1643, 3, 412, 206, 0, 1643, 1644, 5, 58, 0, 0, 1644, 1645, 3, 262, 131, 0, 1645, 299, 1, 0, 0, 0, 1646, 1647, 5, 13, 0, 0, 1647, 1648, 3, 260, 130, 0, 1648, 1649, 5, 50, 0, 0, 1649, 1650, 5, 57, 0, 0, 1650, 1651, 3, 412, 206, 0, 1651, 1652, 5, 58, 0, 0, 1652, 1653, 5, 63, 0, 0, 1653, 301, 1, 0, 0, 0, 1654, 1657, 3, 306, 153, 0, 1655, 1657, 3, 316, 158, 0, 1656, 1654, 1, 0, 0, 0, 1656, 1655, 1, 0, 0, 0, 1657, 303, 1, 0, 0, 0, 1658, 1661, 3, 308, 154, 0, 1659, 1661, 3, 318, 159, 0, 1660, 1658, 1, 0, 0, 0, 1660, 1659, 1, 0, 0, 0, 1661, 305, 1, 0, 0, 0, 1662, 1663, 5, 21, 0, 0, 1663, 1665, 5, 57, 0, 0, 1664, 1666, 3, 310, 155, 0, 1665, 1664, 1, 0, 0, 0, 1665, 1666, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 1669, 5, 63, 0, 0, 1668, 1670, 3, 412, 206, 0, 1669, 1668, 1, 0, 0, 0, 1669, 1670, 1, 0, 0, 0, 1670, 1671, 1, 0, 0, 0, 1671, 1673, 5, 63, 0, 0, 1672, 1674, 3, 312, 156, 0, 1673, 1672, 1, 0, 0, 0, 1673, 1674, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1676, 5, 58, 0, 0, 1676, 1677, 3, 260, 130, 0, 1677, 307, 1, 0, 0, 0, 1678, 1679, 5, 21, 0, 0, 1679, 1681, 5, 57, 0, 0, 1680, 1682, 3, 310, 155, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1683, 1, 0, 0, 0, 1683, 1685, 5, 63, 0, 0, 1684, 1686, 3, 412, 206, 0, 1685, 1684, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1689, 5, 63, 0, 0, 1688, 1690, 3, 312, 156, 0, 1689, 1688, 1, 0, 0, 0, 1689, 1690, 1, 0, 0, 0, 1690, 1691, 1, 0, 0, 0, 1691, 1692, 5, 58, 0, 0, 1692, 1693, 3, 262, 131, 0, 1693, 309, 1, 0, 0, 0, 1694, 1697, 3, 314, 157, 0, 1695, 1697, 3, 258, 129, 0, 1696, 1694, 1, 0, 0, 0, 1696, 1695, 1, 0, 0, 0, 1697, 311, 1, 0, 0, 0, 1698, 1699, 3, 314, 157, 0, 1699, 313, 1, 0, 0, 0, 1700, 1705, 3, 274, 137, 0, 1701, 1702, 5, 64, 0, 0, 1702, 1704, 3, 274, 137, 0, 1703, 1701, 1, 0, 0, 0, 1704, 1707, 1, 0, 0, 0, 1705, 1703, 1, 0, 0, 0, 1705, 1706, 1, 0, 0, 0, 1706, 315, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, 1708, 1709, 5, 21, 0, 0, 1709, 1713, 5, 57, 0, 0, 1710, 1712, 3, 154, 77, 0, 1711, 1710, 1, 0, 0, 0, 1712, 1715, 1, 0, 0, 0, 1713, 1711, 1, 0, 0, 0, 1713, 1714, 1, 0, 0, 0, 1714, 1716, 1, 0, 0, 0, 1715, 1713, 1, 0, 0, 0, 1716, 1717, 3, 114, 57, 0, 1717, 1718, 3, 110, 55, 0, 1718, 1719, 5, 72, 0, 0, 1719, 1720, 3, 412, 206, 0, 1720, 1721, 5, 58, 0, 0, 1721, 1722, 3, 260, 130, 0, 1722, 317, 1, 0, 0, 0, 1723, 1724, 5, 21, 0, 0, 1724, 1728, 5, 57, 0, 0, 1725, 1727, 3, 154, 77, 0, 1726, 1725, 1, 0, 0, 0, 1727, 1730, 1, 0, 0, 0, 1728, 1726, 1, 0, 0, 0, 1728, 1729, 1, 0, 0, 0, 1729, 1731, 1, 0, 0, 0, 1730, 1728, 1, 0, 0, 0, 1731, 1732, 3, 114, 57, 0, 1732, 1733, 3, 110, 55, 0, 1733, 1734, 5, 72, 0, 0, 1734, 1735, 3, 412, 206, 0, 1735, 1736, 5, 58, 0, 0, 1736, 1737, 3, 262, 131, 0, 1737, 319, 1, 0, 0, 0, 1738, 1740, 5, 4, 0, 0, 1739, 1741, 5, 102, 0, 0, 1740, 1739, 1, 0, 0, 0, 1740, 1741, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 1743, 5, 63, 0, 0, 1743, 321, 1, 0, 0, 0, 1744, 1746, 5, 11, 0, 0, 1745, 1747, 5, 102, 0, 0, 1746, 1745, 1, 0, 0, 0, 1746, 1747, 1, 0, 0, 0, 1747, 1748, 1, 0, 0, 0, 1748, 1749, 5, 63, 0, 0, 1749, 323, 1, 0, 0, 0, 1750, 1752, 5, 36, 0, 0, 1751, 1753, 3, 412, 206, 0, 1752, 1751, 1, 0, 0, 0, 1752, 1753, 1, 0, 0, 0, 1753, 1754, 1, 0, 0, 0, 1754, 1755, 5, 63, 0, 0, 1755, 325, 1, 0, 0, 0, 1756, 1757, 5, 44, 0, 0, 1757, 1758, 3, 412, 206, 0, 1758, 1759, 5, 63, 0, 0, 1759, 327, 1, 0, 0, 0, 1760, 1761, 5, 42, 0, 0, 1761, 1762, 5, 57, 0, 0, 1762, 1763, 3, 412, 206, 0, 1763, 1764, 5, 58, 0, 0, 1764, 1765, 3, 250, 125, 0, 1765, 329, 1, 0, 0, 0, 1766, 1767, 5, 47, 0, 0, 1767, 1768, 3, 250, 125, 0, 1768, 1769, 3, 332, 166, 0, 1769, 1779, 1, 0, 0, 0, 1770, 1771, 5, 47, 0, 0, 1771, 1773, 3, 250, 125, 0, 1772, 1774, 3, 332, 166, 0, 1773, 1772, 1, 0, 0, 0, 1773, 1774, 1, 0, 0, 0, 1774, 1775, 1, 0, 0, 0, 1775, 1776, 3, 340, 170, 0, 1776, 1779, 1, 0, 0, 0, 1777, 1779, 3, 342, 171, 0, 1778, 1766, 1, 0, 0, 0, 1778, 1770, 1, 0, 0, 0, 1778, 1777, 1, 0, 0, 0, 1779, 331, 1, 0, 0, 0, 1780, 1784, 3, 334, 167, 0, 1781, 1783, 3, 334, 167, 0, 1782, 1781, 1, 0, 0, 0, 1783, 1786, 1, 0, 0, 0, 1784, 1782, 1, 0, 0, 0, 1784, 1785, 1, 0, 0, 0, 1785, 333, 1, 0, 0, 0, 1786, 1784, 1, 0, 0, 0, 1787, 1788, 5, 7, 0, 0, 1788, 1789, 5, 57, 0, 0, 1789, 1790, 3, 336, 168, 0, 1790, 1791, 5, 58, 0, 0, 1791, 1792, 3, 250, 125, 0, 1792, 335, 1, 0, 0, 0, 1793, 1795, 3, 154, 77, 0, 1794, 1793, 1, 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1796, 1797, 1, 0, 0, 0, 1797, 1799, 1, 0, 0, 0, 1798, 1796, 1, 0, 0, 0, 1799, 1800, 3, 338, 169, 0, 1800, 1801, 3, 110, 55, 0, 1801, 337, 1, 0, 0, 0, 1802, 1807, 3, 122, 61, 0, 1803, 1804, 5, 86, 0, 0, 1804, 1806, 3, 14, 7, 0, 1805, 1803, 1, 0, 0, 0, 1806, 1809, 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1807, 1808, 1, 0, 0, 0, 1808, 339, 1, 0, 0, 0, 1809, 1807, 1, 0, 0, 0, 1810, 1811, 5, 19, 0, 0, 1811, 1812, 3, 250, 125, 0, 1812, 341, 1, 0, 0, 0, 1813, 1814, 5, 47, 0, 0, 1814, 1815, 3, 344, 172, 0, 1815, 1817, 3, 250, 125, 0, 1816, 1818, 3, 332, 166, 0, 1817, 1816, 1, 0, 0, 0, 1817, 1818, 1, 0, 0, 0, 1818, 1820, 1, 0, 0, 0, 1819, 1821, 3, 340, 170, 0, 1820, 1819, 1, 0, 0, 0, 1820, 1821, 1, 0, 0, 0, 1821, 343, 1, 0, 0, 0, 1822, 1823, 5, 57, 0, 0, 1823, 1825, 3, 346, 173, 0, 1824, 1826, 5, 63, 0, 0, 1825, 1824, 1, 0, 0, 0, 1825, 1826, 1, 0, 0, 0, 1826, 1827, 1, 0, 0, 0, 1827, 1828, 5, 58, 0, 0, 1828, 345, 1, 0, 0, 0, 1829, 1834, 3, 348, 174, 0, 1830, 1831, 5, 63, 0, 0, 1831, 1833, 3, 348, 174, 0, 1832, 1830, 1, 0, 0, 0, 1833, 1836, 1, 0, 0, 0, 1834, 1832, 1, 0, 0, 0, 1834, 1835, 1, 0, 0, 0, 1835, 347, 1, 0, 0, 0, 1836, 1834, 1, 0, 0, 0, 1837, 1839, 3, 154, 77, 0, 1838, 1837, 1, 0, 0, 0, 1839, 1842, 1, 0, 0, 0, 1840, 1838, 1, 0, 0, 0, 1840, 1841, 1, 0, 0, 0, 1841, 1843, 1, 0, 0, 0, 1842, 1840, 1, 0, 0, 0, 1843, 1844, 3, 114, 57, 0, 1844, 1845, 3, 110, 55, 0, 1845, 1846, 5, 66, 0, 0, 1846, 1847, 3, 412, 206, 0, 1847, 349, 1, 0, 0, 0, 1848, 1851, 3, 364, 182, 0, 1849, 1851, 3, 404, 202, 0, 1850, 1848, 1, 0, 0, 0, 1850, 1849, 1, 0, 0, 0, 1851, 1855, 1, 0, 0, 0, 1852, 1854, 3, 358, 179, 0, 1853, 1852, 1, 0, 0, 0, 1854, 1857, 1, 0, 0, 0, 1855, 1853, 1, 0, 0, 0, 1855, 1856, 1, 0, 0, 0, 1856, 351, 1, 0, 0, 0, 1857, 1855, 1, 0, 0, 0, 1858, 1888, 3, 0, 0, 0, 1859, 1864, 3, 52, 26, 0, 1860, 1861, 5, 61, 0, 0, 1861, 1863, 5, 62, 0, 0, 1862, 1860, 1, 0, 0, 0, 1863, 1866, 1, 0, 0, 0, 1864, 1862, 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1867, 1, 0, 0, 0, 1866, 1864, 1, 0, 0, 0, 1867, 1868, 5, 65, 0, 0, 1868, 1869, 5, 9, 0, 0, 1869, 1888, 1, 0, 0, 0, 1870, 1871, 5, 48, 0, 0, 1871, 1872, 5, 65, 0, 0, 1872, 1888, 5, 9, 0, 0, 1873, 1888, 5, 43, 0, 0, 1874, 1875, 3, 52, 26, 0, 1875, 1876, 5, 65, 0, 0, 1876, 1877, 5, 43, 0, 0, 1877, 1888, 1, 0, 0, 0, 1878, 1879, 5, 57, 0, 0, 1879, 1880, 3, 412, 206, 0, 1880, 1881, 5, 58, 0, 0, 1881, 1888, 1, 0, 0, 0, 1882, 1888, 3, 370, 185, 0, 1883, 1888, 3, 378, 189, 0, 1884, 1888, 3, 384, 192, 0, 1885, 1888, 3, 390, 195, 0, 1886, 1888, 3, 398, 199, 0, 1887, 1858, 1, 0, 0, 0, 1887, 1859, 1, 0, 0, 0, 1887, 1870, 1, 0, 0, 0, 1887, 1873, 1, 0, 0, 0, 1887, 1874, 1, 0, 0, 0, 1887, 1878, 1, 0, 0, 0, 1887, 1882, 1, 0, 0, 0, 1887, 1883, 1, 0, 0, 0, 1887, 1884, 1, 0, 0, 0, 1887, 1885, 1, 0, 0, 0, 1887, 1886, 1, 0, 0, 0, 1888, 353, 1, 0, 0, 0, 1889, 1890, 1, 0, 0, 0, 1890, 355, 1, 0, 0, 0, 1891, 1920, 3, 0, 0, 0, 1892, 1897, 3, 52, 26, 0, 1893, 1894, 5, 61, 0, 0, 1894, 1896, 5, 62, 0, 0, 1895, 1893, 1, 0, 0, 0, 1896, 1899, 1, 0, 0, 0, 1897, 1895, 1, 0, 0, 0, 1897, 1898, 1, 0, 0, 0, 1898, 1900, 1, 0, 0, 0, 1899, 1897, 1, 0, 0, 0, 1900, 1901, 5, 65, 0, 0, 1901, 1902, 5, 9, 0, 0, 1902, 1920, 1, 0, 0, 0, 1903, 1904, 5, 48, 0, 0, 1904, 1905, 5, 65, 0, 0, 1905, 1920, 5, 9, 0, 0, 1906, 1920, 5, 43, 0, 0, 1907, 1908, 3, 52, 26, 0, 1908, 1909, 5, 65, 0, 0, 1909, 1910, 5, 43, 0, 0, 1910, 1920, 1, 0, 0, 0, 1911, 1912, 5, 57, 0, 0, 1912, 1913, 3, 412, 206, 0, 1913, 1914, 5, 58, 0, 0, 1914, 1920, 1, 0, 0, 0, 1915, 1920, 3, 370, 185, 0, 1916, 1920, 3, 378, 189, 0, 1917, 1920, 3, 390, 195, 0, 1918, 1920, 3, 398, 199, 0, 1919, 1891, 1, 0, 0, 0, 1919, 1892, 1, 0, 0, 0, 1919, 1903, 1, 0, 0, 0, 1919, 1906, 1, 0, 0, 0, 1919, 1907, 1, 0, 0, 0, 1919, 1911, 1, 0, 0, 0, 1919, 1915, 1, 0, 0, 0, 1919, 1916, 1, 0, 0, 0, 1919, 1917, 1, 0, 0, 0, 1919, 1918, 1, 0, 0, 0, 1920, 357, 1, 0, 0, 0, 1921, 1927, 3, 372, 186, 0, 1922, 1927, 3, 380, 190, 0, 1923, 1927, 3, 386, 193, 0, 1924, 1927, 3, 392, 196, 0, 1925, 1927, 3, 400, 200, 0, 1926, 1921, 1, 0, 0, 0, 1926, 1922, 1, 0, 0, 0, 1926, 1923, 1, 0, 0, 0, 1926, 1924, 1, 0, 0, 0, 1926, 1925, 1, 0, 0, 0, 1927, 359, 1, 0, 0, 0, 1928, 1929, 1, 0, 0, 0, 1929, 361, 1, 0, 0, 0, 1930, 1935, 3, 372, 186, 0, 1931, 1935, 3, 380, 190, 0, 1932, 1935, 3, 392, 196, 0, 1933, 1935, 3, 400, 200, 0, 1934, 1930, 1, 0, 0, 0, 1934, 1931, 1, 0, 0, 0, 1934, 1932, 1, 0, 0, 0, 1934, 1933, 1, 0, 0, 0, 1935, 363, 1, 0, 0, 0, 1936, 1977, 3, 0, 0, 0, 1937, 1942, 3, 52, 26, 0, 1938, 1939, 5, 61, 0, 0, 1939, 1941, 5, 62, 0, 0, 1940, 1938, 1, 0, 0, 0, 1941, 1944, 1, 0, 0, 0, 1942, 1940, 1, 0, 0, 0, 1942, 1943, 1, 0, 0, 0, 1943, 1945, 1, 0, 0, 0, 1944, 1942, 1, 0, 0, 0, 1945, 1946, 5, 65, 0, 0, 1946, 1947, 5, 9, 0, 0, 1947, 1977, 1, 0, 0, 0, 1948, 1953, 3, 116, 58, 0, 1949, 1950, 5, 61, 0, 0, 1950, 1952, 5, 62, 0, 0, 1951, 1949, 1, 0, 0, 0, 1952, 1955, 1, 0, 0, 0, 1953, 1951, 1, 0, 0, 0, 1953, 1954, 1, 0, 0, 0, 1954, 1956, 1, 0, 0, 0, 1955, 1953, 1, 0, 0, 0, 1956, 1957, 5, 65, 0, 0, 1957, 1958, 5, 9, 0, 0, 1958, 1977, 1, 0, 0, 0, 1959, 1960, 5, 48, 0, 0, 1960, 1961, 5, 65, 0, 0, 1961, 1977, 5, 9, 0, 0, 1962, 1977, 5, 43, 0, 0, 1963, 1964, 3, 52, 26, 0, 1964, 1965, 5, 65, 0, 0, 1965, 1966, 5, 43, 0, 0, 1966, 1977, 1, 0, 0, 0, 1967, 1968, 5, 57, 0, 0, 1968, 1969, 3, 412, 206, 0, 1969, 1970, 5, 58, 0, 0, 1970, 1977, 1, 0, 0, 0, 1971, 1977, 3, 374, 187, 0, 1972, 1977, 3, 382, 191, 0, 1973, 1977, 3, 388, 194, 0, 1974, 1977, 3, 394, 197, 0, 1975, 1977, 3, 402, 201, 0, 1976, 1936, 1, 0, 0, 0, 1976, 1937, 1, 0, 0, 0, 1976, 1948, 1, 0, 0, 0, 1976, 1959, 1, 0, 0, 0, 1976, 1962, 1, 0, 0, 0, 1976, 1963, 1, 0, 0, 0, 1976, 1967, 1, 0, 0, 0, 1976, 1971, 1, 0, 0, 0, 1976, 1972, 1, 0, 0, 0, 1976, 1973, 1, 0, 0, 0, 1976, 1974, 1, 0, 0, 0, 1976, 1975, 1, 0, 0, 0, 1977, 365, 1, 0, 0, 0, 1978, 1979, 1, 0, 0, 0, 1979, 367, 1, 0, 0, 0, 1980, 2020, 3, 0, 0, 0, 1981, 1986, 3, 52, 26, 0, 1982, 1983, 5, 61, 0, 0, 1983, 1985, 5, 62, 0, 0, 1984, 1982, 1, 0, 0, 0, 1985, 1988, 1, 0, 0, 0, 1986, 1984, 1, 0, 0, 0, 1986, 1987, 1, 0, 0, 0, 1987, 1989, 1, 0, 0, 0, 1988, 1986, 1, 0, 0, 0, 1989, 1990, 5, 65, 0, 0, 1990, 1991, 5, 9, 0, 0, 1991, 2020, 1, 0, 0, 0, 1992, 1997, 3, 116, 58, 0, 1993, 1994, 5, 61, 0, 0, 1994, 1996, 5, 62, 0, 0, 1995, 1993, 1, 0, 0, 0, 1996, 1999, 1, 0, 0, 0, 1997, 1995, 1, 0, 0, 0, 1997, 1998, 1, 0, 0, 0, 1998, 2000, 1, 0, 0, 0, 1999, 1997, 1, 0, 0, 0, 2000, 2001, 5, 65, 0, 0, 2001, 2002, 5, 9, 0, 0, 2002, 2020, 1, 0, 0, 0, 2003, 2004, 5, 48, 0, 0, 2004, 2005, 5, 65, 0, 0, 2005, 2020, 5, 9, 0, 0, 2006, 2020, 5, 43, 0, 0, 2007, 2008, 3, 52, 26, 0, 2008, 2009, 5, 65, 0, 0, 2009, 2010, 5, 43, 0, 0, 2010, 2020, 1, 0, 0, 0, 2011, 2012, 5, 57, 0, 0, 2012, 2013, 3, 412, 206, 0, 2013, 2014, 5, 58, 0, 0, 2014, 2020, 1, 0, 0, 0, 2015, 2020, 3, 374, 187, 0, 2016, 2020, 3, 382, 191, 0, 2017, 2020, 3, 394, 197, 0, 2018, 2020, 3, 402, 201, 0, 2019, 1980, 1, 0, 0, 0, 2019, 1981, 1, 0, 0, 0, 2019, 1992, 1, 0, 0, 0, 2019, 2003, 1, 0, 0, 0, 2019, 2006, 1, 0, 0, 0, 2019, 2007, 1, 0, 0, 0, 2019, 2011, 1, 0, 0, 0, 2019, 2015, 1, 0, 0, 0, 2019, 2016, 1, 0, 0, 0, 2019, 2017, 1, 0, 0, 0, 2019, 2018, 1, 0, 0, 0, 2020, 369, 1, 0, 0, 0, 2021, 2023, 5, 31, 0, 0, 2022, 2024, 3, 40, 20, 0, 2023, 2022, 1, 0, 0, 0, 2023, 2024, 1, 0, 0, 0, 2024, 2028, 1, 0, 0, 0, 2025, 2027, 3, 228, 114, 0, 2026, 2025, 1, 0, 0, 0, 2027, 2030, 1, 0, 0, 0, 2028, 2026, 1, 0, 0, 0, 2028, 2029, 1, 0, 0, 0, 2029, 2031, 1, 0, 0, 0, 2030, 2028, 1, 0, 0, 0, 2031, 2042, 5, 102, 0, 0, 2032, 2036, 5, 65, 0, 0, 2033, 2035, 3, 228, 114, 0, 2034, 2033, 1, 0, 0, 0, 2035, 2038, 1, 0, 0, 0, 2036, 2034, 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2039, 1, 0, 0, 0, 2038, 2036, 1, 0, 0, 0, 2039, 2041, 5, 102, 0, 0, 2040, 2032, 1, 0, 0, 0, 2041, 2044, 1, 0, 0, 0, 2042, 2040, 1, 0, 0, 0, 2042, 2043, 1, 0, 0, 0, 2043, 2046, 1, 0, 0, 0, 2044, 2042, 1, 0, 0, 0, 2045, 2047, 3, 376, 188, 0, 2046, 2045, 1, 0, 0, 0, 2046, 2047, 1, 0, 0, 0, 2047, 2048, 1, 0, 0, 0, 2048, 2050, 5, 57, 0, 0, 2049, 2051, 3, 396, 198, 0, 2050, 2049, 1, 0, 0, 0, 2050, 2051, 1, 0, 0, 0, 2051, 2052, 1, 0, 0, 0, 2052, 2054, 5, 58, 0, 0, 2053, 2055, 3, 96, 48, 0, 2054, 2053, 1, 0, 0, 0, 2054, 2055, 1, 0, 0, 0, 2055, 2105, 1, 0, 0, 0, 2056, 2057, 3, 56, 28, 0, 2057, 2058, 5, 65, 0, 0, 2058, 2060, 5, 31, 0, 0, 2059, 2061, 3, 40, 20, 0, 2060, 2059, 1, 0, 0, 0, 2060, 2061, 1, 0, 0, 0, 2061, 2065, 1, 0, 0, 0, 2062, 2064, 3, 228, 114, 0, 2063, 2062, 1, 0, 0, 0, 2064, 2067, 1, 0, 0, 0, 2065, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 2068, 1, 0, 0, 0, 2067, 2065, 1, 0, 0, 0, 2068, 2070, 5, 102, 0, 0, 2069, 2071, 3, 376, 188, 0, 2070, 2069, 1, 0, 0, 0, 2070, 2071, 1, 0, 0, 0, 2071, 2072, 1, 0, 0, 0, 2072, 2074, 5, 57, 0, 0, 2073, 2075, 3, 396, 198, 0, 2074, 2073, 1, 0, 0, 0, 2074, 2075, 1, 0, 0, 0, 2075, 2076, 1, 0, 0, 0, 2076, 2078, 5, 58, 0, 0, 2077, 2079, 3, 96, 48, 0, 2078, 2077, 1, 0, 0, 0, 2078, 2079, 1, 0, 0, 0, 2079, 2105, 1, 0, 0, 0, 2080, 2081, 3, 350, 175, 0, 2081, 2082, 5, 65, 0, 0, 2082, 2084, 5, 31, 0, 0, 2083, 2085, 3, 40, 20, 0, 2084, 2083, 1, 0, 0, 0, 2084, 2085, 1, 0, 0, 0, 2085, 2089, 1, 0, 0, 0, 2086, 2088, 3, 228, 114, 0, 2087, 2086, 1, 0, 0, 0, 2088, 2091, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, 2089, 2090, 1, 0, 0, 0, 2090, 2092, 1, 0, 0, 0, 2091, 2089, 1, 0, 0, 0, 2092, 2094, 5, 102, 0, 0, 2093, 2095, 3, 376, 188, 0, 2094, 2093, 1, 0, 0, 0, 2094, 2095, 1, 0, 0, 0, 2095, 2096, 1, 0, 0, 0, 2096, 2098, 5, 57, 0, 0, 2097, 2099, 3, 396, 198, 0, 2098, 2097, 1, 0, 0, 0, 2098, 2099, 1, 0, 0, 0, 2099, 2100, 1, 0, 0, 0, 2100, 2102, 5, 58, 0, 0, 2101, 2103, 3, 96, 48, 0, 2102, 2101, 1, 0, 0, 0, 2102, 2103, 1, 0, 0, 0, 2103, 2105, 1, 0, 0, 0, 2104, 2021, 1, 0, 0, 0, 2104, 2056, 1, 0, 0, 0, 2104, 2080, 1, 0, 0, 0, 2105, 371, 1, 0, 0, 0, 2106, 2107, 5, 65, 0, 0, 2107, 2109, 5, 31, 0, 0, 2108, 2110, 3, 40, 20, 0, 2109, 2108, 1, 0, 0, 0, 2109, 2110, 1, 0, 0, 0, 2110, 2114, 1, 0, 0, 0, 2111, 2113, 3, 228, 114, 0, 2112, 2111, 1, 0, 0, 0, 2113, 2116, 1, 0, 0, 0, 2114, 2112, 1, 0, 0, 0, 2114, 2115, 1, 0, 0, 0, 2115, 2117, 1, 0, 0, 0, 2116, 2114, 1, 0, 0, 0, 2117, 2119, 5, 102, 0, 0, 2118, 2120, 3, 376, 188, 0, 2119, 2118, 1, 0, 0, 0, 2119, 2120, 1, 0, 0, 0, 2120, 2121, 1, 0, 0, 0, 2121, 2123, 5, 57, 0, 0, 2122, 2124, 3, 396, 198, 0, 2123, 2122, 1, 0, 0, 0, 2123, 2124, 1, 0, 0, 0, 2124, 2125, 1, 0, 0, 0, 2125, 2127, 5, 58, 0, 0, 2126, 2128, 3, 96, 48, 0, 2127, 2126, 1, 0, 0, 0, 2127, 2128, 1, 0, 0, 0, 2128, 373, 1, 0, 0, 0, 2129, 2131, 5, 31, 0, 0, 2130, 2132, 3, 40, 20, 0, 2131, 2130, 1, 0, 0, 0, 2131, 2132, 1, 0, 0, 0, 2132, 2136, 1, 0, 0, 0, 2133, 2135, 3, 228, 114, 0, 2134, 2133, 1, 0, 0, 0, 2135, 2138, 1, 0, 0, 0, 2136, 2134, 1, 0, 0, 0, 2136, 2137, 1, 0, 0, 0, 2137, 2139, 1, 0, 0, 0, 2138, 2136, 1, 0, 0, 0, 2139, 2150, 5, 102, 0, 0, 2140, 2144, 5, 65, 0, 0, 2141, 2143, 3, 228, 114, 0, 2142, 2141, 1, 0, 0, 0, 2143, 2146, 1, 0, 0, 0, 2144, 2142, 1, 0, 0, 0, 2144, 2145, 1, 0, 0, 0, 2145, 2147, 1, 0, 0, 0, 2146, 2144, 1, 0, 0, 0, 2147, 2149, 5, 102, 0, 0, 2148, 2140, 1, 0, 0, 0, 2149, 2152, 1, 0, 0, 0, 2150, 2148, 1, 0, 0, 0, 2150, 2151, 1, 0, 0, 0, 2151, 2154, 1, 0, 0, 0, 2152, 2150, 1, 0, 0, 0, 2153, 2155, 3, 376, 188, 0, 2154, 2153, 1, 0, 0, 0, 2154, 2155, 1, 0, 0, 0, 2155, 2156, 1, 0, 0, 0, 2156, 2158, 5, 57, 0, 0, 2157, 2159, 3, 396, 198, 0, 2158, 2157, 1, 0, 0, 0, 2158, 2159, 1, 0, 0, 0, 2159, 2160, 1, 0, 0, 0, 2160, 2162, 5, 58, 0, 0, 2161, 2163, 3, 96, 48, 0, 2162, 2161, 1, 0, 0, 0, 2162, 2163, 1, 0, 0, 0, 2163, 2189, 1, 0, 0, 0, 2164, 2165, 3, 56, 28, 0, 2165, 2166, 5, 65, 0, 0, 2166, 2168, 5, 31, 0, 0, 2167, 2169, 3, 40, 20, 0, 2168, 2167, 1, 0, 0, 0, 2168, 2169, 1, 0, 0, 0, 2169, 2173, 1, 0, 0, 0, 2170, 2172, 3, 228, 114, 0, 2171, 2170, 1, 0, 0, 0, 2172, 2175, 1, 0, 0, 0, 2173, 2171, 1, 0, 0, 0, 2173, 2174, 1, 0, 0, 0, 2174, 2176, 1, 0, 0, 0, 2175, 2173, 1, 0, 0, 0, 2176, 2178, 5, 102, 0, 0, 2177, 2179, 3, 376, 188, 0, 2178, 2177, 1, 0, 0, 0, 2178, 2179, 1, 0, 0, 0, 2179, 2180, 1, 0, 0, 0, 2180, 2182, 5, 57, 0, 0, 2181, 2183, 3, 396, 198, 0, 2182, 2181, 1, 0, 0, 0, 2182, 2183, 1, 0, 0, 0, 2183, 2184, 1, 0, 0, 0, 2184, 2186, 5, 58, 0, 0, 2185, 2187, 3, 96, 48, 0, 2186, 2185, 1, 0, 0, 0, 2186, 2187, 1, 0, 0, 0, 2187, 2189, 1, 0, 0, 0, 2188, 2129, 1, 0, 0, 0, 2188, 2164, 1, 0, 0, 0, 2189, 375, 1, 0, 0, 0, 2190, 2194, 3, 40, 20, 0, 2191, 2192, 5, 68, 0, 0, 2192, 2194, 5, 67, 0, 0, 2193, 2190, 1, 0, 0, 0, 2193, 2191, 1, 0, 0, 0, 2194, 377, 1, 0, 0, 0, 2195, 2196, 3, 350, 175, 0, 2196, 2197, 5, 65, 0, 0, 2197, 2198, 5, 102, 0, 0, 2198, 2209, 1, 0, 0, 0, 2199, 2200, 5, 40, 0, 0, 2200, 2201, 5, 65, 0, 0, 2201, 2209, 5, 102, 0, 0, 2202, 2203, 3, 52, 26, 0, 2203, 2204, 5, 65, 0, 0, 2204, 2205, 5, 40, 0, 0, 2205, 2206, 5, 65, 0, 0, 2206, 2207, 5, 102, 0, 0, 2207, 2209, 1, 0, 0, 0, 2208, 2195, 1, 0, 0, 0, 2208, 2199, 1, 0, 0, 0, 2208, 2202, 1, 0, 0, 0, 2209, 379, 1, 0, 0, 0, 2210, 2211, 5, 65, 0, 0, 2211, 2212, 5, 102, 0, 0, 2212, 381, 1, 0, 0, 0, 2213, 2214, 5, 40, 0, 0, 2214, 2215, 5, 65, 0, 0, 2215, 2223, 5, 102, 0, 0, 2216, 2217, 3, 52, 26, 0, 2217, 2218, 5, 65, 0, 0, 2218, 2219, 5, 40, 0, 0, 2219, 2220, 5, 65, 0, 0, 2220, 2221, 5, 102, 0, 0, 2221, 2223, 1, 0, 0, 0, 2222, 2213, 1, 0, 0, 0, 2222, 2216, 1, 0, 0, 0, 2223, 383, 1, 0, 0, 0, 2224, 2225, 3, 56, 28, 0, 2225, 2226, 5, 61, 0, 0, 2226, 2227, 3, 412, 206, 0, 2227, 2228, 5, 62, 0, 0, 2228, 2235, 1, 0, 0, 0, 2229, 2230, 3, 356, 178, 0, 2230, 2231, 5, 61, 0, 0, 2231, 2232, 3, 412, 206, 0, 2232, 2233, 5, 62, 0, 0, 2233, 2235, 1, 0, 0, 0, 2234, 2224, 1, 0, 0, 0, 2234, 2229, 1, 0, 0, 0, 2235, 2243, 1, 0, 0, 0, 2236, 2237, 3, 354, 177, 0, 2237, 2238, 5, 61, 0, 0, 2238, 2239, 3, 412, 206, 0, 2239, 2240, 5, 62, 0, 0, 2240, 2242, 1, 0, 0, 0, 2241, 2236, 1, 0, 0, 0, 2242, 2245, 1, 0, 0, 0, 2243, 2241, 1, 0, 0, 0, 2243, 2244, 1, 0, 0, 0, 2244, 385, 1, 0, 0, 0, 2245, 2243, 1, 0, 0, 0, 2246, 2247, 3, 362, 181, 0, 2247, 2248, 5, 61, 0, 0, 2248, 2249, 3, 412, 206, 0, 2249, 2257, 5, 62, 0, 0, 2250, 2251, 3, 360, 180, 0, 2251, 2252, 5, 61, 0, 0, 2252, 2253, 3, 412, 206, 0, 2253, 2254, 5, 62, 0, 0, 2254, 2256, 1, 0, 0, 0, 2255, 2250, 1, 0, 0, 0, 2256, 2259, 1, 0, 0, 0, 2257, 2255, 1, 0, 0, 0, 2257, 2258, 1, 0, 0, 0, 2258, 387, 1, 0, 0, 0, 2259, 2257, 1, 0, 0, 0, 2260, 2261, 3, 56, 28, 0, 2261, 2262, 5, 61, 0, 0, 2262, 2263, 3, 412, 206, 0, 2263, 2264, 5, 62, 0, 0, 2264, 2271, 1, 0, 0, 0, 2265, 2266, 3, 368, 184, 0, 2266, 2267, 5, 61, 0, 0, 2267, 2268, 3, 412, 206, 0, 2268, 2269, 5, 62, 0, 0, 2269, 2271, 1, 0, 0, 0, 2270, 2260, 1, 0, 0, 0, 2270, 2265, 1, 0, 0, 0, 2271, 2279, 1, 0, 0, 0, 2272, 2273, 3, 366, 183, 0, 2273, 2274, 5, 61, 0, 0, 2274, 2275, 3, 412, 206, 0, 2275, 2276, 5, 62, 0, 0, 2276, 2278, 1, 0, 0, 0, 2277, 2272, 1, 0, 0, 0, 2278, 2281, 1, 0, 0, 0, 2279, 2277, 1, 0, 0, 0, 2279, 2280, 1, 0, 0, 0, 2280, 389, 1, 0, 0, 0, 2281, 2279, 1, 0, 0, 0, 2282, 2283, 3, 58, 29, 0, 2283, 2285, 5, 57, 0, 0, 2284, 2286, 3, 396, 198, 0, 2285, 2284, 1, 0, 0, 0, 2285, 2286, 1, 0, 0, 0, 2286, 2287, 1, 0, 0, 0, 2287, 2288, 5, 58, 0, 0, 2288, 2351, 1, 0, 0, 0, 2289, 2290, 3, 52, 26, 0, 2290, 2292, 5, 65, 0, 0, 2291, 2293, 3, 40, 20, 0, 2292, 2291, 1, 0, 0, 0, 2292, 2293, 1, 0, 0, 0, 2293, 2294, 1, 0, 0, 0, 2294, 2295, 5, 102, 0, 0, 2295, 2297, 5, 57, 0, 0, 2296, 2298, 3, 396, 198, 0, 2297, 2296, 1, 0, 0, 0, 2297, 2298, 1, 0, 0, 0, 2298, 2299, 1, 0, 0, 0, 2299, 2300, 5, 58, 0, 0, 2300, 2351, 1, 0, 0, 0, 2301, 2302, 3, 56, 28, 0, 2302, 2304, 5, 65, 0, 0, 2303, 2305, 3, 40, 20, 0, 2304, 2303, 1, 0, 0, 0, 2304, 2305, 1, 0, 0, 0, 2305, 2306, 1, 0, 0, 0, 2306, 2307, 5, 102, 0, 0, 2307, 2309, 5, 57, 0, 0, 2308, 2310, 3, 396, 198, 0, 2309, 2308, 1, 0, 0, 0, 2309, 2310, 1, 0, 0, 0, 2310, 2311, 1, 0, 0, 0, 2311, 2312, 5, 58, 0, 0, 2312, 2351, 1, 0, 0, 0, 2313, 2314, 3, 350, 175, 0, 2314, 2316, 5, 65, 0, 0, 2315, 2317, 3, 40, 20, 0, 2316, 2315, 1, 0, 0, 0, 2316, 2317, 1, 0, 0, 0, 2317, 2318, 1, 0, 0, 0, 2318, 2319, 5, 102, 0, 0, 2319, 2321, 5, 57, 0, 0, 2320, 2322, 3, 396, 198, 0, 2321, 2320, 1, 0, 0, 0, 2321, 2322, 1, 0, 0, 0, 2322, 2323, 1, 0, 0, 0, 2323, 2324, 5, 58, 0, 0, 2324, 2351, 1, 0, 0, 0, 2325, 2326, 5, 40, 0, 0, 2326, 2328, 5, 65, 0, 0, 2327, 2329, 3, 40, 20, 0, 2328, 2327, 1, 0, 0, 0, 2328, 2329, 1, 0, 0, 0, 2329, 2330, 1, 0, 0, 0, 2330, 2331, 5, 102, 0, 0, 2331, 2333, 5, 57, 0, 0, 2332, 2334, 3, 396, 198, 0, 2333, 2332, 1, 0, 0, 0, 2333, 2334, 1, 0, 0, 0, 2334, 2335, 1, 0, 0, 0, 2335, 2351, 5, 58, 0, 0, 2336, 2337, 3, 52, 26, 0, 2337, 2338, 5, 65, 0, 0, 2338, 2339, 5, 40, 0, 0, 2339, 2341, 5, 65, 0, 0, 2340, 2342, 3, 40, 20, 0, 2341, 2340, 1, 0, 0, 0, 2341, 2342, 1, 0, 0, 0, 2342, 2343, 1, 0, 0, 0, 2343, 2344, 5, 102, 0, 0, 2344, 2346, 5, 57, 0, 0, 2345, 2347, 3, 396, 198, 0, 2346, 2345, 1, 0, 0, 0, 2346, 2347, 1, 0, 0, 0, 2347, 2348, 1, 0, 0, 0, 2348, 2349, 5, 58, 0, 0, 2349, 2351, 1, 0, 0, 0, 2350, 2282, 1, 0, 0, 0, 2350, 2289, 1, 0, 0, 0, 2350, 2301, 1, 0, 0, 0, 2350, 2313, 1, 0, 0, 0, 2350, 2325, 1, 0, 0, 0, 2350, 2336, 1, 0, 0, 0, 2351, 391, 1, 0, 0, 0, 2352, 2354, 5, 65, 0, 0, 2353, 2355, 3, 40, 20, 0, 2354, 2353, 1, 0, 0, 0, 2354, 2355, 1, 0, 0, 0, 2355, 2356, 1, 0, 0, 0, 2356, 2357, 5, 102, 0, 0, 2357, 2359, 5, 57, 0, 0, 2358, 2360, 3, 396, 198, 0, 2359, 2358, 1, 0, 0, 0, 2359, 2360, 1, 0, 0, 0, 2360, 2361, 1, 0, 0, 0, 2361, 2362, 5, 58, 0, 0, 2362, 393, 1, 0, 0, 0, 2363, 2364, 3, 58, 29, 0, 2364, 2366, 5, 57, 0, 0, 2365, 2367, 3, 396, 198, 0, 2366, 2365, 1, 0, 0, 0, 2366, 2367, 1, 0, 0, 0, 2367, 2368, 1, 0, 0, 0, 2368, 2369, 5, 58, 0, 0, 2369, 2420, 1, 0, 0, 0, 2370, 2371, 3, 52, 26, 0, 2371, 2373, 5, 65, 0, 0, 2372, 2374, 3, 40, 20, 0, 2373, 2372, 1, 0, 0, 0, 2373, 2374, 1, 0, 0, 0, 2374, 2375, 1, 0, 0, 0, 2375, 2376, 5, 102, 0, 0, 2376, 2378, 5, 57, 0, 0, 2377, 2379, 3, 396, 198, 0, 2378, 2377, 1, 0, 0, 0, 2378, 2379, 1, 0, 0, 0, 2379, 2380, 1, 0, 0, 0, 2380, 2381, 5, 58, 0, 0, 2381, 2420, 1, 0, 0, 0, 2382, 2383, 3, 56, 28, 0, 2383, 2385, 5, 65, 0, 0, 2384, 2386, 3, 40, 20, 0, 2385, 2384, 1, 0, 0, 0, 2385, 2386, 1, 0, 0, 0, 2386, 2387, 1, 0, 0, 0, 2387, 2388, 5, 102, 0, 0, 2388, 2390, 5, 57, 0, 0, 2389, 2391, 3, 396, 198, 0, 2390, 2389, 1, 0, 0, 0, 2390, 2391, 1, 0, 0, 0, 2391, 2392, 1, 0, 0, 0, 2392, 2393, 5, 58, 0, 0, 2393, 2420, 1, 0, 0, 0, 2394, 2395, 5, 40, 0, 0, 2395, 2397, 5, 65, 0, 0, 2396, 2398, 3, 40, 20, 0, 2397, 2396, 1, 0, 0, 0, 2397, 2398, 1, 0, 0, 0, 2398, 2399, 1, 0, 0, 0, 2399, 2400, 5, 102, 0, 0, 2400, 2402, 5, 57, 0, 0, 2401, 2403, 3, 396, 198, 0, 2402, 2401, 1, 0, 0, 0, 2402, 2403, 1, 0, 0, 0, 2403, 2404, 1, 0, 0, 0, 2404, 2420, 5, 58, 0, 0, 2405, 2406, 3, 52, 26, 0, 2406, 2407, 5, 65, 0, 0, 2407, 2408, 5, 40, 0, 0, 2408, 2410, 5, 65, 0, 0, 2409, 2411, 3, 40, 20, 0, 2410, 2409, 1, 0, 0, 0, 2410, 2411, 1, 0, 0, 0, 2411, 2412, 1, 0, 0, 0, 2412, 2413, 5, 102, 0, 0, 2413, 2415, 5, 57, 0, 0, 2414, 2416, 3, 396, 198, 0, 2415, 2414, 1, 0, 0, 0, 2415, 2416, 1, 0, 0, 0, 2416, 2417, 1, 0, 0, 0, 2417, 2418, 5, 58, 0, 0, 2418, 2420, 1, 0, 0, 0, 2419, 2363, 1, 0, 0, 0, 2419, 2370, 1, 0, 0, 0, 2419, 2382, 1, 0, 0, 0, 2419, 2394, 1, 0, 0, 0, 2419, 2405, 1, 0, 0, 0, 2420, 395, 1, 0, 0, 0, 2421, 2426, 3, 412, 206, 0, 2422, 2423, 5, 64, 0, 0, 2423, 2425, 3, 412, 206, 0, 2424, 2422, 1, 0, 0, 0, 2425, 2428, 1, 0, 0, 0, 2426, 2424, 1, 0, 0, 0, 2426, 2427, 1, 0, 0, 0, 2427, 397, 1, 0, 0, 0, 2428, 2426, 1, 0, 0, 0, 2429, 2430, 3, 56, 28, 0, 2430, 2432, 5, 90, 0, 0, 2431, 2433, 3, 40, 20, 0, 2432, 2431, 1, 0, 0, 0, 2432, 2433, 1, 0, 0, 0, 2433, 2434, 1, 0, 0, 0, 2434, 2435, 5, 102, 0, 0, 2435, 2477, 1, 0, 0, 0, 2436, 2437, 3, 10, 5, 0, 2437, 2439, 5, 90, 0, 0, 2438, 2440, 3, 40, 20, 0, 2439, 2438, 1, 0, 0, 0, 2439, 2440, 1, 0, 0, 0, 2440, 2441, 1, 0, 0, 0, 2441, 2442, 5, 102, 0, 0, 2442, 2477, 1, 0, 0, 0, 2443, 2444, 3, 350, 175, 0, 2444, 2446, 5, 90, 0, 0, 2445, 2447, 3, 40, 20, 0, 2446, 2445, 1, 0, 0, 0, 2446, 2447, 1, 0, 0, 0, 2447, 2448, 1, 0, 0, 0, 2448, 2449, 5, 102, 0, 0, 2449, 2477, 1, 0, 0, 0, 2450, 2451, 5, 40, 0, 0, 2451, 2453, 5, 90, 0, 0, 2452, 2454, 3, 40, 20, 0, 2453, 2452, 1, 0, 0, 0, 2453, 2454, 1, 0, 0, 0, 2454, 2455, 1, 0, 0, 0, 2455, 2477, 5, 102, 0, 0, 2456, 2457, 3, 52, 26, 0, 2457, 2458, 5, 65, 0, 0, 2458, 2459, 5, 40, 0, 0, 2459, 2461, 5, 90, 0, 0, 2460, 2462, 3, 40, 20, 0, 2461, 2460, 1, 0, 0, 0, 2461, 2462, 1, 0, 0, 0, 2462, 2463, 1, 0, 0, 0, 2463, 2464, 5, 102, 0, 0, 2464, 2477, 1, 0, 0, 0, 2465, 2466, 3, 14, 7, 0, 2466, 2468, 5, 90, 0, 0, 2467, 2469, 3, 40, 20, 0, 2468, 2467, 1, 0, 0, 0, 2468, 2469, 1, 0, 0, 0, 2469, 2470, 1, 0, 0, 0, 2470, 2471, 5, 31, 0, 0, 2471, 2477, 1, 0, 0, 0, 2472, 2473, 3, 28, 14, 0, 2473, 2474, 5, 90, 0, 0, 2474, 2475, 5, 31, 0, 0, 2475, 2477, 1, 0, 0, 0, 2476, 2429, 1, 0, 0, 0, 2476, 2436, 1, 0, 0, 0, 2476, 2443, 1, 0, 0, 0, 2476, 2450, 1, 0, 0, 0, 2476, 2456, 1, 0, 0, 0, 2476, 2465, 1, 0, 0, 0, 2476, 2472, 1, 0, 0, 0, 2477, 399, 1, 0, 0, 0, 2478, 2480, 5, 90, 0, 0, 2479, 2481, 3, 40, 20, 0, 2480, 2479, 1, 0, 0, 0, 2480, 2481, 1, 0, 0, 0, 2481, 2482, 1, 0, 0, 0, 2482, 2483, 5, 102, 0, 0, 2483, 401, 1, 0, 0, 0, 2484, 2485, 3, 56, 28, 0, 2485, 2487, 5, 90, 0, 0, 2486, 2488, 3, 40, 20, 0, 2487, 2486, 1, 0, 0, 0, 2487, 2488, 1, 0, 0, 0, 2488, 2489, 1, 0, 0, 0, 2489, 2490, 5, 102, 0, 0, 2490, 2525, 1, 0, 0, 0, 2491, 2492, 3, 10, 5, 0, 2492, 2494, 5, 90, 0, 0, 2493, 2495, 3, 40, 20, 0, 2494, 2493, 1, 0, 0, 0, 2494, 2495, 1, 0, 0, 0, 2495, 2496, 1, 0, 0, 0, 2496, 2497, 5, 102, 0, 0, 2497, 2525, 1, 0, 0, 0, 2498, 2499, 5, 40, 0, 0, 2499, 2501, 5, 90, 0, 0, 2500, 2502, 3, 40, 20, 0, 2501, 2500, 1, 0, 0, 0, 2501, 2502, 1, 0, 0, 0, 2502, 2503, 1, 0, 0, 0, 2503, 2525, 5, 102, 0, 0, 2504, 2505, 3, 52, 26, 0, 2505, 2506, 5, 65, 0, 0, 2506, 2507, 5, 40, 0, 0, 2507, 2509, 5, 90, 0, 0, 2508, 2510, 3, 40, 20, 0, 2509, 2508, 1, 0, 0, 0, 2509, 2510, 1, 0, 0, 0, 2510, 2511, 1, 0, 0, 0, 2511, 2512, 5, 102, 0, 0, 2512, 2525, 1, 0, 0, 0, 2513, 2514, 3, 14, 7, 0, 2514, 2516, 5, 90, 0, 0, 2515, 2517, 3, 40, 20, 0, 2516, 2515, 1, 0, 0, 0, 2516, 2517, 1, 0, 0, 0, 2517, 2518, 1, 0, 0, 0, 2518, 2519, 5, 31, 0, 0, 2519, 2525, 1, 0, 0, 0, 2520, 2521, 3, 28, 14, 0, 2521, 2522, 5, 90, 0, 0, 2522, 2523, 5, 31, 0, 0, 2523, 2525, 1, 0, 0, 0, 2524, 2484, 1, 0, 0, 0, 2524, 2491, 1, 0, 0, 0, 2524, 2498, 1, 0, 0, 0, 2524, 2504, 1, 0, 0, 0, 2524, 2513, 1, 0, 0, 0, 2524, 2520, 1, 0, 0, 0, 2525, 403, 1, 0, 0, 0, 2526, 2527, 5, 31, 0, 0, 2527, 2528, 3, 2, 1, 0, 2528, 2530, 3, 406, 203, 0, 2529, 2531, 3, 30, 15, 0, 2530, 2529, 1, 0, 0, 0, 2530, 2531, 1, 0, 0, 0, 2531, 2549, 1, 0, 0, 0, 2532, 2533, 5, 31, 0, 0, 2533, 2534, 3, 12, 6, 0, 2534, 2536, 3, 406, 203, 0, 2535, 2537, 3, 30, 15, 0, 2536, 2535, 1, 0, 0, 0, 2536, 2537, 1, 0, 0, 0, 2537, 2549, 1, 0, 0, 0, 2538, 2539, 5, 31, 0, 0, 2539, 2540, 3, 2, 1, 0, 2540, 2541, 3, 30, 15, 0, 2541, 2542, 3, 246, 123, 0, 2542, 2549, 1, 0, 0, 0, 2543, 2544, 5, 31, 0, 0, 2544, 2545, 3, 12, 6, 0, 2545, 2546, 3, 30, 15, 0, 2546, 2547, 3, 246, 123, 0, 2547, 2549, 1, 0, 0, 0, 2548, 2526, 1, 0, 0, 0, 2548, 2532, 1, 0, 0, 0, 2548, 2538, 1, 0, 0, 0, 2548, 2543, 1, 0, 0, 0, 2549, 405, 1, 0, 0, 0, 2550, 2554, 3, 408, 204, 0, 2551, 2553, 3, 408, 204, 0, 2552, 2551, 1, 0, 0, 0, 2553, 2556, 1, 0, 0, 0, 2554, 2552, 1, 0, 0, 0, 2554, 2555, 1, 0, 0, 0, 2555, 407, 1, 0, 0, 0, 2556, 2554, 1, 0, 0, 0, 2557, 2559, 3, 228, 114, 0, 2558, 2557, 1, 0, 0, 0, 2559, 2562, 1, 0, 0, 0, 2560, 2558, 1, 0, 0, 0, 2560, 2561, 1, 0, 0, 0, 2561, 2563, 1, 0, 0, 0, 2562, 2560, 1, 0, 0, 0, 2563, 2564, 5, 61, 0, 0, 2564, 2565, 3, 412, 206, 0, 2565, 2566, 5, 62, 0, 0, 2566, 409, 1, 0, 0, 0, 2567, 2568, 3, 412, 206, 0, 2568, 411, 1, 0, 0, 0, 2569, 2572, 3, 414, 207, 0, 2570, 2572, 3, 422, 211, 0, 2571, 2569, 1, 0, 0, 0, 2571, 2570, 1, 0, 0, 0, 2572, 413, 1, 0, 0, 0, 2573, 2574, 3, 416, 208, 0, 2574, 2575, 5, 89, 0, 0, 2575, 2576, 3, 420, 210, 0, 2576, 415, 1, 0, 0, 0, 2577, 2588, 5, 102, 0, 0, 2578, 2580, 5, 57, 0, 0, 2579, 2581, 3, 148, 74, 0, 2580, 2579, 1, 0, 0, 0, 2580, 2581, 1, 0, 0, 0, 2581, 2582, 1, 0, 0, 0, 2582, 2588, 5, 58, 0, 0, 2583, 2584, 5, 57, 0, 0, 2584, 2585, 3, 418, 209, 0, 2585, 2586, 5, 58, 0, 0, 2586, 2588, 1, 0, 0, 0, 2587, 2577, 1, 0, 0, 0, 2587, 2578, 1, 0, 0, 0, 2587, 2583, 1, 0, 0, 0, 2588, 417, 1, 0, 0, 0, 2589, 2594, 5, 102, 0, 0, 2590, 2591, 5, 64, 0, 0, 2591, 2593, 5, 102, 0, 0, 2592, 2590, 1, 0, 0, 0, 2593, 2596, 1, 0, 0, 0, 2594, 2592, 1, 0, 0, 0, 2594, 2595, 1, 0, 0, 0, 2595, 419, 1, 0, 0, 0, 2596, 2594, 1, 0, 0, 0, 2597, 2600, 3, 412, 206, 0, 2598, 2600, 3, 250, 125, 0, 2599, 2597, 1, 0, 0, 0, 2599, 2598, 1, 0, 0, 0, 2600, 421, 1, 0, 0, 0, 2601, 2604, 3, 430, 215, 0, 2602, 2604, 3, 424, 212, 0, 2603, 2601, 1, 0, 0, 0, 2603, 2602, 1, 0, 0, 0, 2604, 423, 1, 0, 0, 0, 2605, 2606, 3, 426, 213, 0, 2606, 2607, 3, 428, 214, 0, 2607, 2608, 3, 412, 206, 0, 2608, 425, 1, 0, 0, 0, 2609, 2613, 3, 56, 28, 0, 2610, 2613, 3, 378, 189, 0, 2611, 2613, 3, 384, 192, 0, 2612, 2609, 1, 0, 0, 0, 2612, 2610, 1, 0, 0, 0, 2612, 2611, 1, 0, 0, 0, 2613, 427, 1, 0, 0, 0, 2614, 2615, 7, 3, 0, 0, 2615, 429, 1, 0, 0, 0, 2616, 2624, 3, 432, 216, 0, 2617, 2618, 3, 432, 216, 0, 2618, 2619, 5, 71, 0, 0, 2619, 2620, 3, 412, 206, 0, 2620, 2621, 5, 72, 0, 0, 2621, 2622, 3, 430, 215, 0, 2622, 2624, 1, 0, 0, 0, 2623, 2616, 1, 0, 0, 0, 2623, 2617, 1, 0, 0, 0, 2624, 431, 1, 0, 0, 0, 2625, 2626, 6, 216, -1, 0, 2626, 2627, 3, 434, 217, 0, 2627, 2633, 1, 0, 0, 0, 2628, 2629, 10, 1, 0, 0, 2629, 2630, 5, 78, 0, 0, 2630, 2632, 3, 434, 217, 0, 2631, 2628, 1, 0, 0, 0, 2632, 2635, 1, 0, 0, 0, 2633, 2631, 1, 0, 0, 0, 2633, 2634, 1, 0, 0, 0, 2634, 433, 1, 0, 0, 0, 2635, 2633, 1, 0, 0, 0, 2636, 2637, 6, 217, -1, 0, 2637, 2638, 3, 436, 218, 0, 2638, 2644, 1, 0, 0, 0, 2639, 2640, 10, 1, 0, 0, 2640, 2641, 5, 77, 0, 0, 2641, 2643, 3, 436, 218, 0, 2642, 2639, 1, 0, 0, 0, 2643, 2646, 1, 0, 0, 0, 2644, 2642, 1, 0, 0, 0, 2644, 2645, 1, 0, 0, 0, 2645, 435, 1, 0, 0, 0, 2646, 2644, 1, 0, 0, 0, 2647, 2648, 6, 218, -1, 0, 2648, 2649, 3, 438, 219, 0, 2649, 2655, 1, 0, 0, 0, 2650, 2651, 10, 1, 0, 0, 2651, 2652, 5, 86, 0, 0, 2652, 2654, 3, 438, 219, 0, 2653, 2650, 1, 0, 0, 0, 2654, 2657, 1, 0, 0, 0, 2655, 2653, 1, 0, 0, 0, 2655, 2656, 1, 0, 0, 0, 2656, 437, 1, 0, 0, 0, 2657, 2655, 1, 0, 0, 0, 2658, 2659, 6, 219, -1, 0, 2659, 2660, 3, 440, 220, 0, 2660, 2666, 1, 0, 0, 0, 2661, 2662, 10, 1, 0, 0, 2662, 2663, 5, 87, 0, 0, 2663, 2665, 3, 440, 220, 0, 2664, 2661, 1, 0, 0, 0, 2665, 2668, 1, 0, 0, 0, 2666, 2664, 1, 0, 0, 0, 2666, 2667, 1, 0, 0, 0, 2667, 439, 1, 0, 0, 0, 2668, 2666, 1, 0, 0, 0, 2669, 2670, 6, 220, -1, 0, 2670, 2671, 3, 442, 221, 0, 2671, 2677, 1, 0, 0, 0, 2672, 2673, 10, 1, 0, 0, 2673, 2674, 5, 85, 0, 0, 2674, 2676, 3, 442, 221, 0, 2675, 2672, 1, 0, 0, 0, 2676, 2679, 1, 0, 0, 0, 2677, 2675, 1, 0, 0, 0, 2677, 2678, 1, 0, 0, 0, 2678, 441, 1, 0, 0, 0, 2679, 2677, 1, 0, 0, 0, 2680, 2681, 6, 221, -1, 0, 2681, 2682, 3, 444, 222, 0, 2682, 2691, 1, 0, 0, 0, 2683, 2684, 10, 2, 0, 0, 2684, 2685, 5, 73, 0, 0, 2685, 2690, 3, 444, 222, 0, 2686, 2687, 10, 1, 0, 0, 2687, 2688, 5, 76, 0, 0, 2688, 2690, 3, 444, 222, 0, 2689, 2683, 1, 0, 0, 0, 2689, 2686, 1, 0, 0, 0, 2690, 2693, 1, 0, 0, 0, 2691, 2689, 1, 0, 0, 0, 2691, 2692, 1, 0, 0, 0, 2692, 443, 1, 0, 0, 0, 2693, 2691, 1, 0, 0, 0, 2694, 2695, 6, 222, -1, 0, 2695, 2696, 3, 446, 223, 0, 2696, 2714, 1, 0, 0, 0, 2697, 2698, 10, 5, 0, 0, 2698, 2699, 5, 68, 0, 0, 2699, 2713, 3, 446, 223, 0, 2700, 2701, 10, 4, 0, 0, 2701, 2702, 5, 67, 0, 0, 2702, 2713, 3, 446, 223, 0, 2703, 2704, 10, 3, 0, 0, 2704, 2705, 5, 74, 0, 0, 2705, 2713, 3, 446, 223, 0, 2706, 2707, 10, 2, 0, 0, 2707, 2708, 5, 75, 0, 0, 2708, 2713, 3, 446, 223, 0, 2709, 2710, 10, 1, 0, 0, 2710, 2711, 5, 26, 0, 0, 2711, 2713, 3, 10, 5, 0, 2712, 2697, 1, 0, 0, 0, 2712, 2700, 1, 0, 0, 0, 2712, 2703, 1, 0, 0, 0, 2712, 2706, 1, 0, 0, 0, 2712, 2709, 1, 0, 0, 0, 2713, 2716, 1, 0, 0, 0, 2714, 2712, 1, 0, 0, 0, 2714, 2715, 1, 0, 0, 0, 2715, 445, 1, 0, 0, 0, 2716, 2714, 1, 0, 0, 0, 2717, 2718, 6, 223, -1, 0, 2718, 2719, 3, 448, 224, 0, 2719, 2735, 1, 0, 0, 0, 2720, 2721, 10, 3, 0, 0, 2721, 2722, 5, 68, 0, 0, 2722, 2723, 5, 68, 0, 0, 2723, 2734, 3, 448, 224, 0, 2724, 2725, 10, 2, 0, 0, 2725, 2726, 5, 67, 0, 0, 2726, 2727, 5, 67, 0, 0, 2727, 2734, 3, 448, 224, 0, 2728, 2729, 10, 1, 0, 0, 2729, 2730, 5, 67, 0, 0, 2730, 2731, 5, 67, 0, 0, 2731, 2732, 5, 67, 0, 0, 2732, 2734, 3, 448, 224, 0, 2733, 2720, 1, 0, 0, 0, 2733, 2724, 1, 0, 0, 0, 2733, 2728, 1, 0, 0, 0, 2734, 2737, 1, 0, 0, 0, 2735, 2733, 1, 0, 0, 0, 2735, 2736, 1, 0, 0, 0, 2736, 447, 1, 0, 0, 0, 2737, 2735, 1, 0, 0, 0, 2738, 2739, 6, 224, -1, 0, 2739, 2740, 3, 450, 225, 0, 2740, 2749, 1, 0, 0, 0, 2741, 2742, 10, 2, 0, 0, 2742, 2743, 5, 81, 0, 0, 2743, 2748, 3, 450, 225, 0, 2744, 2745, 10, 1, 0, 0, 2745, 2746, 5, 82, 0, 0, 2746, 2748, 3, 450, 225, 0, 2747, 2741, 1, 0, 0, 0, 2747, 2744, 1, 0, 0, 0, 2748, 2751, 1, 0, 0, 0, 2749, 2747, 1, 0, 0, 0, 2749, 2750, 1, 0, 0, 0, 2750, 449, 1, 0, 0, 0, 2751, 2749, 1, 0, 0, 0, 2752, 2753, 6, 225, -1, 0, 2753, 2754, 3, 452, 226, 0, 2754, 2766, 1, 0, 0, 0, 2755, 2756, 10, 3, 0, 0, 2756, 2757, 5, 83, 0, 0, 2757, 2765, 3, 452, 226, 0, 2758, 2759, 10, 2, 0, 0, 2759, 2760, 5, 84, 0, 0, 2760, 2765, 3, 452, 226, 0, 2761, 2762, 10, 1, 0, 0, 2762, 2763, 5, 88, 0, 0, 2763, 2765, 3, 452, 226, 0, 2764, 2755, 1, 0, 0, 0, 2764, 2758, 1, 0, 0, 0, 2764, 2761, 1, 0, 0, 0, 2765, 2768, 1, 0, 0, 0, 2766, 2764, 1, 0, 0, 0, 2766, 2767, 1, 0, 0, 0, 2767, 451, 1, 0, 0, 0, 2768, 2766, 1, 0, 0, 0, 2769, 2777, 3, 454, 227, 0, 2770, 2777, 3, 456, 228, 0, 2771, 2772, 5, 81, 0, 0, 2772, 2777, 3, 452, 226, 0, 2773, 2774, 5, 82, 0, 0, 2774, 2777, 3, 452, 226, 0, 2775, 2777, 3, 458, 229, 0, 2776, 2769, 1, 0, 0, 0, 2776, 2770, 1, 0, 0, 0, 2776, 2771, 1, 0, 0, 0, 2776, 2773, 1, 0, 0, 0, 2776, 2775, 1, 0, 0, 0, 2777, 453, 1, 0, 0, 0, 2778, 2779, 5, 79, 0, 0, 2779, 2780, 3, 452, 226, 0, 2780, 455, 1, 0, 0, 0, 2781, 2782, 5, 80, 0, 0, 2782, 2783, 3, 452, 226, 0, 2783, 457, 1, 0, 0, 0, 2784, 2791, 3, 460, 230, 0, 2785, 2786, 5, 70, 0, 0, 2786, 2791, 3, 452, 226, 0, 2787, 2788, 5, 69, 0, 0, 2788, 2791, 3, 452, 226, 0, 2789, 2791, 3, 470, 235, 0, 2790, 2784, 1, 0, 0, 0, 2790, 2785, 1, 0, 0, 0, 2790, 2787, 1, 0, 0, 0, 2790, 2789, 1, 0, 0, 0, 2791, 459, 1, 0, 0, 0, 2792, 2795, 3, 350, 175, 0, 2793, 2795, 3, 56, 28, 0, 2794, 2792, 1, 0, 0, 0, 2794, 2793, 1, 0, 0, 0, 2795, 2800, 1, 0, 0, 0, 2796, 2799, 3, 464, 232, 0, 2797, 2799, 3, 468, 234, 0, 2798, 2796, 1, 0, 0, 0, 2798, 2797, 1, 0, 0, 0, 2799, 2802, 1, 0, 0, 0, 2800, 2798, 1, 0, 0, 0, 2800, 2801, 1, 0, 0, 0, 2801, 461, 1, 0, 0, 0, 2802, 2800, 1, 0, 0, 0, 2803, 2804, 3, 460, 230, 0, 2804, 2805, 5, 79, 0, 0, 2805, 463, 1, 0, 0, 0, 2806, 2807, 5, 79, 0, 0, 2807, 465, 1, 0, 0, 0, 2808, 2809, 3, 460, 230, 0, 2809, 2810, 5, 80, 0, 0, 2810, 467, 1, 0, 0, 0, 2811, 2812, 5, 80, 0, 0, 2812, 469, 1, 0, 0, 0, 2813, 2814, 5, 57, 0, 0, 2814, 2815, 3, 2, 1, 0, 2815, 2816, 5, 58, 0, 0, 2816, 2817, 3, 452, 226, 0, 2817, 2841, 1, 0, 0, 0, 2818, 2819, 5, 57, 0, 0, 2819, 2823, 3, 10, 5, 0, 2820, 2822, 3, 38, 19, 0, 2821, 2820, 1, 0, 0, 0, 2822, 2825, 1, 0, 0, 0, 2823, 2821, 1, 0, 0, 0, 2823, 2824, 1, 0, 0, 0, 2824, 2826, 1, 0, 0, 0, 2825, 2823, 1, 0, 0, 0, 2826, 2827, 5, 58, 0, 0, 2827, 2828, 3, 458, 229, 0, 2828, 2841, 1, 0, 0, 0, 2829, 2830, 5, 57, 0, 0, 2830, 2834, 3, 10, 5, 0, 2831, 2833, 3, 38, 19, 0, 2832, 2831, 1, 0, 0, 0, 2833, 2836, 1, 0, 0, 0, 2834, 2832, 1, 0, 0, 0, 2834, 2835, 1, 0, 0, 0, 2835, 2837, 1, 0, 0, 0, 2836, 2834, 1, 0, 0, 0, 2837, 2838, 5, 58, 0, 0, 2838, 2839, 3, 414, 207, 0, 2839, 2841, 1, 0, 0, 0, 2840, 2813, 1, 0, 0, 0, 2840, 2818, 1, 0, 0, 0, 2840, 2829, 1, 0, 0, 0, 2841, 471, 1, 0, 0, 0, 322, 477, 484, 488, 492, 501, 505, 509, 511, 517, 522, 529, 534, 536, 542, 547, 552, 557, 568, 582, 587, 595, 602, 608, 613, 624, 627, 641, 646, 651, 656, 662, 672, 680, 690, 698, 710, 714, 719, 725, 733, 746, 775, 779, 784, 790, 793, 796, 808, 819, 833, 840, 849, 856, 861, 876, 883, 889, 893, 897, 901, 905, 910, 914, 918, 920, 925, 932, 937, 939, 945, 950, 954, 973, 978, 994, 999, 1005, 1011, 1013, 1017, 1022, 1026, 1034, 1041, 1049, 1052, 1057, 1065, 1070, 1077, 1084, 1089, 1095, 1107, 1112, 1116, 1126, 1131, 1139, 1142, 1147, 1155, 1158, 1163, 1168, 1173, 1178, 1185, 1190, 1198, 1203, 1208, 1213, 1219, 1225, 1228, 1231, 1240, 1246, 1252, 1255, 1258, 1266, 1271, 1276, 1282, 1285, 1296, 1305, 1315, 1320, 1331, 1336, 1348, 1353, 1365, 1375, 1380, 1388, 1391, 1398, 1406, 1412, 1421, 1431, 1435, 1438, 1447, 1461, 1464, 1473, 1478, 1485, 1490, 1498, 1510, 1517, 1531, 1553, 1587, 1599, 1605, 1617, 1630, 1656, 1660, 1665, 1669, 1673, 1681, 1685, 1689, 1696, 1705, 1713, 1728, 1740, 1746, 1752, 1773, 1778, 1784, 1796, 1807, 1817, 1820, 1825, 1834, 1840, 1850, 1855, 1864, 1887, 1897, 1919, 1926, 1934, 1942, 1953, 1976, 1986, 1997, 2019, 2023, 2028, 2036, 2042, 2046, 2050, 2054, 2060, 2065, 2070, 2074, 2078, 2084, 2089, 2094, 2098, 2102, 2104, 2109, 2114, 2119, 2123, 2127, 2131, 2136, 2144, 2150, 2154, 2158, 2162, 2168, 2173, 2178, 2182, 2186, 2188, 2193, 2208, 2222, 2234, 2243, 2257, 2270, 2279, 2285, 2292, 2297, 2304, 2309, 2316, 2321, 2328, 2333, 2341, 2346, 2350, 2354, 2359, 2366, 2373, 2378, 2385, 2390, 2397, 2402, 2410, 2415, 2419, 2426, 2432, 2439, 2446, 2453, 2461, 2468, 2476, 2480, 2487, 2494, 2501, 2509, 2516, 2524, 2530, 2536, 2548, 2554, 2560, 2571, 2580, 2587, 2594, 2599, 2603, 2612, 2623, 2633, 2644, 2655, 2666, 2677, 2689, 2691, 2712, 2714, 2733, 2735, 2747, 2749, 2764, 2766, 2776, 2790, 2794, 2798, 2800, 2823, 2834, 2840] \ No newline at end of file diff --git a/Assignment-2/Java-8/Java8Parser.java b/Assignment-2/Java-8/Java8Parser.java deleted file mode 100644 index 7b07869..0000000 --- a/Assignment-2/Java-8/Java8Parser.java +++ /dev/null @@ -1,20073 +0,0 @@ -// Generated from Java-8/Java8Parser.g4 by ANTLR 4.13.2 -import org.antlr.v4.runtime.atn.*; -import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; -import org.antlr.v4.runtime.tree.*; -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; - -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) -public class Java8Parser extends Parser { - static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - ABSTRACT=1, ASSERT=2, BOOLEAN=3, BREAK=4, BYTE=5, CASE=6, CATCH=7, CHAR=8, - CLASS=9, CONST=10, CONTINUE=11, DEFAULT=12, DO=13, DOUBLE=14, ELSE=15, - ENUM=16, EXTENDS=17, FINAL=18, FINALLY=19, FLOAT=20, FOR=21, IF=22, GOTO=23, - IMPLEMENTS=24, IMPORT=25, INSTANCEOF=26, INT=27, INTERFACE=28, LONG=29, - NATIVE=30, NEW=31, PACKAGE=32, PRIVATE=33, PROTECTED=34, PUBLIC=35, RETURN=36, - SHORT=37, STATIC=38, STRICTFP=39, SUPER=40, SWITCH=41, SYNCHRONIZED=42, - THIS=43, THROW=44, THROWS=45, TRANSIENT=46, TRY=47, VOID=48, VOLATILE=49, - WHILE=50, IntegerLiteral=51, FloatingPointLiteral=52, BooleanLiteral=53, - CharacterLiteral=54, StringLiteral=55, NullLiteral=56, LPAREN=57, RPAREN=58, - LBRACE=59, RBRACE=60, LBRACK=61, RBRACK=62, SEMI=63, COMMA=64, DOT=65, - ASSIGN=66, GT=67, LT=68, BANG=69, TILDE=70, QUESTION=71, COLON=72, EQUAL=73, - LE=74, GE=75, NOTEQUAL=76, AND=77, OR=78, INC=79, DEC=80, ADD=81, SUB=82, - MUL=83, DIV=84, BITAND=85, BITOR=86, CARET=87, MOD=88, ARROW=89, COLONCOLON=90, - ADD_ASSIGN=91, SUB_ASSIGN=92, MUL_ASSIGN=93, DIV_ASSIGN=94, AND_ASSIGN=95, - OR_ASSIGN=96, XOR_ASSIGN=97, MOD_ASSIGN=98, LSHIFT_ASSIGN=99, RSHIFT_ASSIGN=100, - URSHIFT_ASSIGN=101, Identifier=102, AT=103, ELLIPSIS=104, WS=105, COMMENT=106, - LINE_COMMENT=107; - public static final int - RULE_literal = 0, RULE_primitiveType = 1, RULE_numericType = 2, RULE_integralType = 3, - RULE_floatingPointType = 4, RULE_referenceType = 5, RULE_classOrInterfaceType = 6, - RULE_classType = 7, RULE_classType_lf_classOrInterfaceType = 8, RULE_classType_lfno_classOrInterfaceType = 9, - RULE_interfaceType = 10, RULE_interfaceType_lf_classOrInterfaceType = 11, - RULE_interfaceType_lfno_classOrInterfaceType = 12, RULE_typeVariable = 13, - RULE_arrayType = 14, RULE_dims = 15, RULE_typeParameter = 16, RULE_typeParameterModifier = 17, - RULE_typeBound = 18, RULE_additionalBound = 19, RULE_typeArguments = 20, - RULE_typeArgumentList = 21, RULE_typeArgument = 22, RULE_wildcard = 23, - RULE_wildcardBounds = 24, RULE_packageName = 25, RULE_typeName = 26, RULE_packageOrTypeName = 27, - RULE_expressionName = 28, RULE_methodName = 29, RULE_ambiguousName = 30, - RULE_compilationUnit = 31, RULE_packageDeclaration = 32, RULE_packageModifier = 33, - RULE_importDeclaration = 34, RULE_singleTypeImportDeclaration = 35, RULE_typeImportOnDemandDeclaration = 36, - RULE_singleStaticImportDeclaration = 37, RULE_staticImportOnDemandDeclaration = 38, - RULE_typeDeclaration = 39, RULE_classDeclaration = 40, RULE_normalClassDeclaration = 41, - RULE_classModifier = 42, RULE_typeParameters = 43, RULE_typeParameterList = 44, - RULE_superclass = 45, RULE_superinterfaces = 46, RULE_interfaceTypeList = 47, - RULE_classBody = 48, RULE_classBodyDeclaration = 49, RULE_classMemberDeclaration = 50, - RULE_fieldDeclaration = 51, RULE_fieldModifier = 52, RULE_variableDeclaratorList = 53, - RULE_variableDeclarator = 54, RULE_variableDeclaratorId = 55, RULE_variableInitializer = 56, - RULE_unannType = 57, RULE_unannPrimitiveType = 58, RULE_unannReferenceType = 59, - RULE_unannClassOrInterfaceType = 60, RULE_unannClassType = 61, RULE_unannClassType_lf_unannClassOrInterfaceType = 62, - RULE_unannClassType_lfno_unannClassOrInterfaceType = 63, RULE_unannInterfaceType = 64, - RULE_unannInterfaceType_lf_unannClassOrInterfaceType = 65, RULE_unannInterfaceType_lfno_unannClassOrInterfaceType = 66, - RULE_unannTypeVariable = 67, RULE_unannArrayType = 68, RULE_methodDeclaration = 69, - RULE_methodModifier = 70, RULE_methodHeader = 71, RULE_result = 72, RULE_methodDeclarator = 73, - RULE_formalParameterList = 74, RULE_formalParameters = 75, RULE_formalParameter = 76, - RULE_variableModifier = 77, RULE_lastFormalParameter = 78, RULE_receiverParameter = 79, - RULE_throws_ = 80, RULE_exceptionTypeList = 81, RULE_exceptionType = 82, - RULE_methodBody = 83, RULE_instanceInitializer = 84, RULE_staticInitializer = 85, - RULE_constructorDeclaration = 86, RULE_constructorModifier = 87, RULE_constructorDeclarator = 88, - RULE_simpleTypeName = 89, RULE_constructorBody = 90, RULE_explicitConstructorInvocation = 91, - RULE_enumDeclaration = 92, RULE_enumBody = 93, RULE_enumConstantList = 94, - RULE_enumConstant = 95, RULE_enumConstantModifier = 96, RULE_enumBodyDeclarations = 97, - RULE_interfaceDeclaration = 98, RULE_normalInterfaceDeclaration = 99, - RULE_interfaceModifier = 100, RULE_extendsInterfaces = 101, RULE_interfaceBody = 102, - RULE_interfaceMemberDeclaration = 103, RULE_constantDeclaration = 104, - RULE_constantModifier = 105, RULE_interfaceMethodDeclaration = 106, RULE_interfaceMethodModifier = 107, - RULE_annotationTypeDeclaration = 108, RULE_annotationTypeBody = 109, RULE_annotationTypeMemberDeclaration = 110, - RULE_annotationTypeElementDeclaration = 111, RULE_annotationTypeElementModifier = 112, - RULE_defaultValue = 113, RULE_annotation = 114, RULE_normalAnnotation = 115, - RULE_elementValuePairList = 116, RULE_elementValuePair = 117, RULE_elementValue = 118, - RULE_elementValueArrayInitializer = 119, RULE_elementValueList = 120, - RULE_markerAnnotation = 121, RULE_singleElementAnnotation = 122, RULE_arrayInitializer = 123, - RULE_variableInitializerList = 124, RULE_block = 125, RULE_blockStatements = 126, - RULE_blockStatement = 127, RULE_localVariableDeclarationStatement = 128, - RULE_localVariableDeclaration = 129, RULE_statement = 130, RULE_statementNoShortIf = 131, - RULE_statementWithoutTrailingSubstatement = 132, RULE_emptyStatement_ = 133, - RULE_labeledStatement = 134, RULE_labeledStatementNoShortIf = 135, RULE_expressionStatement = 136, - RULE_statementExpression = 137, RULE_ifThenStatement = 138, RULE_ifThenElseStatement = 139, - RULE_ifThenElseStatementNoShortIf = 140, RULE_assertStatement = 141, RULE_switchStatement = 142, - RULE_switchBlock = 143, RULE_switchBlockStatementGroup = 144, RULE_switchLabels = 145, - RULE_switchLabel = 146, RULE_enumConstantName = 147, RULE_whileStatement = 148, - RULE_whileStatementNoShortIf = 149, RULE_doStatement = 150, RULE_forStatement = 151, - RULE_forStatementNoShortIf = 152, RULE_basicForStatement = 153, RULE_basicForStatementNoShortIf = 154, - RULE_forInit = 155, RULE_forUpdate = 156, RULE_statementExpressionList = 157, - RULE_enhancedForStatement = 158, RULE_enhancedForStatementNoShortIf = 159, - RULE_breakStatement = 160, RULE_continueStatement = 161, RULE_returnStatement = 162, - RULE_throwStatement = 163, RULE_synchronizedStatement = 164, RULE_tryStatement = 165, - RULE_catches = 166, RULE_catchClause = 167, RULE_catchFormalParameter = 168, - RULE_catchType = 169, RULE_finally_ = 170, RULE_tryWithResourcesStatement = 171, - RULE_resourceSpecification = 172, RULE_resourceList = 173, RULE_resource = 174, - RULE_primary = 175, RULE_primaryNoNewArray = 176, RULE_primaryNoNewArray_lf_arrayAccess = 177, - RULE_primaryNoNewArray_lfno_arrayAccess = 178, RULE_primaryNoNewArray_lf_primary = 179, - RULE_primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary = 180, RULE_primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary = 181, - RULE_primaryNoNewArray_lfno_primary = 182, RULE_primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary = 183, - RULE_primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary = 184, - RULE_classInstanceCreationExpression = 185, RULE_classInstanceCreationExpression_lf_primary = 186, - RULE_classInstanceCreationExpression_lfno_primary = 187, RULE_typeArgumentsOrDiamond = 188, - RULE_fieldAccess = 189, RULE_fieldAccess_lf_primary = 190, RULE_fieldAccess_lfno_primary = 191, - RULE_arrayAccess = 192, RULE_arrayAccess_lf_primary = 193, RULE_arrayAccess_lfno_primary = 194, - RULE_methodInvocation = 195, RULE_methodInvocation_lf_primary = 196, RULE_methodInvocation_lfno_primary = 197, - RULE_argumentList = 198, RULE_methodReference = 199, RULE_methodReference_lf_primary = 200, - RULE_methodReference_lfno_primary = 201, RULE_arrayCreationExpression = 202, - RULE_dimExprs = 203, RULE_dimExpr = 204, RULE_constantExpression = 205, - RULE_expression = 206, RULE_lambdaExpression = 207, RULE_lambdaParameters = 208, - RULE_inferredFormalParameterList = 209, RULE_lambdaBody = 210, RULE_assignmentExpression = 211, - RULE_assignment = 212, RULE_leftHandSide = 213, RULE_assignmentOperator = 214, - RULE_conditionalExpression = 215, RULE_conditionalOrExpression = 216, - RULE_conditionalAndExpression = 217, RULE_inclusiveOrExpression = 218, - RULE_exclusiveOrExpression = 219, RULE_andExpression = 220, RULE_equalityExpression = 221, - RULE_relationalExpression = 222, RULE_shiftExpression = 223, RULE_additiveExpression = 224, - RULE_multiplicativeExpression = 225, RULE_unaryExpression = 226, RULE_preIncrementExpression = 227, - RULE_preDecrementExpression = 228, RULE_unaryExpressionNotPlusMinus = 229, - RULE_postfixExpression = 230, RULE_postIncrementExpression = 231, RULE_postIncrementExpression_lf_postfixExpression = 232, - RULE_postDecrementExpression = 233, RULE_postDecrementExpression_lf_postfixExpression = 234, - RULE_castExpression = 235; - private static String[] makeRuleNames() { - return new String[] { - "literal", "primitiveType", "numericType", "integralType", "floatingPointType", - "referenceType", "classOrInterfaceType", "classType", "classType_lf_classOrInterfaceType", - "classType_lfno_classOrInterfaceType", "interfaceType", "interfaceType_lf_classOrInterfaceType", - "interfaceType_lfno_classOrInterfaceType", "typeVariable", "arrayType", - "dims", "typeParameter", "typeParameterModifier", "typeBound", "additionalBound", - "typeArguments", "typeArgumentList", "typeArgument", "wildcard", "wildcardBounds", - "packageName", "typeName", "packageOrTypeName", "expressionName", "methodName", - "ambiguousName", "compilationUnit", "packageDeclaration", "packageModifier", - "importDeclaration", "singleTypeImportDeclaration", "typeImportOnDemandDeclaration", - "singleStaticImportDeclaration", "staticImportOnDemandDeclaration", "typeDeclaration", - "classDeclaration", "normalClassDeclaration", "classModifier", "typeParameters", - "typeParameterList", "superclass", "superinterfaces", "interfaceTypeList", - "classBody", "classBodyDeclaration", "classMemberDeclaration", "fieldDeclaration", - "fieldModifier", "variableDeclaratorList", "variableDeclarator", "variableDeclaratorId", - "variableInitializer", "unannType", "unannPrimitiveType", "unannReferenceType", - "unannClassOrInterfaceType", "unannClassType", "unannClassType_lf_unannClassOrInterfaceType", - "unannClassType_lfno_unannClassOrInterfaceType", "unannInterfaceType", - "unannInterfaceType_lf_unannClassOrInterfaceType", "unannInterfaceType_lfno_unannClassOrInterfaceType", - "unannTypeVariable", "unannArrayType", "methodDeclaration", "methodModifier", - "methodHeader", "result", "methodDeclarator", "formalParameterList", - "formalParameters", "formalParameter", "variableModifier", "lastFormalParameter", - "receiverParameter", "throws_", "exceptionTypeList", "exceptionType", - "methodBody", "instanceInitializer", "staticInitializer", "constructorDeclaration", - "constructorModifier", "constructorDeclarator", "simpleTypeName", "constructorBody", - "explicitConstructorInvocation", "enumDeclaration", "enumBody", "enumConstantList", - "enumConstant", "enumConstantModifier", "enumBodyDeclarations", "interfaceDeclaration", - "normalInterfaceDeclaration", "interfaceModifier", "extendsInterfaces", - "interfaceBody", "interfaceMemberDeclaration", "constantDeclaration", - "constantModifier", "interfaceMethodDeclaration", "interfaceMethodModifier", - "annotationTypeDeclaration", "annotationTypeBody", "annotationTypeMemberDeclaration", - "annotationTypeElementDeclaration", "annotationTypeElementModifier", - "defaultValue", "annotation", "normalAnnotation", "elementValuePairList", - "elementValuePair", "elementValue", "elementValueArrayInitializer", "elementValueList", - "markerAnnotation", "singleElementAnnotation", "arrayInitializer", "variableInitializerList", - "block", "blockStatements", "blockStatement", "localVariableDeclarationStatement", - "localVariableDeclaration", "statement", "statementNoShortIf", "statementWithoutTrailingSubstatement", - "emptyStatement_", "labeledStatement", "labeledStatementNoShortIf", "expressionStatement", - "statementExpression", "ifThenStatement", "ifThenElseStatement", "ifThenElseStatementNoShortIf", - "assertStatement", "switchStatement", "switchBlock", "switchBlockStatementGroup", - "switchLabels", "switchLabel", "enumConstantName", "whileStatement", - "whileStatementNoShortIf", "doStatement", "forStatement", "forStatementNoShortIf", - "basicForStatement", "basicForStatementNoShortIf", "forInit", "forUpdate", - "statementExpressionList", "enhancedForStatement", "enhancedForStatementNoShortIf", - "breakStatement", "continueStatement", "returnStatement", "throwStatement", - "synchronizedStatement", "tryStatement", "catches", "catchClause", "catchFormalParameter", - "catchType", "finally_", "tryWithResourcesStatement", "resourceSpecification", - "resourceList", "resource", "primary", "primaryNoNewArray", "primaryNoNewArray_lf_arrayAccess", - "primaryNoNewArray_lfno_arrayAccess", "primaryNoNewArray_lf_primary", - "primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary", "primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary", - "primaryNoNewArray_lfno_primary", "primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary", - "primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary", "classInstanceCreationExpression", - "classInstanceCreationExpression_lf_primary", "classInstanceCreationExpression_lfno_primary", - "typeArgumentsOrDiamond", "fieldAccess", "fieldAccess_lf_primary", "fieldAccess_lfno_primary", - "arrayAccess", "arrayAccess_lf_primary", "arrayAccess_lfno_primary", - "methodInvocation", "methodInvocation_lf_primary", "methodInvocation_lfno_primary", - "argumentList", "methodReference", "methodReference_lf_primary", "methodReference_lfno_primary", - "arrayCreationExpression", "dimExprs", "dimExpr", "constantExpression", - "expression", "lambdaExpression", "lambdaParameters", "inferredFormalParameterList", - "lambdaBody", "assignmentExpression", "assignment", "leftHandSide", "assignmentOperator", - "conditionalExpression", "conditionalOrExpression", "conditionalAndExpression", - "inclusiveOrExpression", "exclusiveOrExpression", "andExpression", "equalityExpression", - "relationalExpression", "shiftExpression", "additiveExpression", "multiplicativeExpression", - "unaryExpression", "preIncrementExpression", "preDecrementExpression", - "unaryExpressionNotPlusMinus", "postfixExpression", "postIncrementExpression", - "postIncrementExpression_lf_postfixExpression", "postDecrementExpression", - "postDecrementExpression_lf_postfixExpression", "castExpression" - }; - } - public static final String[] ruleNames = makeRuleNames(); - - private static String[] makeLiteralNames() { - return new String[] { - null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", "'case'", - "'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'", - "'do'", "'double'", "'else'", "'enum'", "'extends'", "'final'", "'finally'", - "'float'", "'for'", "'if'", "'goto'", "'implements'", "'import'", "'instanceof'", - "'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'", - "'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'", - "'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'", - "'transient'", "'try'", "'void'", "'volatile'", "'while'", null, null, - null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", "']'", - "';'", "','", "'.'", "'='", "'>'", "'<'", "'!'", "'~'", "'?'", "':'", - "'=='", "'<='", "'>='", "'!='", "'&&'", "'||'", "'++'", "'--'", "'+'", - "'-'", "'*'", "'/'", "'&'", "'|'", "'^'", "'%'", "'->'", "'::'", "'+='", - "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='", - "'>>>='", null, "'@'", "'...'" - }; - } - private static final String[] _LITERAL_NAMES = makeLiteralNames(); - private static String[] makeSymbolicNames() { - return new String[] { - null, "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", - "CHAR", "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", - "ENUM", "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", - "IMPLEMENTS", "IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", - "NEW", "PACKAGE", "PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", - "STATIC", "STRICTFP", "SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", - "THROWS", "TRANSIENT", "TRY", "VOID", "VOLATILE", "WHILE", "IntegerLiteral", - "FloatingPointLiteral", "BooleanLiteral", "CharacterLiteral", "StringLiteral", - "NullLiteral", "LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK", - "SEMI", "COMMA", "DOT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", - "COLON", "EQUAL", "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", - "ADD", "SUB", "MUL", "DIV", "BITAND", "BITOR", "CARET", "MOD", "ARROW", - "COLONCOLON", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", - "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN", "MOD_ASSIGN", "LSHIFT_ASSIGN", - "RSHIFT_ASSIGN", "URSHIFT_ASSIGN", "Identifier", "AT", "ELLIPSIS", "WS", - "COMMENT", "LINE_COMMENT" - }; - } - private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - @Override - public String getGrammarFileName() { return "Java8Parser.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public ATN getATN() { return _ATN; } - - public Java8Parser(TokenStream input) { - super(input); - _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - - @SuppressWarnings("CheckReturnValue") - public static class LiteralContext extends ParserRuleContext { - public TerminalNode IntegerLiteral() { return getToken(Java8Parser.IntegerLiteral, 0); } - public TerminalNode FloatingPointLiteral() { return getToken(Java8Parser.FloatingPointLiteral, 0); } - public TerminalNode BooleanLiteral() { return getToken(Java8Parser.BooleanLiteral, 0); } - public TerminalNode CharacterLiteral() { return getToken(Java8Parser.CharacterLiteral, 0); } - public TerminalNode StringLiteral() { return getToken(Java8Parser.StringLiteral, 0); } - public TerminalNode NullLiteral() { return getToken(Java8Parser.NullLiteral, 0); } - public LiteralContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLiteral(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLiteral(this); - } - } - - public final LiteralContext literal() throws RecognitionException { - LiteralContext _localctx = new LiteralContext(_ctx, getState()); - enterRule(_localctx, 0, RULE_literal); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(472); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 141863388262170624L) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimitiveTypeContext extends ParserRuleContext { - public NumericTypeContext numericType() { - return getRuleContext(NumericTypeContext.class,0); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TerminalNode BOOLEAN() { return getToken(Java8Parser.BOOLEAN, 0); } - public PrimitiveTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primitiveType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimitiveType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimitiveType(this); - } - } - - public final PrimitiveTypeContext primitiveType() throws RecognitionException { - PrimitiveTypeContext _localctx = new PrimitiveTypeContext(_ctx, getState()); - enterRule(_localctx, 2, RULE_primitiveType); - int _la; - try { - setState(488); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(477); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(474); - annotation(); - } - } - setState(479); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(480); - numericType(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(484); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(481); - annotation(); - } - } - setState(486); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(487); - match(BOOLEAN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class NumericTypeContext extends ParserRuleContext { - public IntegralTypeContext integralType() { - return getRuleContext(IntegralTypeContext.class,0); - } - public FloatingPointTypeContext floatingPointType() { - return getRuleContext(FloatingPointTypeContext.class,0); - } - public NumericTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_numericType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterNumericType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitNumericType(this); - } - } - - public final NumericTypeContext numericType() throws RecognitionException { - NumericTypeContext _localctx = new NumericTypeContext(_ctx, getState()); - enterRule(_localctx, 4, RULE_numericType); - try { - setState(492); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BYTE: - case CHAR: - case INT: - case LONG: - case SHORT: - enterOuterAlt(_localctx, 1); - { - setState(490); - integralType(); - } - break; - case DOUBLE: - case FLOAT: - enterOuterAlt(_localctx, 2); - { - setState(491); - floatingPointType(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class IntegralTypeContext extends ParserRuleContext { - public TerminalNode BYTE() { return getToken(Java8Parser.BYTE, 0); } - public TerminalNode SHORT() { return getToken(Java8Parser.SHORT, 0); } - public TerminalNode INT() { return getToken(Java8Parser.INT, 0); } - public TerminalNode LONG() { return getToken(Java8Parser.LONG, 0); } - public TerminalNode CHAR() { return getToken(Java8Parser.CHAR, 0); } - public IntegralTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_integralType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterIntegralType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitIntegralType(this); - } - } - - public final IntegralTypeContext integralType() throws RecognitionException { - IntegralTypeContext _localctx = new IntegralTypeContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_integralType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(494); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 138110042400L) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FloatingPointTypeContext extends ParserRuleContext { - public TerminalNode FLOAT() { return getToken(Java8Parser.FLOAT, 0); } - public TerminalNode DOUBLE() { return getToken(Java8Parser.DOUBLE, 0); } - public FloatingPointTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_floatingPointType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFloatingPointType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFloatingPointType(this); - } - } - - public final FloatingPointTypeContext floatingPointType() throws RecognitionException { - FloatingPointTypeContext _localctx = new FloatingPointTypeContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_floatingPointType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(496); - _la = _input.LA(1); - if ( !(_la==DOUBLE || _la==FLOAT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ReferenceTypeContext extends ParserRuleContext { - public ClassOrInterfaceTypeContext classOrInterfaceType() { - return getRuleContext(ClassOrInterfaceTypeContext.class,0); - } - public TypeVariableContext typeVariable() { - return getRuleContext(TypeVariableContext.class,0); - } - public ArrayTypeContext arrayType() { - return getRuleContext(ArrayTypeContext.class,0); - } - public ReferenceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_referenceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterReferenceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitReferenceType(this); - } - } - - public final ReferenceTypeContext referenceType() throws RecognitionException { - ReferenceTypeContext _localctx = new ReferenceTypeContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_referenceType); - try { - setState(501); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(498); - classOrInterfaceType(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(499); - typeVariable(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(500); - arrayType(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassOrInterfaceTypeContext extends ParserRuleContext { - public ClassType_lfno_classOrInterfaceTypeContext classType_lfno_classOrInterfaceType() { - return getRuleContext(ClassType_lfno_classOrInterfaceTypeContext.class,0); - } - public InterfaceType_lfno_classOrInterfaceTypeContext interfaceType_lfno_classOrInterfaceType() { - return getRuleContext(InterfaceType_lfno_classOrInterfaceTypeContext.class,0); - } - public List classType_lf_classOrInterfaceType() { - return getRuleContexts(ClassType_lf_classOrInterfaceTypeContext.class); - } - public ClassType_lf_classOrInterfaceTypeContext classType_lf_classOrInterfaceType(int i) { - return getRuleContext(ClassType_lf_classOrInterfaceTypeContext.class,i); - } - public List interfaceType_lf_classOrInterfaceType() { - return getRuleContexts(InterfaceType_lf_classOrInterfaceTypeContext.class); - } - public InterfaceType_lf_classOrInterfaceTypeContext interfaceType_lf_classOrInterfaceType(int i) { - return getRuleContext(InterfaceType_lf_classOrInterfaceTypeContext.class,i); - } - public ClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassOrInterfaceType(this); - } - } - - public final ClassOrInterfaceTypeContext classOrInterfaceType() throws RecognitionException { - ClassOrInterfaceTypeContext _localctx = new ClassOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_classOrInterfaceType); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(505); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) { - case 1: - { - setState(503); - classType_lfno_classOrInterfaceType(); - } - break; - case 2: - { - setState(504); - interfaceType_lfno_classOrInterfaceType(); - } - break; - } - setState(511); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,7,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - setState(509); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) { - case 1: - { - setState(507); - classType_lf_classOrInterfaceType(); - } - break; - case 2: - { - setState(508); - interfaceType_lf_classOrInterfaceType(); - } - break; - } - } - } - setState(513); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,7,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassTypeContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ClassOrInterfaceTypeContext classOrInterfaceType() { - return getRuleContext(ClassOrInterfaceTypeContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public ClassTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassType(this); - } - } - - public final ClassTypeContext classType() throws RecognitionException { - ClassTypeContext _localctx = new ClassTypeContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_classType); - int _la; - try { - setState(536); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,12,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(517); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(514); - annotation(); - } - } - setState(519); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(520); - match(Identifier); - setState(522); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(521); - typeArguments(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(524); - classOrInterfaceType(); - setState(525); - match(DOT); - setState(529); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(526); - annotation(); - } - } - setState(531); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(532); - match(Identifier); - setState(534); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(533); - typeArguments(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassType_lf_classOrInterfaceTypeContext extends ParserRuleContext { - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ClassType_lf_classOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classType_lf_classOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassType_lf_classOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassType_lf_classOrInterfaceType(this); - } - } - - public final ClassType_lf_classOrInterfaceTypeContext classType_lf_classOrInterfaceType() throws RecognitionException { - ClassType_lf_classOrInterfaceTypeContext _localctx = new ClassType_lf_classOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 16, RULE_classType_lf_classOrInterfaceType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(538); - match(DOT); - setState(542); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(539); - annotation(); - } - } - setState(544); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(545); - match(Identifier); - setState(547); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) { - case 1: - { - setState(546); - typeArguments(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassType_lfno_classOrInterfaceTypeContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ClassType_lfno_classOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classType_lfno_classOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassType_lfno_classOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassType_lfno_classOrInterfaceType(this); - } - } - - public final ClassType_lfno_classOrInterfaceTypeContext classType_lfno_classOrInterfaceType() throws RecognitionException { - ClassType_lfno_classOrInterfaceTypeContext _localctx = new ClassType_lfno_classOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 18, RULE_classType_lfno_classOrInterfaceType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(552); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(549); - annotation(); - } - } - setState(554); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(555); - match(Identifier); - setState(557); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { - case 1: - { - setState(556); - typeArguments(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceTypeContext extends ParserRuleContext { - public ClassTypeContext classType() { - return getRuleContext(ClassTypeContext.class,0); - } - public InterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceType(this); - } - } - - public final InterfaceTypeContext interfaceType() throws RecognitionException { - InterfaceTypeContext _localctx = new InterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 20, RULE_interfaceType); - try { - enterOuterAlt(_localctx, 1); - { - setState(559); - classType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceType_lf_classOrInterfaceTypeContext extends ParserRuleContext { - public ClassType_lf_classOrInterfaceTypeContext classType_lf_classOrInterfaceType() { - return getRuleContext(ClassType_lf_classOrInterfaceTypeContext.class,0); - } - public InterfaceType_lf_classOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceType_lf_classOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceType_lf_classOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceType_lf_classOrInterfaceType(this); - } - } - - public final InterfaceType_lf_classOrInterfaceTypeContext interfaceType_lf_classOrInterfaceType() throws RecognitionException { - InterfaceType_lf_classOrInterfaceTypeContext _localctx = new InterfaceType_lf_classOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 22, RULE_interfaceType_lf_classOrInterfaceType); - try { - enterOuterAlt(_localctx, 1); - { - setState(561); - classType_lf_classOrInterfaceType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceType_lfno_classOrInterfaceTypeContext extends ParserRuleContext { - public ClassType_lfno_classOrInterfaceTypeContext classType_lfno_classOrInterfaceType() { - return getRuleContext(ClassType_lfno_classOrInterfaceTypeContext.class,0); - } - public InterfaceType_lfno_classOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceType_lfno_classOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceType_lfno_classOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceType_lfno_classOrInterfaceType(this); - } - } - - public final InterfaceType_lfno_classOrInterfaceTypeContext interfaceType_lfno_classOrInterfaceType() throws RecognitionException { - InterfaceType_lfno_classOrInterfaceTypeContext _localctx = new InterfaceType_lfno_classOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 24, RULE_interfaceType_lfno_classOrInterfaceType); - try { - enterOuterAlt(_localctx, 1); - { - setState(563); - classType_lfno_classOrInterfaceType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeVariableContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TypeVariableContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeVariable; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeVariable(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeVariable(this); - } - } - - public final TypeVariableContext typeVariable() throws RecognitionException { - TypeVariableContext _localctx = new TypeVariableContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_typeVariable); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(568); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(565); - annotation(); - } - } - setState(570); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(571); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayTypeContext extends ParserRuleContext { - public PrimitiveTypeContext primitiveType() { - return getRuleContext(PrimitiveTypeContext.class,0); - } - public DimsContext dims() { - return getRuleContext(DimsContext.class,0); - } - public ClassOrInterfaceTypeContext classOrInterfaceType() { - return getRuleContext(ClassOrInterfaceTypeContext.class,0); - } - public TypeVariableContext typeVariable() { - return getRuleContext(TypeVariableContext.class,0); - } - public ArrayTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arrayType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArrayType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArrayType(this); - } - } - - public final ArrayTypeContext arrayType() throws RecognitionException { - ArrayTypeContext _localctx = new ArrayTypeContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_arrayType); - try { - setState(582); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(573); - primitiveType(); - setState(574); - dims(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(576); - classOrInterfaceType(); - setState(577); - dims(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(579); - typeVariable(); - setState(580); - dims(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class DimsContext extends ParserRuleContext { - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public DimsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_dims; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterDims(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitDims(this); - } - } - - public final DimsContext dims() throws RecognitionException { - DimsContext _localctx = new DimsContext(_ctx, getState()); - enterRule(_localctx, 30, RULE_dims); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(587); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(584); - annotation(); - } - } - setState(589); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(590); - match(LBRACK); - setState(591); - match(RBRACK); - setState(602); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,21,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(595); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(592); - annotation(); - } - } - setState(597); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(598); - match(LBRACK); - setState(599); - match(RBRACK); - } - } - } - setState(604); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,21,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeParameterContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List typeParameterModifier() { - return getRuleContexts(TypeParameterModifierContext.class); - } - public TypeParameterModifierContext typeParameterModifier(int i) { - return getRuleContext(TypeParameterModifierContext.class,i); - } - public TypeBoundContext typeBound() { - return getRuleContext(TypeBoundContext.class,0); - } - public TypeParameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeParameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeParameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeParameter(this); - } - } - - public final TypeParameterContext typeParameter() throws RecognitionException { - TypeParameterContext _localctx = new TypeParameterContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_typeParameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(608); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(605); - typeParameterModifier(); - } - } - setState(610); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(611); - match(Identifier); - setState(613); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==EXTENDS) { - { - setState(612); - typeBound(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeParameterModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TypeParameterModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeParameterModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeParameterModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeParameterModifier(this); - } - } - - public final TypeParameterModifierContext typeParameterModifier() throws RecognitionException { - TypeParameterModifierContext _localctx = new TypeParameterModifierContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_typeParameterModifier); - try { - enterOuterAlt(_localctx, 1); - { - setState(615); - annotation(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeBoundContext extends ParserRuleContext { - public TerminalNode EXTENDS() { return getToken(Java8Parser.EXTENDS, 0); } - public TypeVariableContext typeVariable() { - return getRuleContext(TypeVariableContext.class,0); - } - public ClassOrInterfaceTypeContext classOrInterfaceType() { - return getRuleContext(ClassOrInterfaceTypeContext.class,0); - } - public List additionalBound() { - return getRuleContexts(AdditionalBoundContext.class); - } - public AdditionalBoundContext additionalBound(int i) { - return getRuleContext(AdditionalBoundContext.class,i); - } - public TypeBoundContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeBound; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeBound(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeBound(this); - } - } - - public final TypeBoundContext typeBound() throws RecognitionException { - TypeBoundContext _localctx = new TypeBoundContext(_ctx, getState()); - enterRule(_localctx, 36, RULE_typeBound); - int _la; - try { - setState(627); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,25,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(617); - match(EXTENDS); - setState(618); - typeVariable(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(619); - match(EXTENDS); - setState(620); - classOrInterfaceType(); - setState(624); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==BITAND) { - { - { - setState(621); - additionalBound(); - } - } - setState(626); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AdditionalBoundContext extends ParserRuleContext { - public TerminalNode BITAND() { return getToken(Java8Parser.BITAND, 0); } - public InterfaceTypeContext interfaceType() { - return getRuleContext(InterfaceTypeContext.class,0); - } - public AdditionalBoundContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_additionalBound; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAdditionalBound(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAdditionalBound(this); - } - } - - public final AdditionalBoundContext additionalBound() throws RecognitionException { - AdditionalBoundContext _localctx = new AdditionalBoundContext(_ctx, getState()); - enterRule(_localctx, 38, RULE_additionalBound); - try { - enterOuterAlt(_localctx, 1); - { - setState(629); - match(BITAND); - setState(630); - interfaceType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeArgumentsContext extends ParserRuleContext { - public TerminalNode LT() { return getToken(Java8Parser.LT, 0); } - public TypeArgumentListContext typeArgumentList() { - return getRuleContext(TypeArgumentListContext.class,0); - } - public TerminalNode GT() { return getToken(Java8Parser.GT, 0); } - public TypeArgumentsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeArguments; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeArguments(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeArguments(this); - } - } - - public final TypeArgumentsContext typeArguments() throws RecognitionException { - TypeArgumentsContext _localctx = new TypeArgumentsContext(_ctx, getState()); - enterRule(_localctx, 40, RULE_typeArguments); - try { - enterOuterAlt(_localctx, 1); - { - setState(632); - match(LT); - setState(633); - typeArgumentList(); - setState(634); - match(GT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeArgumentListContext extends ParserRuleContext { - public List typeArgument() { - return getRuleContexts(TypeArgumentContext.class); - } - public TypeArgumentContext typeArgument(int i) { - return getRuleContext(TypeArgumentContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public TypeArgumentListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeArgumentList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeArgumentList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeArgumentList(this); - } - } - - public final TypeArgumentListContext typeArgumentList() throws RecognitionException { - TypeArgumentListContext _localctx = new TypeArgumentListContext(_ctx, getState()); - enterRule(_localctx, 42, RULE_typeArgumentList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(636); - typeArgument(); - setState(641); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(637); - match(COMMA); - setState(638); - typeArgument(); - } - } - setState(643); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeArgumentContext extends ParserRuleContext { - public ReferenceTypeContext referenceType() { - return getRuleContext(ReferenceTypeContext.class,0); - } - public WildcardContext wildcard() { - return getRuleContext(WildcardContext.class,0); - } - public TypeArgumentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeArgument; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeArgument(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeArgument(this); - } - } - - public final TypeArgumentContext typeArgument() throws RecognitionException { - TypeArgumentContext _localctx = new TypeArgumentContext(_ctx, getState()); - enterRule(_localctx, 44, RULE_typeArgument); - try { - setState(646); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,27,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(644); - referenceType(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(645); - wildcard(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class WildcardContext extends ParserRuleContext { - public TerminalNode QUESTION() { return getToken(Java8Parser.QUESTION, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public WildcardBoundsContext wildcardBounds() { - return getRuleContext(WildcardBoundsContext.class,0); - } - public WildcardContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_wildcard; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterWildcard(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitWildcard(this); - } - } - - public final WildcardContext wildcard() throws RecognitionException { - WildcardContext _localctx = new WildcardContext(_ctx, getState()); - enterRule(_localctx, 46, RULE_wildcard); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(651); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(648); - annotation(); - } - } - setState(653); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(654); - match(QUESTION); - setState(656); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==EXTENDS || _la==SUPER) { - { - setState(655); - wildcardBounds(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class WildcardBoundsContext extends ParserRuleContext { - public TerminalNode EXTENDS() { return getToken(Java8Parser.EXTENDS, 0); } - public ReferenceTypeContext referenceType() { - return getRuleContext(ReferenceTypeContext.class,0); - } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public WildcardBoundsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_wildcardBounds; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterWildcardBounds(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitWildcardBounds(this); - } - } - - public final WildcardBoundsContext wildcardBounds() throws RecognitionException { - WildcardBoundsContext _localctx = new WildcardBoundsContext(_ctx, getState()); - enterRule(_localctx, 48, RULE_wildcardBounds); - try { - setState(662); - _errHandler.sync(this); - switch (_input.LA(1)) { - case EXTENDS: - enterOuterAlt(_localctx, 1); - { - setState(658); - match(EXTENDS); - setState(659); - referenceType(); - } - break; - case SUPER: - enterOuterAlt(_localctx, 2); - { - setState(660); - match(SUPER); - setState(661); - referenceType(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PackageNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public PackageNameContext packageName() { - return getRuleContext(PackageNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public PackageNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_packageName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPackageName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPackageName(this); - } - } - - public final PackageNameContext packageName() throws RecognitionException { - return packageName(0); - } - - private PackageNameContext packageName(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - PackageNameContext _localctx = new PackageNameContext(_ctx, _parentState); - PackageNameContext _prevctx = _localctx; - int _startState = 50; - enterRecursionRule(_localctx, 50, RULE_packageName, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(665); - match(Identifier); - } - _ctx.stop = _input.LT(-1); - setState(672); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,31,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new PackageNameContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_packageName); - setState(667); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(668); - match(DOT); - setState(669); - match(Identifier); - } - } - } - setState(674); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,31,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public PackageOrTypeNameContext packageOrTypeName() { - return getRuleContext(PackageOrTypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TypeNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeName(this); - } - } - - public final TypeNameContext typeName() throws RecognitionException { - TypeNameContext _localctx = new TypeNameContext(_ctx, getState()); - enterRule(_localctx, 52, RULE_typeName); - try { - setState(680); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,32,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(675); - match(Identifier); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(676); - packageOrTypeName(0); - setState(677); - match(DOT); - setState(678); - match(Identifier); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PackageOrTypeNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public PackageOrTypeNameContext packageOrTypeName() { - return getRuleContext(PackageOrTypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public PackageOrTypeNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_packageOrTypeName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPackageOrTypeName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPackageOrTypeName(this); - } - } - - public final PackageOrTypeNameContext packageOrTypeName() throws RecognitionException { - return packageOrTypeName(0); - } - - private PackageOrTypeNameContext packageOrTypeName(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - PackageOrTypeNameContext _localctx = new PackageOrTypeNameContext(_ctx, _parentState); - PackageOrTypeNameContext _prevctx = _localctx; - int _startState = 54; - enterRecursionRule(_localctx, 54, RULE_packageOrTypeName, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(683); - match(Identifier); - } - _ctx.stop = _input.LT(-1); - setState(690); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,33,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new PackageOrTypeNameContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_packageOrTypeName); - setState(685); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(686); - match(DOT); - setState(687); - match(Identifier); - } - } - } - setState(692); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,33,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExpressionNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public AmbiguousNameContext ambiguousName() { - return getRuleContext(AmbiguousNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public ExpressionNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_expressionName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExpressionName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExpressionName(this); - } - } - - public final ExpressionNameContext expressionName() throws RecognitionException { - ExpressionNameContext _localctx = new ExpressionNameContext(_ctx, getState()); - enterRule(_localctx, 56, RULE_expressionName); - try { - setState(698); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,34,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(693); - match(Identifier); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(694); - ambiguousName(0); - setState(695); - match(DOT); - setState(696); - match(Identifier); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public MethodNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodName(this); - } - } - - public final MethodNameContext methodName() throws RecognitionException { - MethodNameContext _localctx = new MethodNameContext(_ctx, getState()); - enterRule(_localctx, 58, RULE_methodName); - try { - enterOuterAlt(_localctx, 1); - { - setState(700); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AmbiguousNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public AmbiguousNameContext ambiguousName() { - return getRuleContext(AmbiguousNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public AmbiguousNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ambiguousName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAmbiguousName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAmbiguousName(this); - } - } - - public final AmbiguousNameContext ambiguousName() throws RecognitionException { - return ambiguousName(0); - } - - private AmbiguousNameContext ambiguousName(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - AmbiguousNameContext _localctx = new AmbiguousNameContext(_ctx, _parentState); - AmbiguousNameContext _prevctx = _localctx; - int _startState = 60; - enterRecursionRule(_localctx, 60, RULE_ambiguousName, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(703); - match(Identifier); - } - _ctx.stop = _input.LT(-1); - setState(710); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,35,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new AmbiguousNameContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_ambiguousName); - setState(705); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(706); - match(DOT); - setState(707); - match(Identifier); - } - } - } - setState(712); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,35,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class CompilationUnitContext extends ParserRuleContext { - public TerminalNode EOF() { return getToken(Java8Parser.EOF, 0); } - public PackageDeclarationContext packageDeclaration() { - return getRuleContext(PackageDeclarationContext.class,0); - } - public List importDeclaration() { - return getRuleContexts(ImportDeclarationContext.class); - } - public ImportDeclarationContext importDeclaration(int i) { - return getRuleContext(ImportDeclarationContext.class,i); - } - public List typeDeclaration() { - return getRuleContexts(TypeDeclarationContext.class); - } - public TypeDeclarationContext typeDeclaration(int i) { - return getRuleContext(TypeDeclarationContext.class,i); - } - public CompilationUnitContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_compilationUnit; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterCompilationUnit(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitCompilationUnit(this); - } - } - - public final CompilationUnitContext compilationUnit() throws RecognitionException { - CompilationUnitContext _localctx = new CompilationUnitContext(_ctx, getState()); - enterRule(_localctx, 62, RULE_compilationUnit); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(714); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,36,_ctx) ) { - case 1: - { - setState(713); - packageDeclaration(); - } - break; - } - setState(719); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==IMPORT) { - { - { - setState(716); - importDeclaration(); - } - } - setState(721); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(725); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & -9223371151822749182L) != 0) || _la==AT) { - { - { - setState(722); - typeDeclaration(); - } - } - setState(727); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(728); - match(EOF); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PackageDeclarationContext extends ParserRuleContext { - public TerminalNode PACKAGE() { return getToken(Java8Parser.PACKAGE, 0); } - public PackageNameContext packageName() { - return getRuleContext(PackageNameContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public List packageModifier() { - return getRuleContexts(PackageModifierContext.class); - } - public PackageModifierContext packageModifier(int i) { - return getRuleContext(PackageModifierContext.class,i); - } - public PackageDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_packageDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPackageDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPackageDeclaration(this); - } - } - - public final PackageDeclarationContext packageDeclaration() throws RecognitionException { - PackageDeclarationContext _localctx = new PackageDeclarationContext(_ctx, getState()); - enterRule(_localctx, 64, RULE_packageDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(733); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(730); - packageModifier(); - } - } - setState(735); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(736); - match(PACKAGE); - setState(737); - packageName(0); - setState(738); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PackageModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public PackageModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_packageModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPackageModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPackageModifier(this); - } - } - - public final PackageModifierContext packageModifier() throws RecognitionException { - PackageModifierContext _localctx = new PackageModifierContext(_ctx, getState()); - enterRule(_localctx, 66, RULE_packageModifier); - try { - enterOuterAlt(_localctx, 1); - { - setState(740); - annotation(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ImportDeclarationContext extends ParserRuleContext { - public SingleTypeImportDeclarationContext singleTypeImportDeclaration() { - return getRuleContext(SingleTypeImportDeclarationContext.class,0); - } - public TypeImportOnDemandDeclarationContext typeImportOnDemandDeclaration() { - return getRuleContext(TypeImportOnDemandDeclarationContext.class,0); - } - public SingleStaticImportDeclarationContext singleStaticImportDeclaration() { - return getRuleContext(SingleStaticImportDeclarationContext.class,0); - } - public StaticImportOnDemandDeclarationContext staticImportOnDemandDeclaration() { - return getRuleContext(StaticImportOnDemandDeclarationContext.class,0); - } - public ImportDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_importDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterImportDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitImportDeclaration(this); - } - } - - public final ImportDeclarationContext importDeclaration() throws RecognitionException { - ImportDeclarationContext _localctx = new ImportDeclarationContext(_ctx, getState()); - enterRule(_localctx, 68, RULE_importDeclaration); - try { - setState(746); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,40,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(742); - singleTypeImportDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(743); - typeImportOnDemandDeclaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(744); - singleStaticImportDeclaration(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(745); - staticImportOnDemandDeclaration(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SingleTypeImportDeclarationContext extends ParserRuleContext { - public TerminalNode IMPORT() { return getToken(Java8Parser.IMPORT, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public SingleTypeImportDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_singleTypeImportDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSingleTypeImportDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSingleTypeImportDeclaration(this); - } - } - - public final SingleTypeImportDeclarationContext singleTypeImportDeclaration() throws RecognitionException { - SingleTypeImportDeclarationContext _localctx = new SingleTypeImportDeclarationContext(_ctx, getState()); - enterRule(_localctx, 70, RULE_singleTypeImportDeclaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(748); - match(IMPORT); - setState(749); - typeName(); - setState(750); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeImportOnDemandDeclarationContext extends ParserRuleContext { - public TerminalNode IMPORT() { return getToken(Java8Parser.IMPORT, 0); } - public PackageOrTypeNameContext packageOrTypeName() { - return getRuleContext(PackageOrTypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode MUL() { return getToken(Java8Parser.MUL, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public TypeImportOnDemandDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeImportOnDemandDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeImportOnDemandDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeImportOnDemandDeclaration(this); - } - } - - public final TypeImportOnDemandDeclarationContext typeImportOnDemandDeclaration() throws RecognitionException { - TypeImportOnDemandDeclarationContext _localctx = new TypeImportOnDemandDeclarationContext(_ctx, getState()); - enterRule(_localctx, 72, RULE_typeImportOnDemandDeclaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(752); - match(IMPORT); - setState(753); - packageOrTypeName(0); - setState(754); - match(DOT); - setState(755); - match(MUL); - setState(756); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SingleStaticImportDeclarationContext extends ParserRuleContext { - public TerminalNode IMPORT() { return getToken(Java8Parser.IMPORT, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public SingleStaticImportDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_singleStaticImportDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSingleStaticImportDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSingleStaticImportDeclaration(this); - } - } - - public final SingleStaticImportDeclarationContext singleStaticImportDeclaration() throws RecognitionException { - SingleStaticImportDeclarationContext _localctx = new SingleStaticImportDeclarationContext(_ctx, getState()); - enterRule(_localctx, 74, RULE_singleStaticImportDeclaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(758); - match(IMPORT); - setState(759); - match(STATIC); - setState(760); - typeName(); - setState(761); - match(DOT); - setState(762); - match(Identifier); - setState(763); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StaticImportOnDemandDeclarationContext extends ParserRuleContext { - public TerminalNode IMPORT() { return getToken(Java8Parser.IMPORT, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode MUL() { return getToken(Java8Parser.MUL, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public StaticImportOnDemandDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_staticImportOnDemandDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStaticImportOnDemandDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStaticImportOnDemandDeclaration(this); - } - } - - public final StaticImportOnDemandDeclarationContext staticImportOnDemandDeclaration() throws RecognitionException { - StaticImportOnDemandDeclarationContext _localctx = new StaticImportOnDemandDeclarationContext(_ctx, getState()); - enterRule(_localctx, 76, RULE_staticImportOnDemandDeclaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(765); - match(IMPORT); - setState(766); - match(STATIC); - setState(767); - typeName(); - setState(768); - match(DOT); - setState(769); - match(MUL); - setState(770); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeDeclarationContext extends ParserRuleContext { - public ClassDeclarationContext classDeclaration() { - return getRuleContext(ClassDeclarationContext.class,0); - } - public InterfaceDeclarationContext interfaceDeclaration() { - return getRuleContext(InterfaceDeclarationContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public TypeDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeDeclaration(this); - } - } - - public final TypeDeclarationContext typeDeclaration() throws RecognitionException { - TypeDeclarationContext _localctx = new TypeDeclarationContext(_ctx, getState()); - enterRule(_localctx, 78, RULE_typeDeclaration); - try { - setState(775); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,41,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(772); - classDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(773); - interfaceDeclaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(774); - match(SEMI); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassDeclarationContext extends ParserRuleContext { - public NormalClassDeclarationContext normalClassDeclaration() { - return getRuleContext(NormalClassDeclarationContext.class,0); - } - public EnumDeclarationContext enumDeclaration() { - return getRuleContext(EnumDeclarationContext.class,0); - } - public ClassDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassDeclaration(this); - } - } - - public final ClassDeclarationContext classDeclaration() throws RecognitionException { - ClassDeclarationContext _localctx = new ClassDeclarationContext(_ctx, getState()); - enterRule(_localctx, 80, RULE_classDeclaration); - try { - setState(779); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,42,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(777); - normalClassDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(778); - enumDeclaration(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class NormalClassDeclarationContext extends ParserRuleContext { - public TerminalNode CLASS() { return getToken(Java8Parser.CLASS, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public ClassBodyContext classBody() { - return getRuleContext(ClassBodyContext.class,0); - } - public List classModifier() { - return getRuleContexts(ClassModifierContext.class); - } - public ClassModifierContext classModifier(int i) { - return getRuleContext(ClassModifierContext.class,i); - } - public TypeParametersContext typeParameters() { - return getRuleContext(TypeParametersContext.class,0); - } - public SuperclassContext superclass() { - return getRuleContext(SuperclassContext.class,0); - } - public SuperinterfacesContext superinterfaces() { - return getRuleContext(SuperinterfacesContext.class,0); - } - public NormalClassDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_normalClassDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterNormalClassDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitNormalClassDeclaration(this); - } - } - - public final NormalClassDeclarationContext normalClassDeclaration() throws RecognitionException { - NormalClassDeclarationContext _localctx = new NormalClassDeclarationContext(_ctx, getState()); - enterRule(_localctx, 82, RULE_normalClassDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(784); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 884763525122L) != 0) || _la==AT) { - { - { - setState(781); - classModifier(); - } - } - setState(786); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(787); - match(CLASS); - setState(788); - match(Identifier); - setState(790); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(789); - typeParameters(); - } - } - - setState(793); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==EXTENDS) { - { - setState(792); - superclass(); - } - } - - setState(796); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IMPLEMENTS) { - { - setState(795); - superinterfaces(); - } - } - - setState(798); - classBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode PROTECTED() { return getToken(Java8Parser.PROTECTED, 0); } - public TerminalNode PRIVATE() { return getToken(Java8Parser.PRIVATE, 0); } - public TerminalNode ABSTRACT() { return getToken(Java8Parser.ABSTRACT, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TerminalNode FINAL() { return getToken(Java8Parser.FINAL, 0); } - public TerminalNode STRICTFP() { return getToken(Java8Parser.STRICTFP, 0); } - public ClassModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassModifier(this); - } - } - - public final ClassModifierContext classModifier() throws RecognitionException { - ClassModifierContext _localctx = new ClassModifierContext(_ctx, getState()); - enterRule(_localctx, 84, RULE_classModifier); - try { - setState(808); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(800); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(801); - match(PUBLIC); - } - break; - case PROTECTED: - enterOuterAlt(_localctx, 3); - { - setState(802); - match(PROTECTED); - } - break; - case PRIVATE: - enterOuterAlt(_localctx, 4); - { - setState(803); - match(PRIVATE); - } - break; - case ABSTRACT: - enterOuterAlt(_localctx, 5); - { - setState(804); - match(ABSTRACT); - } - break; - case STATIC: - enterOuterAlt(_localctx, 6); - { - setState(805); - match(STATIC); - } - break; - case FINAL: - enterOuterAlt(_localctx, 7); - { - setState(806); - match(FINAL); - } - break; - case STRICTFP: - enterOuterAlt(_localctx, 8); - { - setState(807); - match(STRICTFP); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeParametersContext extends ParserRuleContext { - public TerminalNode LT() { return getToken(Java8Parser.LT, 0); } - public TypeParameterListContext typeParameterList() { - return getRuleContext(TypeParameterListContext.class,0); - } - public TerminalNode GT() { return getToken(Java8Parser.GT, 0); } - public TypeParametersContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeParameters; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeParameters(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeParameters(this); - } - } - - public final TypeParametersContext typeParameters() throws RecognitionException { - TypeParametersContext _localctx = new TypeParametersContext(_ctx, getState()); - enterRule(_localctx, 86, RULE_typeParameters); - try { - enterOuterAlt(_localctx, 1); - { - setState(810); - match(LT); - setState(811); - typeParameterList(); - setState(812); - match(GT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeParameterListContext extends ParserRuleContext { - public List typeParameter() { - return getRuleContexts(TypeParameterContext.class); - } - public TypeParameterContext typeParameter(int i) { - return getRuleContext(TypeParameterContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public TypeParameterListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeParameterList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeParameterList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeParameterList(this); - } - } - - public final TypeParameterListContext typeParameterList() throws RecognitionException { - TypeParameterListContext _localctx = new TypeParameterListContext(_ctx, getState()); - enterRule(_localctx, 88, RULE_typeParameterList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(814); - typeParameter(); - setState(819); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(815); - match(COMMA); - setState(816); - typeParameter(); - } - } - setState(821); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SuperclassContext extends ParserRuleContext { - public TerminalNode EXTENDS() { return getToken(Java8Parser.EXTENDS, 0); } - public ClassTypeContext classType() { - return getRuleContext(ClassTypeContext.class,0); - } - public SuperclassContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_superclass; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSuperclass(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSuperclass(this); - } - } - - public final SuperclassContext superclass() throws RecognitionException { - SuperclassContext _localctx = new SuperclassContext(_ctx, getState()); - enterRule(_localctx, 90, RULE_superclass); - try { - enterOuterAlt(_localctx, 1); - { - setState(822); - match(EXTENDS); - setState(823); - classType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SuperinterfacesContext extends ParserRuleContext { - public TerminalNode IMPLEMENTS() { return getToken(Java8Parser.IMPLEMENTS, 0); } - public InterfaceTypeListContext interfaceTypeList() { - return getRuleContext(InterfaceTypeListContext.class,0); - } - public SuperinterfacesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_superinterfaces; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSuperinterfaces(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSuperinterfaces(this); - } - } - - public final SuperinterfacesContext superinterfaces() throws RecognitionException { - SuperinterfacesContext _localctx = new SuperinterfacesContext(_ctx, getState()); - enterRule(_localctx, 92, RULE_superinterfaces); - try { - enterOuterAlt(_localctx, 1); - { - setState(825); - match(IMPLEMENTS); - setState(826); - interfaceTypeList(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceTypeListContext extends ParserRuleContext { - public List interfaceType() { - return getRuleContexts(InterfaceTypeContext.class); - } - public InterfaceTypeContext interfaceType(int i) { - return getRuleContext(InterfaceTypeContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public InterfaceTypeListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceTypeList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceTypeList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceTypeList(this); - } - } - - public final InterfaceTypeListContext interfaceTypeList() throws RecognitionException { - InterfaceTypeListContext _localctx = new InterfaceTypeListContext(_ctx, getState()); - enterRule(_localctx, 94, RULE_interfaceTypeList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(828); - interfaceType(); - setState(833); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(829); - match(COMMA); - setState(830); - interfaceType(); - } - } - setState(835); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassBodyContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public List classBodyDeclaration() { - return getRuleContexts(ClassBodyDeclarationContext.class); - } - public ClassBodyDeclarationContext classBodyDeclaration(int i) { - return getRuleContext(ClassBodyDeclarationContext.class,i); - } - public ClassBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassBody(this); - } - } - - public final ClassBodyContext classBody() throws RecognitionException { - ClassBodyContext _localctx = new ClassBodyContext(_ctx, getState()); - enterRule(_localctx, 96, RULE_classBody); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(836); - match(LBRACE); - setState(840); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & -8645991068613655766L) != 0) || ((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & 51539607553L) != 0)) { - { - { - setState(837); - classBodyDeclaration(); - } - } - setState(842); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(843); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassBodyDeclarationContext extends ParserRuleContext { - public ClassMemberDeclarationContext classMemberDeclaration() { - return getRuleContext(ClassMemberDeclarationContext.class,0); - } - public InstanceInitializerContext instanceInitializer() { - return getRuleContext(InstanceInitializerContext.class,0); - } - public StaticInitializerContext staticInitializer() { - return getRuleContext(StaticInitializerContext.class,0); - } - public ConstructorDeclarationContext constructorDeclaration() { - return getRuleContext(ConstructorDeclarationContext.class,0); - } - public ClassBodyDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classBodyDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassBodyDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassBodyDeclaration(this); - } - } - - public final ClassBodyDeclarationContext classBodyDeclaration() throws RecognitionException { - ClassBodyDeclarationContext _localctx = new ClassBodyDeclarationContext(_ctx, getState()); - enterRule(_localctx, 98, RULE_classBodyDeclaration); - try { - setState(849); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,51,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(845); - classMemberDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(846); - instanceInitializer(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(847); - staticInitializer(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(848); - constructorDeclaration(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassMemberDeclarationContext extends ParserRuleContext { - public FieldDeclarationContext fieldDeclaration() { - return getRuleContext(FieldDeclarationContext.class,0); - } - public MethodDeclarationContext methodDeclaration() { - return getRuleContext(MethodDeclarationContext.class,0); - } - public ClassDeclarationContext classDeclaration() { - return getRuleContext(ClassDeclarationContext.class,0); - } - public InterfaceDeclarationContext interfaceDeclaration() { - return getRuleContext(InterfaceDeclarationContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public ClassMemberDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classMemberDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassMemberDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassMemberDeclaration(this); - } - } - - public final ClassMemberDeclarationContext classMemberDeclaration() throws RecognitionException { - ClassMemberDeclarationContext _localctx = new ClassMemberDeclarationContext(_ctx, getState()); - enterRule(_localctx, 100, RULE_classMemberDeclaration); - try { - setState(856); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,52,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(851); - fieldDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(852); - methodDeclaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(853); - classDeclaration(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(854); - interfaceDeclaration(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(855); - match(SEMI); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FieldDeclarationContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorListContext variableDeclaratorList() { - return getRuleContext(VariableDeclaratorListContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public List fieldModifier() { - return getRuleContexts(FieldModifierContext.class); - } - public FieldModifierContext fieldModifier(int i) { - return getRuleContext(FieldModifierContext.class,i); - } - public FieldDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fieldDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFieldDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFieldDeclaration(this); - } - } - - public final FieldDeclarationContext fieldDeclaration() throws RecognitionException { - FieldDeclarationContext _localctx = new FieldDeclarationContext(_ctx, getState()); - enterRule(_localctx, 102, RULE_fieldDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(861); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 633653705310208L) != 0) || _la==AT) { - { - { - setState(858); - fieldModifier(); - } - } - setState(863); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(864); - unannType(); - setState(865); - variableDeclaratorList(); - setState(866); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FieldModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode PROTECTED() { return getToken(Java8Parser.PROTECTED, 0); } - public TerminalNode PRIVATE() { return getToken(Java8Parser.PRIVATE, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TerminalNode FINAL() { return getToken(Java8Parser.FINAL, 0); } - public TerminalNode TRANSIENT() { return getToken(Java8Parser.TRANSIENT, 0); } - public TerminalNode VOLATILE() { return getToken(Java8Parser.VOLATILE, 0); } - public FieldModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fieldModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFieldModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFieldModifier(this); - } - } - - public final FieldModifierContext fieldModifier() throws RecognitionException { - FieldModifierContext _localctx = new FieldModifierContext(_ctx, getState()); - enterRule(_localctx, 104, RULE_fieldModifier); - try { - setState(876); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(868); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(869); - match(PUBLIC); - } - break; - case PROTECTED: - enterOuterAlt(_localctx, 3); - { - setState(870); - match(PROTECTED); - } - break; - case PRIVATE: - enterOuterAlt(_localctx, 4); - { - setState(871); - match(PRIVATE); - } - break; - case STATIC: - enterOuterAlt(_localctx, 5); - { - setState(872); - match(STATIC); - } - break; - case FINAL: - enterOuterAlt(_localctx, 6); - { - setState(873); - match(FINAL); - } - break; - case TRANSIENT: - enterOuterAlt(_localctx, 7); - { - setState(874); - match(TRANSIENT); - } - break; - case VOLATILE: - enterOuterAlt(_localctx, 8); - { - setState(875); - match(VOLATILE); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class VariableDeclaratorListContext extends ParserRuleContext { - public List variableDeclarator() { - return getRuleContexts(VariableDeclaratorContext.class); - } - public VariableDeclaratorContext variableDeclarator(int i) { - return getRuleContext(VariableDeclaratorContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public VariableDeclaratorListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variableDeclaratorList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterVariableDeclaratorList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitVariableDeclaratorList(this); - } - } - - public final VariableDeclaratorListContext variableDeclaratorList() throws RecognitionException { - VariableDeclaratorListContext _localctx = new VariableDeclaratorListContext(_ctx, getState()); - enterRule(_localctx, 106, RULE_variableDeclaratorList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(878); - variableDeclarator(); - setState(883); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(879); - match(COMMA); - setState(880); - variableDeclarator(); - } - } - setState(885); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class VariableDeclaratorContext extends ParserRuleContext { - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public TerminalNode ASSIGN() { return getToken(Java8Parser.ASSIGN, 0); } - public VariableInitializerContext variableInitializer() { - return getRuleContext(VariableInitializerContext.class,0); - } - public VariableDeclaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variableDeclarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterVariableDeclarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitVariableDeclarator(this); - } - } - - public final VariableDeclaratorContext variableDeclarator() throws RecognitionException { - VariableDeclaratorContext _localctx = new VariableDeclaratorContext(_ctx, getState()); - enterRule(_localctx, 108, RULE_variableDeclarator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(886); - variableDeclaratorId(); - setState(889); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASSIGN) { - { - setState(887); - match(ASSIGN); - setState(888); - variableInitializer(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class VariableDeclaratorIdContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public DimsContext dims() { - return getRuleContext(DimsContext.class,0); - } - public VariableDeclaratorIdContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variableDeclaratorId; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterVariableDeclaratorId(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitVariableDeclaratorId(this); - } - } - - public final VariableDeclaratorIdContext variableDeclaratorId() throws RecognitionException { - VariableDeclaratorIdContext _localctx = new VariableDeclaratorIdContext(_ctx, getState()); - enterRule(_localctx, 110, RULE_variableDeclaratorId); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(891); - match(Identifier); - setState(893); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACK || _la==AT) { - { - setState(892); - dims(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class VariableInitializerContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ArrayInitializerContext arrayInitializer() { - return getRuleContext(ArrayInitializerContext.class,0); - } - public VariableInitializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variableInitializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterVariableInitializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitVariableInitializer(this); - } - } - - public final VariableInitializerContext variableInitializer() throws RecognitionException { - VariableInitializerContext _localctx = new VariableInitializerContext(_ctx, getState()); - enterRule(_localctx, 112, RULE_variableInitializer); - try { - setState(897); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case NEW: - case SHORT: - case SUPER: - case THIS: - case VOID: - case IntegerLiteral: - case FloatingPointLiteral: - case BooleanLiteral: - case CharacterLiteral: - case StringLiteral: - case NullLiteral: - case LPAREN: - case BANG: - case TILDE: - case INC: - case DEC: - case ADD: - case SUB: - case Identifier: - case AT: - enterOuterAlt(_localctx, 1); - { - setState(895); - expression(); - } - break; - case LBRACE: - enterOuterAlt(_localctx, 2); - { - setState(896); - arrayInitializer(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannTypeContext extends ParserRuleContext { - public UnannPrimitiveTypeContext unannPrimitiveType() { - return getRuleContext(UnannPrimitiveTypeContext.class,0); - } - public UnannReferenceTypeContext unannReferenceType() { - return getRuleContext(UnannReferenceTypeContext.class,0); - } - public UnannTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannType(this); - } - } - - public final UnannTypeContext unannType() throws RecognitionException { - UnannTypeContext _localctx = new UnannTypeContext(_ctx, getState()); - enterRule(_localctx, 114, RULE_unannType); - try { - setState(901); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,59,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(899); - unannPrimitiveType(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(900); - unannReferenceType(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannPrimitiveTypeContext extends ParserRuleContext { - public NumericTypeContext numericType() { - return getRuleContext(NumericTypeContext.class,0); - } - public TerminalNode BOOLEAN() { return getToken(Java8Parser.BOOLEAN, 0); } - public UnannPrimitiveTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannPrimitiveType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannPrimitiveType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannPrimitiveType(this); - } - } - - public final UnannPrimitiveTypeContext unannPrimitiveType() throws RecognitionException { - UnannPrimitiveTypeContext _localctx = new UnannPrimitiveTypeContext(_ctx, getState()); - enterRule(_localctx, 116, RULE_unannPrimitiveType); - try { - setState(905); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - enterOuterAlt(_localctx, 1); - { - setState(903); - numericType(); - } - break; - case BOOLEAN: - enterOuterAlt(_localctx, 2); - { - setState(904); - match(BOOLEAN); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannReferenceTypeContext extends ParserRuleContext { - public UnannClassOrInterfaceTypeContext unannClassOrInterfaceType() { - return getRuleContext(UnannClassOrInterfaceTypeContext.class,0); - } - public UnannTypeVariableContext unannTypeVariable() { - return getRuleContext(UnannTypeVariableContext.class,0); - } - public UnannArrayTypeContext unannArrayType() { - return getRuleContext(UnannArrayTypeContext.class,0); - } - public UnannReferenceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannReferenceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannReferenceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannReferenceType(this); - } - } - - public final UnannReferenceTypeContext unannReferenceType() throws RecognitionException { - UnannReferenceTypeContext _localctx = new UnannReferenceTypeContext(_ctx, getState()); - enterRule(_localctx, 118, RULE_unannReferenceType); - try { - setState(910); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,61,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(907); - unannClassOrInterfaceType(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(908); - unannTypeVariable(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(909); - unannArrayType(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannClassOrInterfaceTypeContext extends ParserRuleContext { - public UnannClassType_lfno_unannClassOrInterfaceTypeContext unannClassType_lfno_unannClassOrInterfaceType() { - return getRuleContext(UnannClassType_lfno_unannClassOrInterfaceTypeContext.class,0); - } - public UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext unannInterfaceType_lfno_unannClassOrInterfaceType() { - return getRuleContext(UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext.class,0); - } - public List unannClassType_lf_unannClassOrInterfaceType() { - return getRuleContexts(UnannClassType_lf_unannClassOrInterfaceTypeContext.class); - } - public UnannClassType_lf_unannClassOrInterfaceTypeContext unannClassType_lf_unannClassOrInterfaceType(int i) { - return getRuleContext(UnannClassType_lf_unannClassOrInterfaceTypeContext.class,i); - } - public List unannInterfaceType_lf_unannClassOrInterfaceType() { - return getRuleContexts(UnannInterfaceType_lf_unannClassOrInterfaceTypeContext.class); - } - public UnannInterfaceType_lf_unannClassOrInterfaceTypeContext unannInterfaceType_lf_unannClassOrInterfaceType(int i) { - return getRuleContext(UnannInterfaceType_lf_unannClassOrInterfaceTypeContext.class,i); - } - public UnannClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannClassOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannClassOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannClassOrInterfaceType(this); - } - } - - public final UnannClassOrInterfaceTypeContext unannClassOrInterfaceType() throws RecognitionException { - UnannClassOrInterfaceTypeContext _localctx = new UnannClassOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 120, RULE_unannClassOrInterfaceType); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(914); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,62,_ctx) ) { - case 1: - { - setState(912); - unannClassType_lfno_unannClassOrInterfaceType(); - } - break; - case 2: - { - setState(913); - unannInterfaceType_lfno_unannClassOrInterfaceType(); - } - break; - } - setState(920); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,64,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - setState(918); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,63,_ctx) ) { - case 1: - { - setState(916); - unannClassType_lf_unannClassOrInterfaceType(); - } - break; - case 2: - { - setState(917); - unannInterfaceType_lf_unannClassOrInterfaceType(); - } - break; - } - } - } - setState(922); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,64,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannClassTypeContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public UnannClassOrInterfaceTypeContext unannClassOrInterfaceType() { - return getRuleContext(UnannClassOrInterfaceTypeContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public UnannClassTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannClassType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannClassType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannClassType(this); - } - } - - public final UnannClassTypeContext unannClassType() throws RecognitionException { - UnannClassTypeContext _localctx = new UnannClassTypeContext(_ctx, getState()); - enterRule(_localctx, 122, RULE_unannClassType); - int _la; - try { - setState(939); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,68,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(923); - match(Identifier); - setState(925); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(924); - typeArguments(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(927); - unannClassOrInterfaceType(); - setState(928); - match(DOT); - setState(932); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(929); - annotation(); - } - } - setState(934); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(935); - match(Identifier); - setState(937); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(936); - typeArguments(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannClassType_lf_unannClassOrInterfaceTypeContext extends ParserRuleContext { - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public UnannClassType_lf_unannClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannClassType_lf_unannClassOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannClassType_lf_unannClassOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannClassType_lf_unannClassOrInterfaceType(this); - } - } - - public final UnannClassType_lf_unannClassOrInterfaceTypeContext unannClassType_lf_unannClassOrInterfaceType() throws RecognitionException { - UnannClassType_lf_unannClassOrInterfaceTypeContext _localctx = new UnannClassType_lf_unannClassOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 124, RULE_unannClassType_lf_unannClassOrInterfaceType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(941); - match(DOT); - setState(945); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(942); - annotation(); - } - } - setState(947); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(948); - match(Identifier); - setState(950); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(949); - typeArguments(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannClassType_lfno_unannClassOrInterfaceTypeContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public UnannClassType_lfno_unannClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannClassType_lfno_unannClassOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannClassType_lfno_unannClassOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannClassType_lfno_unannClassOrInterfaceType(this); - } - } - - public final UnannClassType_lfno_unannClassOrInterfaceTypeContext unannClassType_lfno_unannClassOrInterfaceType() throws RecognitionException { - UnannClassType_lfno_unannClassOrInterfaceTypeContext _localctx = new UnannClassType_lfno_unannClassOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 126, RULE_unannClassType_lfno_unannClassOrInterfaceType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(952); - match(Identifier); - setState(954); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(953); - typeArguments(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannInterfaceTypeContext extends ParserRuleContext { - public UnannClassTypeContext unannClassType() { - return getRuleContext(UnannClassTypeContext.class,0); - } - public UnannInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannInterfaceType(this); - } - } - - public final UnannInterfaceTypeContext unannInterfaceType() throws RecognitionException { - UnannInterfaceTypeContext _localctx = new UnannInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 128, RULE_unannInterfaceType); - try { - enterOuterAlt(_localctx, 1); - { - setState(956); - unannClassType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannInterfaceType_lf_unannClassOrInterfaceTypeContext extends ParserRuleContext { - public UnannClassType_lf_unannClassOrInterfaceTypeContext unannClassType_lf_unannClassOrInterfaceType() { - return getRuleContext(UnannClassType_lf_unannClassOrInterfaceTypeContext.class,0); - } - public UnannInterfaceType_lf_unannClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannInterfaceType_lf_unannClassOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannInterfaceType_lf_unannClassOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannInterfaceType_lf_unannClassOrInterfaceType(this); - } - } - - public final UnannInterfaceType_lf_unannClassOrInterfaceTypeContext unannInterfaceType_lf_unannClassOrInterfaceType() throws RecognitionException { - UnannInterfaceType_lf_unannClassOrInterfaceTypeContext _localctx = new UnannInterfaceType_lf_unannClassOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 130, RULE_unannInterfaceType_lf_unannClassOrInterfaceType); - try { - enterOuterAlt(_localctx, 1); - { - setState(958); - unannClassType_lf_unannClassOrInterfaceType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext extends ParserRuleContext { - public UnannClassType_lfno_unannClassOrInterfaceTypeContext unannClassType_lfno_unannClassOrInterfaceType() { - return getRuleContext(UnannClassType_lfno_unannClassOrInterfaceTypeContext.class,0); - } - public UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannInterfaceType_lfno_unannClassOrInterfaceType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannInterfaceType_lfno_unannClassOrInterfaceType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannInterfaceType_lfno_unannClassOrInterfaceType(this); - } - } - - public final UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext unannInterfaceType_lfno_unannClassOrInterfaceType() throws RecognitionException { - UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext _localctx = new UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext(_ctx, getState()); - enterRule(_localctx, 132, RULE_unannInterfaceType_lfno_unannClassOrInterfaceType); - try { - enterOuterAlt(_localctx, 1); - { - setState(960); - unannClassType_lfno_unannClassOrInterfaceType(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannTypeVariableContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public UnannTypeVariableContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannTypeVariable; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannTypeVariable(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannTypeVariable(this); - } - } - - public final UnannTypeVariableContext unannTypeVariable() throws RecognitionException { - UnannTypeVariableContext _localctx = new UnannTypeVariableContext(_ctx, getState()); - enterRule(_localctx, 134, RULE_unannTypeVariable); - try { - enterOuterAlt(_localctx, 1); - { - setState(962); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnannArrayTypeContext extends ParserRuleContext { - public UnannPrimitiveTypeContext unannPrimitiveType() { - return getRuleContext(UnannPrimitiveTypeContext.class,0); - } - public DimsContext dims() { - return getRuleContext(DimsContext.class,0); - } - public UnannClassOrInterfaceTypeContext unannClassOrInterfaceType() { - return getRuleContext(UnannClassOrInterfaceTypeContext.class,0); - } - public UnannTypeVariableContext unannTypeVariable() { - return getRuleContext(UnannTypeVariableContext.class,0); - } - public UnannArrayTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unannArrayType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnannArrayType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnannArrayType(this); - } - } - - public final UnannArrayTypeContext unannArrayType() throws RecognitionException { - UnannArrayTypeContext _localctx = new UnannArrayTypeContext(_ctx, getState()); - enterRule(_localctx, 136, RULE_unannArrayType); - try { - setState(973); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,72,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(964); - unannPrimitiveType(); - setState(965); - dims(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(967); - unannClassOrInterfaceType(); - setState(968); - dims(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(970); - unannTypeVariable(); - setState(971); - dims(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodDeclarationContext extends ParserRuleContext { - public MethodHeaderContext methodHeader() { - return getRuleContext(MethodHeaderContext.class,0); - } - public MethodBodyContext methodBody() { - return getRuleContext(MethodBodyContext.class,0); - } - public List methodModifier() { - return getRuleContexts(MethodModifierContext.class); - } - public MethodModifierContext methodModifier(int i) { - return getRuleContext(MethodModifierContext.class,i); - } - public MethodDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodDeclaration(this); - } - } - - public final MethodDeclarationContext methodDeclaration() throws RecognitionException { - MethodDeclarationContext _localctx = new MethodDeclarationContext(_ctx, getState()); - enterRule(_localctx, 138, RULE_methodDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(978); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 5283883778050L) != 0) || _la==AT) { - { - { - setState(975); - methodModifier(); - } - } - setState(980); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(981); - methodHeader(); - setState(982); - methodBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode PROTECTED() { return getToken(Java8Parser.PROTECTED, 0); } - public TerminalNode PRIVATE() { return getToken(Java8Parser.PRIVATE, 0); } - public TerminalNode ABSTRACT() { return getToken(Java8Parser.ABSTRACT, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TerminalNode FINAL() { return getToken(Java8Parser.FINAL, 0); } - public TerminalNode SYNCHRONIZED() { return getToken(Java8Parser.SYNCHRONIZED, 0); } - public TerminalNode NATIVE() { return getToken(Java8Parser.NATIVE, 0); } - public TerminalNode STRICTFP() { return getToken(Java8Parser.STRICTFP, 0); } - public MethodModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodModifier(this); - } - } - - public final MethodModifierContext methodModifier() throws RecognitionException { - MethodModifierContext _localctx = new MethodModifierContext(_ctx, getState()); - enterRule(_localctx, 140, RULE_methodModifier); - try { - setState(994); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(984); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(985); - match(PUBLIC); - } - break; - case PROTECTED: - enterOuterAlt(_localctx, 3); - { - setState(986); - match(PROTECTED); - } - break; - case PRIVATE: - enterOuterAlt(_localctx, 4); - { - setState(987); - match(PRIVATE); - } - break; - case ABSTRACT: - enterOuterAlt(_localctx, 5); - { - setState(988); - match(ABSTRACT); - } - break; - case STATIC: - enterOuterAlt(_localctx, 6); - { - setState(989); - match(STATIC); - } - break; - case FINAL: - enterOuterAlt(_localctx, 7); - { - setState(990); - match(FINAL); - } - break; - case SYNCHRONIZED: - enterOuterAlt(_localctx, 8); - { - setState(991); - match(SYNCHRONIZED); - } - break; - case NATIVE: - enterOuterAlt(_localctx, 9); - { - setState(992); - match(NATIVE); - } - break; - case STRICTFP: - enterOuterAlt(_localctx, 10); - { - setState(993); - match(STRICTFP); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodHeaderContext extends ParserRuleContext { - public ResultContext result() { - return getRuleContext(ResultContext.class,0); - } - public MethodDeclaratorContext methodDeclarator() { - return getRuleContext(MethodDeclaratorContext.class,0); - } - public Throws_Context throws_() { - return getRuleContext(Throws_Context.class,0); - } - public TypeParametersContext typeParameters() { - return getRuleContext(TypeParametersContext.class,0); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public MethodHeaderContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodHeader; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodHeader(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodHeader(this); - } - } - - public final MethodHeaderContext methodHeader() throws RecognitionException { - MethodHeaderContext _localctx = new MethodHeaderContext(_ctx, getState()); - enterRule(_localctx, 142, RULE_methodHeader); - int _la; - try { - setState(1013); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - case VOID: - case Identifier: - enterOuterAlt(_localctx, 1); - { - setState(996); - result(); - setState(997); - methodDeclarator(); - setState(999); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==THROWS) { - { - setState(998); - throws_(); - } - } - - } - break; - case LT: - enterOuterAlt(_localctx, 2); - { - setState(1001); - typeParameters(); - setState(1005); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(1002); - annotation(); - } - } - setState(1007); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1008); - result(); - setState(1009); - methodDeclarator(); - setState(1011); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==THROWS) { - { - setState(1010); - throws_(); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ResultContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public TerminalNode VOID() { return getToken(Java8Parser.VOID, 0); } - public ResultContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_result; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterResult(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitResult(this); - } - } - - public final ResultContext result() throws RecognitionException { - ResultContext _localctx = new ResultContext(_ctx, getState()); - enterRule(_localctx, 144, RULE_result); - try { - setState(1017); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - case Identifier: - enterOuterAlt(_localctx, 1); - { - setState(1015); - unannType(); - } - break; - case VOID: - enterOuterAlt(_localctx, 2); - { - setState(1016); - match(VOID); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodDeclaratorContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public FormalParameterListContext formalParameterList() { - return getRuleContext(FormalParameterListContext.class,0); - } - public DimsContext dims() { - return getRuleContext(DimsContext.class,0); - } - public MethodDeclaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodDeclarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodDeclarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodDeclarator(this); - } - } - - public final MethodDeclaratorContext methodDeclarator() throws RecognitionException { - MethodDeclaratorContext _localctx = new MethodDeclaratorContext(_ctx, getState()); - enterRule(_localctx, 146, RULE_methodDeclarator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1019); - match(Identifier); - setState(1020); - match(LPAREN); - setState(1022); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 138111369512L) != 0) || _la==Identifier || _la==AT) { - { - setState(1021); - formalParameterList(); - } - } - - setState(1024); - match(RPAREN); - setState(1026); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACK || _la==AT) { - { - setState(1025); - dims(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FormalParameterListContext extends ParserRuleContext { - public ReceiverParameterContext receiverParameter() { - return getRuleContext(ReceiverParameterContext.class,0); - } - public FormalParametersContext formalParameters() { - return getRuleContext(FormalParametersContext.class,0); - } - public TerminalNode COMMA() { return getToken(Java8Parser.COMMA, 0); } - public LastFormalParameterContext lastFormalParameter() { - return getRuleContext(LastFormalParameterContext.class,0); - } - public FormalParameterListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_formalParameterList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFormalParameterList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFormalParameterList(this); - } - } - - public final FormalParameterListContext formalParameterList() throws RecognitionException { - FormalParameterListContext _localctx = new FormalParameterListContext(_ctx, getState()); - enterRule(_localctx, 148, RULE_formalParameterList); - try { - setState(1034); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,82,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1028); - receiverParameter(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1029); - formalParameters(); - setState(1030); - match(COMMA); - setState(1031); - lastFormalParameter(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1033); - lastFormalParameter(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FormalParametersContext extends ParserRuleContext { - public List formalParameter() { - return getRuleContexts(FormalParameterContext.class); - } - public FormalParameterContext formalParameter(int i) { - return getRuleContext(FormalParameterContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public ReceiverParameterContext receiverParameter() { - return getRuleContext(ReceiverParameterContext.class,0); - } - public FormalParametersContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_formalParameters; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFormalParameters(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFormalParameters(this); - } - } - - public final FormalParametersContext formalParameters() throws RecognitionException { - FormalParametersContext _localctx = new FormalParametersContext(_ctx, getState()); - enterRule(_localctx, 150, RULE_formalParameters); - try { - int _alt; - setState(1052); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,85,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1036); - formalParameter(); - setState(1041); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,83,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1037); - match(COMMA); - setState(1038); - formalParameter(); - } - } - } - setState(1043); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,83,_ctx); - } - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1044); - receiverParameter(); - setState(1049); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,84,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1045); - match(COMMA); - setState(1046); - formalParameter(); - } - } - } - setState(1051); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,84,_ctx); - } - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FormalParameterContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public FormalParameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_formalParameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFormalParameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFormalParameter(this); - } - } - - public final FormalParameterContext formalParameter() throws RecognitionException { - FormalParameterContext _localctx = new FormalParameterContext(_ctx, getState()); - enterRule(_localctx, 152, RULE_formalParameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1057); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1054); - variableModifier(); - } - } - setState(1059); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1060); - unannType(); - setState(1061); - variableDeclaratorId(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class VariableModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode FINAL() { return getToken(Java8Parser.FINAL, 0); } - public VariableModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variableModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterVariableModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitVariableModifier(this); - } - } - - public final VariableModifierContext variableModifier() throws RecognitionException { - VariableModifierContext _localctx = new VariableModifierContext(_ctx, getState()); - enterRule(_localctx, 154, RULE_variableModifier); - try { - setState(1065); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(1063); - annotation(); - } - break; - case FINAL: - enterOuterAlt(_localctx, 2); - { - setState(1064); - match(FINAL); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LastFormalParameterContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public TerminalNode ELLIPSIS() { return getToken(Java8Parser.ELLIPSIS, 0); } - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public FormalParameterContext formalParameter() { - return getRuleContext(FormalParameterContext.class,0); - } - public LastFormalParameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_lastFormalParameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLastFormalParameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLastFormalParameter(this); - } - } - - public final LastFormalParameterContext lastFormalParameter() throws RecognitionException { - LastFormalParameterContext _localctx = new LastFormalParameterContext(_ctx, getState()); - enterRule(_localctx, 156, RULE_lastFormalParameter); - int _la; - try { - setState(1084); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,90,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1070); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1067); - variableModifier(); - } - } - setState(1072); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1073); - unannType(); - setState(1077); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(1074); - annotation(); - } - } - setState(1079); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1080); - match(ELLIPSIS); - setState(1081); - variableDeclaratorId(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1083); - formalParameter(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ReceiverParameterContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public TerminalNode THIS() { return getToken(Java8Parser.THIS, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public ReceiverParameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_receiverParameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterReceiverParameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitReceiverParameter(this); - } - } - - public final ReceiverParameterContext receiverParameter() throws RecognitionException { - ReceiverParameterContext _localctx = new ReceiverParameterContext(_ctx, getState()); - enterRule(_localctx, 158, RULE_receiverParameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1089); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(1086); - annotation(); - } - } - setState(1091); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1092); - unannType(); - setState(1095); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==Identifier) { - { - setState(1093); - match(Identifier); - setState(1094); - match(DOT); - } - } - - setState(1097); - match(THIS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class Throws_Context extends ParserRuleContext { - public TerminalNode THROWS() { return getToken(Java8Parser.THROWS, 0); } - public ExceptionTypeListContext exceptionTypeList() { - return getRuleContext(ExceptionTypeListContext.class,0); - } - public Throws_Context(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_throws_; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterThrows_(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitThrows_(this); - } - } - - public final Throws_Context throws_() throws RecognitionException { - Throws_Context _localctx = new Throws_Context(_ctx, getState()); - enterRule(_localctx, 160, RULE_throws_); - try { - enterOuterAlt(_localctx, 1); - { - setState(1099); - match(THROWS); - setState(1100); - exceptionTypeList(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExceptionTypeListContext extends ParserRuleContext { - public List exceptionType() { - return getRuleContexts(ExceptionTypeContext.class); - } - public ExceptionTypeContext exceptionType(int i) { - return getRuleContext(ExceptionTypeContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public ExceptionTypeListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exceptionTypeList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExceptionTypeList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExceptionTypeList(this); - } - } - - public final ExceptionTypeListContext exceptionTypeList() throws RecognitionException { - ExceptionTypeListContext _localctx = new ExceptionTypeListContext(_ctx, getState()); - enterRule(_localctx, 162, RULE_exceptionTypeList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1102); - exceptionType(); - setState(1107); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1103); - match(COMMA); - setState(1104); - exceptionType(); - } - } - setState(1109); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExceptionTypeContext extends ParserRuleContext { - public ClassTypeContext classType() { - return getRuleContext(ClassTypeContext.class,0); - } - public TypeVariableContext typeVariable() { - return getRuleContext(TypeVariableContext.class,0); - } - public ExceptionTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exceptionType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExceptionType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExceptionType(this); - } - } - - public final ExceptionTypeContext exceptionType() throws RecognitionException { - ExceptionTypeContext _localctx = new ExceptionTypeContext(_ctx, getState()); - enterRule(_localctx, 164, RULE_exceptionType); - try { - setState(1112); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,94,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1110); - classType(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1111); - typeVariable(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodBodyContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public MethodBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodBody(this); - } - } - - public final MethodBodyContext methodBody() throws RecognitionException { - MethodBodyContext _localctx = new MethodBodyContext(_ctx, getState()); - enterRule(_localctx, 166, RULE_methodBody); - try { - setState(1116); - _errHandler.sync(this); - switch (_input.LA(1)) { - case LBRACE: - enterOuterAlt(_localctx, 1); - { - setState(1114); - block(); - } - break; - case SEMI: - enterOuterAlt(_localctx, 2); - { - setState(1115); - match(SEMI); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InstanceInitializerContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public InstanceInitializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_instanceInitializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInstanceInitializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInstanceInitializer(this); - } - } - - public final InstanceInitializerContext instanceInitializer() throws RecognitionException { - InstanceInitializerContext _localctx = new InstanceInitializerContext(_ctx, getState()); - enterRule(_localctx, 168, RULE_instanceInitializer); - try { - enterOuterAlt(_localctx, 1); - { - setState(1118); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StaticInitializerContext extends ParserRuleContext { - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public StaticInitializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_staticInitializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStaticInitializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStaticInitializer(this); - } - } - - public final StaticInitializerContext staticInitializer() throws RecognitionException { - StaticInitializerContext _localctx = new StaticInitializerContext(_ctx, getState()); - enterRule(_localctx, 170, RULE_staticInitializer); - try { - enterOuterAlt(_localctx, 1); - { - setState(1120); - match(STATIC); - setState(1121); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstructorDeclarationContext extends ParserRuleContext { - public ConstructorDeclaratorContext constructorDeclarator() { - return getRuleContext(ConstructorDeclaratorContext.class,0); - } - public ConstructorBodyContext constructorBody() { - return getRuleContext(ConstructorBodyContext.class,0); - } - public List constructorModifier() { - return getRuleContexts(ConstructorModifierContext.class); - } - public ConstructorModifierContext constructorModifier(int i) { - return getRuleContext(ConstructorModifierContext.class,i); - } - public Throws_Context throws_() { - return getRuleContext(Throws_Context.class,0); - } - public ConstructorDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructorDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstructorDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstructorDeclaration(this); - } - } - - public final ConstructorDeclarationContext constructorDeclaration() throws RecognitionException { - ConstructorDeclarationContext _localctx = new ConstructorDeclarationContext(_ctx, getState()); - enterRule(_localctx, 172, RULE_constructorDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1126); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 60129542144L) != 0) || _la==AT) { - { - { - setState(1123); - constructorModifier(); - } - } - setState(1128); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1129); - constructorDeclarator(); - setState(1131); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==THROWS) { - { - setState(1130); - throws_(); - } - } - - setState(1133); - constructorBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstructorModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode PROTECTED() { return getToken(Java8Parser.PROTECTED, 0); } - public TerminalNode PRIVATE() { return getToken(Java8Parser.PRIVATE, 0); } - public ConstructorModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructorModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstructorModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstructorModifier(this); - } - } - - public final ConstructorModifierContext constructorModifier() throws RecognitionException { - ConstructorModifierContext _localctx = new ConstructorModifierContext(_ctx, getState()); - enterRule(_localctx, 174, RULE_constructorModifier); - try { - setState(1139); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(1135); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(1136); - match(PUBLIC); - } - break; - case PROTECTED: - enterOuterAlt(_localctx, 3); - { - setState(1137); - match(PROTECTED); - } - break; - case PRIVATE: - enterOuterAlt(_localctx, 4); - { - setState(1138); - match(PRIVATE); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstructorDeclaratorContext extends ParserRuleContext { - public SimpleTypeNameContext simpleTypeName() { - return getRuleContext(SimpleTypeNameContext.class,0); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TypeParametersContext typeParameters() { - return getRuleContext(TypeParametersContext.class,0); - } - public FormalParameterListContext formalParameterList() { - return getRuleContext(FormalParameterListContext.class,0); - } - public ConstructorDeclaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructorDeclarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstructorDeclarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstructorDeclarator(this); - } - } - - public final ConstructorDeclaratorContext constructorDeclarator() throws RecognitionException { - ConstructorDeclaratorContext _localctx = new ConstructorDeclaratorContext(_ctx, getState()); - enterRule(_localctx, 176, RULE_constructorDeclarator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1142); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1141); - typeParameters(); - } - } - - setState(1144); - simpleTypeName(); - setState(1145); - match(LPAREN); - setState(1147); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 138111369512L) != 0) || _la==Identifier || _la==AT) { - { - setState(1146); - formalParameterList(); - } - } - - setState(1149); - match(RPAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SimpleTypeNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public SimpleTypeNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_simpleTypeName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSimpleTypeName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSimpleTypeName(this); - } - } - - public final SimpleTypeNameContext simpleTypeName() throws RecognitionException { - SimpleTypeNameContext _localctx = new SimpleTypeNameContext(_ctx, getState()); - enterRule(_localctx, 178, RULE_simpleTypeName); - try { - enterOuterAlt(_localctx, 1); - { - setState(1151); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstructorBodyContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public ExplicitConstructorInvocationContext explicitConstructorInvocation() { - return getRuleContext(ExplicitConstructorInvocationContext.class,0); - } - public BlockStatementsContext blockStatements() { - return getRuleContext(BlockStatementsContext.class,0); - } - public ConstructorBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructorBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstructorBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstructorBody(this); - } - } - - public final ConstructorBodyContext constructorBody() throws RecognitionException { - ConstructorBodyContext _localctx = new ConstructorBodyContext(_ctx, getState()); - enterRule(_localctx, 180, RULE_constructorBody); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1153); - match(LBRACE); - setState(1155); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,101,_ctx) ) { - case 1: - { - setState(1154); - explicitConstructorInvocation(); - } - break; - } - setState(1158); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & -8359349417232995522L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0)) { - { - setState(1157); - blockStatements(); - } - } - - setState(1160); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExplicitConstructorInvocationContext extends ParserRuleContext { - public TerminalNode THIS() { return getToken(Java8Parser.THIS, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public PrimaryContext primary() { - return getRuleContext(PrimaryContext.class,0); - } - public ExplicitConstructorInvocationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_explicitConstructorInvocation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExplicitConstructorInvocation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExplicitConstructorInvocation(this); - } - } - - public final ExplicitConstructorInvocationContext explicitConstructorInvocation() throws RecognitionException { - ExplicitConstructorInvocationContext _localctx = new ExplicitConstructorInvocationContext(_ctx, getState()); - enterRule(_localctx, 182, RULE_explicitConstructorInvocation); - int _la; - try { - setState(1208); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,111,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1163); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1162); - typeArguments(); - } - } - - setState(1165); - match(THIS); - setState(1166); - match(LPAREN); - setState(1168); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1167); - argumentList(); - } - } - - setState(1170); - match(RPAREN); - setState(1171); - match(SEMI); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1173); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1172); - typeArguments(); - } - } - - setState(1175); - match(SUPER); - setState(1176); - match(LPAREN); - setState(1178); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1177); - argumentList(); - } - } - - setState(1180); - match(RPAREN); - setState(1181); - match(SEMI); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1182); - expressionName(); - setState(1183); - match(DOT); - setState(1185); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1184); - typeArguments(); - } - } - - setState(1187); - match(SUPER); - setState(1188); - match(LPAREN); - setState(1190); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1189); - argumentList(); - } - } - - setState(1192); - match(RPAREN); - setState(1193); - match(SEMI); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1195); - primary(); - setState(1196); - match(DOT); - setState(1198); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1197); - typeArguments(); - } - } - - setState(1200); - match(SUPER); - setState(1201); - match(LPAREN); - setState(1203); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1202); - argumentList(); - } - } - - setState(1205); - match(RPAREN); - setState(1206); - match(SEMI); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumDeclarationContext extends ParserRuleContext { - public TerminalNode ENUM() { return getToken(Java8Parser.ENUM, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public EnumBodyContext enumBody() { - return getRuleContext(EnumBodyContext.class,0); - } - public List classModifier() { - return getRuleContexts(ClassModifierContext.class); - } - public ClassModifierContext classModifier(int i) { - return getRuleContext(ClassModifierContext.class,i); - } - public SuperinterfacesContext superinterfaces() { - return getRuleContext(SuperinterfacesContext.class,0); - } - public EnumDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumDeclaration(this); - } - } - - public final EnumDeclarationContext enumDeclaration() throws RecognitionException { - EnumDeclarationContext _localctx = new EnumDeclarationContext(_ctx, getState()); - enterRule(_localctx, 184, RULE_enumDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1213); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 884763525122L) != 0) || _la==AT) { - { - { - setState(1210); - classModifier(); - } - } - setState(1215); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1216); - match(ENUM); - setState(1217); - match(Identifier); - setState(1219); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IMPLEMENTS) { - { - setState(1218); - superinterfaces(); - } - } - - setState(1221); - enumBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumBodyContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public EnumConstantListContext enumConstantList() { - return getRuleContext(EnumConstantListContext.class,0); - } - public TerminalNode COMMA() { return getToken(Java8Parser.COMMA, 0); } - public EnumBodyDeclarationsContext enumBodyDeclarations() { - return getRuleContext(EnumBodyDeclarationsContext.class,0); - } - public EnumBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumBody(this); - } - } - - public final EnumBodyContext enumBody() throws RecognitionException { - EnumBodyContext _localctx = new EnumBodyContext(_ctx, getState()); - enterRule(_localctx, 186, RULE_enumBody); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1223); - match(LBRACE); - setState(1225); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==Identifier || _la==AT) { - { - setState(1224); - enumConstantList(); - } - } - - setState(1228); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1227); - match(COMMA); - } - } - - setState(1231); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMI) { - { - setState(1230); - enumBodyDeclarations(); - } - } - - setState(1233); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumConstantListContext extends ParserRuleContext { - public List enumConstant() { - return getRuleContexts(EnumConstantContext.class); - } - public EnumConstantContext enumConstant(int i) { - return getRuleContext(EnumConstantContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public EnumConstantListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumConstantList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumConstantList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumConstantList(this); - } - } - - public final EnumConstantListContext enumConstantList() throws RecognitionException { - EnumConstantListContext _localctx = new EnumConstantListContext(_ctx, getState()); - enterRule(_localctx, 188, RULE_enumConstantList); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1235); - enumConstant(); - setState(1240); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,117,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1236); - match(COMMA); - setState(1237); - enumConstant(); - } - } - } - setState(1242); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,117,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumConstantContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public List enumConstantModifier() { - return getRuleContexts(EnumConstantModifierContext.class); - } - public EnumConstantModifierContext enumConstantModifier(int i) { - return getRuleContext(EnumConstantModifierContext.class,i); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ClassBodyContext classBody() { - return getRuleContext(ClassBodyContext.class,0); - } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public EnumConstantContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumConstant; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumConstant(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumConstant(this); - } - } - - public final EnumConstantContext enumConstant() throws RecognitionException { - EnumConstantContext _localctx = new EnumConstantContext(_ctx, getState()); - enterRule(_localctx, 190, RULE_enumConstant); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1246); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(1243); - enumConstantModifier(); - } - } - setState(1248); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1249); - match(Identifier); - setState(1255); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LPAREN) { - { - setState(1250); - match(LPAREN); - setState(1252); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1251); - argumentList(); - } - } - - setState(1254); - match(RPAREN); - } - } - - setState(1258); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACE) { - { - setState(1257); - classBody(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumConstantModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public EnumConstantModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumConstantModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumConstantModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumConstantModifier(this); - } - } - - public final EnumConstantModifierContext enumConstantModifier() throws RecognitionException { - EnumConstantModifierContext _localctx = new EnumConstantModifierContext(_ctx, getState()); - enterRule(_localctx, 192, RULE_enumConstantModifier); - try { - enterOuterAlt(_localctx, 1); - { - setState(1260); - annotation(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumBodyDeclarationsContext extends ParserRuleContext { - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public List classBodyDeclaration() { - return getRuleContexts(ClassBodyDeclarationContext.class); - } - public ClassBodyDeclarationContext classBodyDeclaration(int i) { - return getRuleContext(ClassBodyDeclarationContext.class,i); - } - public EnumBodyDeclarationsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumBodyDeclarations; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumBodyDeclarations(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumBodyDeclarations(this); - } - } - - public final EnumBodyDeclarationsContext enumBodyDeclarations() throws RecognitionException { - EnumBodyDeclarationsContext _localctx = new EnumBodyDeclarationsContext(_ctx, getState()); - enterRule(_localctx, 194, RULE_enumBodyDeclarations); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1262); - match(SEMI); - setState(1266); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & -8645991068613655766L) != 0) || ((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & 51539607553L) != 0)) { - { - { - setState(1263); - classBodyDeclaration(); - } - } - setState(1268); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceDeclarationContext extends ParserRuleContext { - public NormalInterfaceDeclarationContext normalInterfaceDeclaration() { - return getRuleContext(NormalInterfaceDeclarationContext.class,0); - } - public AnnotationTypeDeclarationContext annotationTypeDeclaration() { - return getRuleContext(AnnotationTypeDeclarationContext.class,0); - } - public InterfaceDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceDeclaration(this); - } - } - - public final InterfaceDeclarationContext interfaceDeclaration() throws RecognitionException { - InterfaceDeclarationContext _localctx = new InterfaceDeclarationContext(_ctx, getState()); - enterRule(_localctx, 196, RULE_interfaceDeclaration); - try { - setState(1271); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,123,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1269); - normalInterfaceDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1270); - annotationTypeDeclaration(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class NormalInterfaceDeclarationContext extends ParserRuleContext { - public TerminalNode INTERFACE() { return getToken(Java8Parser.INTERFACE, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public InterfaceBodyContext interfaceBody() { - return getRuleContext(InterfaceBodyContext.class,0); - } - public List interfaceModifier() { - return getRuleContexts(InterfaceModifierContext.class); - } - public InterfaceModifierContext interfaceModifier(int i) { - return getRuleContext(InterfaceModifierContext.class,i); - } - public TypeParametersContext typeParameters() { - return getRuleContext(TypeParametersContext.class,0); - } - public ExtendsInterfacesContext extendsInterfaces() { - return getRuleContext(ExtendsInterfacesContext.class,0); - } - public NormalInterfaceDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_normalInterfaceDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterNormalInterfaceDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitNormalInterfaceDeclaration(this); - } - } - - public final NormalInterfaceDeclarationContext normalInterfaceDeclaration() throws RecognitionException { - NormalInterfaceDeclarationContext _localctx = new NormalInterfaceDeclarationContext(_ctx, getState()); - enterRule(_localctx, 198, RULE_normalInterfaceDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1276); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 884763262978L) != 0) || _la==AT) { - { - { - setState(1273); - interfaceModifier(); - } - } - setState(1278); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1279); - match(INTERFACE); - setState(1280); - match(Identifier); - setState(1282); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1281); - typeParameters(); - } - } - - setState(1285); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==EXTENDS) { - { - setState(1284); - extendsInterfaces(); - } - } - - setState(1287); - interfaceBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode PROTECTED() { return getToken(Java8Parser.PROTECTED, 0); } - public TerminalNode PRIVATE() { return getToken(Java8Parser.PRIVATE, 0); } - public TerminalNode ABSTRACT() { return getToken(Java8Parser.ABSTRACT, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TerminalNode STRICTFP() { return getToken(Java8Parser.STRICTFP, 0); } - public InterfaceModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceModifier(this); - } - } - - public final InterfaceModifierContext interfaceModifier() throws RecognitionException { - InterfaceModifierContext _localctx = new InterfaceModifierContext(_ctx, getState()); - enterRule(_localctx, 200, RULE_interfaceModifier); - try { - setState(1296); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(1289); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(1290); - match(PUBLIC); - } - break; - case PROTECTED: - enterOuterAlt(_localctx, 3); - { - setState(1291); - match(PROTECTED); - } - break; - case PRIVATE: - enterOuterAlt(_localctx, 4); - { - setState(1292); - match(PRIVATE); - } - break; - case ABSTRACT: - enterOuterAlt(_localctx, 5); - { - setState(1293); - match(ABSTRACT); - } - break; - case STATIC: - enterOuterAlt(_localctx, 6); - { - setState(1294); - match(STATIC); - } - break; - case STRICTFP: - enterOuterAlt(_localctx, 7); - { - setState(1295); - match(STRICTFP); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExtendsInterfacesContext extends ParserRuleContext { - public TerminalNode EXTENDS() { return getToken(Java8Parser.EXTENDS, 0); } - public InterfaceTypeListContext interfaceTypeList() { - return getRuleContext(InterfaceTypeListContext.class,0); - } - public ExtendsInterfacesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extendsInterfaces; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExtendsInterfaces(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExtendsInterfaces(this); - } - } - - public final ExtendsInterfacesContext extendsInterfaces() throws RecognitionException { - ExtendsInterfacesContext _localctx = new ExtendsInterfacesContext(_ctx, getState()); - enterRule(_localctx, 202, RULE_extendsInterfaces); - try { - enterOuterAlt(_localctx, 1); - { - setState(1298); - match(EXTENDS); - setState(1299); - interfaceTypeList(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceBodyContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public List interfaceMemberDeclaration() { - return getRuleContexts(InterfaceMemberDeclarationContext.class); - } - public InterfaceMemberDeclarationContext interfaceMemberDeclaration(int i) { - return getRuleContext(InterfaceMemberDeclarationContext.class,i); - } - public InterfaceBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceBody(this); - } - } - - public final InterfaceBodyContext interfaceBody() throws RecognitionException { - InterfaceBodyContext _localctx = new InterfaceBodyContext(_ctx, getState()); - enterRule(_localctx, 204, RULE_interfaceBody); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1301); - match(LBRACE); - setState(1305); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & -9223089538734927062L) != 0) || ((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & 51539607553L) != 0)) { - { - { - setState(1302); - interfaceMemberDeclaration(); - } - } - setState(1307); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1308); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceMemberDeclarationContext extends ParserRuleContext { - public ConstantDeclarationContext constantDeclaration() { - return getRuleContext(ConstantDeclarationContext.class,0); - } - public InterfaceMethodDeclarationContext interfaceMethodDeclaration() { - return getRuleContext(InterfaceMethodDeclarationContext.class,0); - } - public ClassDeclarationContext classDeclaration() { - return getRuleContext(ClassDeclarationContext.class,0); - } - public InterfaceDeclarationContext interfaceDeclaration() { - return getRuleContext(InterfaceDeclarationContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public InterfaceMemberDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceMemberDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceMemberDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceMemberDeclaration(this); - } - } - - public final InterfaceMemberDeclarationContext interfaceMemberDeclaration() throws RecognitionException { - InterfaceMemberDeclarationContext _localctx = new InterfaceMemberDeclarationContext(_ctx, getState()); - enterRule(_localctx, 206, RULE_interfaceMemberDeclaration); - try { - setState(1315); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,129,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1310); - constantDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1311); - interfaceMethodDeclaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1312); - classDeclaration(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1313); - interfaceDeclaration(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1314); - match(SEMI); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstantDeclarationContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorListContext variableDeclaratorList() { - return getRuleContext(VariableDeclaratorListContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public List constantModifier() { - return getRuleContexts(ConstantModifierContext.class); - } - public ConstantModifierContext constantModifier(int i) { - return getRuleContext(ConstantModifierContext.class,i); - } - public ConstantDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constantDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstantDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstantDeclaration(this); - } - } - - public final ConstantDeclarationContext constantDeclaration() throws RecognitionException { - ConstantDeclarationContext _localctx = new ConstantDeclarationContext(_ctx, getState()); - enterRule(_localctx, 208, RULE_constantDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1320); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 309237907456L) != 0) || _la==AT) { - { - { - setState(1317); - constantModifier(); - } - } - setState(1322); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1323); - unannType(); - setState(1324); - variableDeclaratorList(); - setState(1325); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstantModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TerminalNode FINAL() { return getToken(Java8Parser.FINAL, 0); } - public ConstantModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constantModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstantModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstantModifier(this); - } - } - - public final ConstantModifierContext constantModifier() throws RecognitionException { - ConstantModifierContext _localctx = new ConstantModifierContext(_ctx, getState()); - enterRule(_localctx, 210, RULE_constantModifier); - try { - setState(1331); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(1327); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(1328); - match(PUBLIC); - } - break; - case STATIC: - enterOuterAlt(_localctx, 3); - { - setState(1329); - match(STATIC); - } - break; - case FINAL: - enterOuterAlt(_localctx, 4); - { - setState(1330); - match(FINAL); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceMethodDeclarationContext extends ParserRuleContext { - public MethodHeaderContext methodHeader() { - return getRuleContext(MethodHeaderContext.class,0); - } - public MethodBodyContext methodBody() { - return getRuleContext(MethodBodyContext.class,0); - } - public List interfaceMethodModifier() { - return getRuleContexts(InterfaceMethodModifierContext.class); - } - public InterfaceMethodModifierContext interfaceMethodModifier(int i) { - return getRuleContext(InterfaceMethodModifierContext.class,i); - } - public InterfaceMethodDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceMethodDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceMethodDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceMethodDeclaration(this); - } - } - - public final InterfaceMethodDeclarationContext interfaceMethodDeclaration() throws RecognitionException { - InterfaceMethodDeclarationContext _localctx = new InterfaceMethodDeclarationContext(_ctx, getState()); - enterRule(_localctx, 212, RULE_interfaceMethodDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1336); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 858993463298L) != 0) || _la==AT) { - { - { - setState(1333); - interfaceMethodModifier(); - } - } - setState(1338); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1339); - methodHeader(); - setState(1340); - methodBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InterfaceMethodModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode ABSTRACT() { return getToken(Java8Parser.ABSTRACT, 0); } - public TerminalNode DEFAULT() { return getToken(Java8Parser.DEFAULT, 0); } - public TerminalNode STATIC() { return getToken(Java8Parser.STATIC, 0); } - public TerminalNode STRICTFP() { return getToken(Java8Parser.STRICTFP, 0); } - public InterfaceMethodModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interfaceMethodModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInterfaceMethodModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInterfaceMethodModifier(this); - } - } - - public final InterfaceMethodModifierContext interfaceMethodModifier() throws RecognitionException { - InterfaceMethodModifierContext _localctx = new InterfaceMethodModifierContext(_ctx, getState()); - enterRule(_localctx, 214, RULE_interfaceMethodModifier); - try { - setState(1348); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(1342); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(1343); - match(PUBLIC); - } - break; - case ABSTRACT: - enterOuterAlt(_localctx, 3); - { - setState(1344); - match(ABSTRACT); - } - break; - case DEFAULT: - enterOuterAlt(_localctx, 4); - { - setState(1345); - match(DEFAULT); - } - break; - case STATIC: - enterOuterAlt(_localctx, 5); - { - setState(1346); - match(STATIC); - } - break; - case STRICTFP: - enterOuterAlt(_localctx, 6); - { - setState(1347); - match(STRICTFP); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AnnotationTypeDeclarationContext extends ParserRuleContext { - public TerminalNode AT() { return getToken(Java8Parser.AT, 0); } - public TerminalNode INTERFACE() { return getToken(Java8Parser.INTERFACE, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public AnnotationTypeBodyContext annotationTypeBody() { - return getRuleContext(AnnotationTypeBodyContext.class,0); - } - public List interfaceModifier() { - return getRuleContexts(InterfaceModifierContext.class); - } - public InterfaceModifierContext interfaceModifier(int i) { - return getRuleContext(InterfaceModifierContext.class,i); - } - public AnnotationTypeDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_annotationTypeDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAnnotationTypeDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAnnotationTypeDeclaration(this); - } - } - - public final AnnotationTypeDeclarationContext annotationTypeDeclaration() throws RecognitionException { - AnnotationTypeDeclarationContext _localctx = new AnnotationTypeDeclarationContext(_ctx, getState()); - enterRule(_localctx, 216, RULE_annotationTypeDeclaration); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1353); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,134,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1350); - interfaceModifier(); - } - } - } - setState(1355); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,134,_ctx); - } - setState(1356); - match(AT); - setState(1357); - match(INTERFACE); - setState(1358); - match(Identifier); - setState(1359); - annotationTypeBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AnnotationTypeBodyContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public List annotationTypeMemberDeclaration() { - return getRuleContexts(AnnotationTypeMemberDeclarationContext.class); - } - public AnnotationTypeMemberDeclarationContext annotationTypeMemberDeclaration(int i) { - return getRuleContext(AnnotationTypeMemberDeclarationContext.class,i); - } - public AnnotationTypeBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_annotationTypeBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAnnotationTypeBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAnnotationTypeBody(this); - } - } - - public final AnnotationTypeBodyContext annotationTypeBody() throws RecognitionException { - AnnotationTypeBodyContext _localctx = new AnnotationTypeBodyContext(_ctx, getState()); - enterRule(_localctx, 218, RULE_annotationTypeBody); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1361); - match(LBRACE); - setState(1365); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & -9223371013711641814L) != 0) || _la==Identifier || _la==AT) { - { - { - setState(1362); - annotationTypeMemberDeclaration(); - } - } - setState(1367); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1368); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AnnotationTypeMemberDeclarationContext extends ParserRuleContext { - public AnnotationTypeElementDeclarationContext annotationTypeElementDeclaration() { - return getRuleContext(AnnotationTypeElementDeclarationContext.class,0); - } - public ConstantDeclarationContext constantDeclaration() { - return getRuleContext(ConstantDeclarationContext.class,0); - } - public ClassDeclarationContext classDeclaration() { - return getRuleContext(ClassDeclarationContext.class,0); - } - public InterfaceDeclarationContext interfaceDeclaration() { - return getRuleContext(InterfaceDeclarationContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public AnnotationTypeMemberDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_annotationTypeMemberDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAnnotationTypeMemberDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAnnotationTypeMemberDeclaration(this); - } - } - - public final AnnotationTypeMemberDeclarationContext annotationTypeMemberDeclaration() throws RecognitionException { - AnnotationTypeMemberDeclarationContext _localctx = new AnnotationTypeMemberDeclarationContext(_ctx, getState()); - enterRule(_localctx, 220, RULE_annotationTypeMemberDeclaration); - try { - setState(1375); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,136,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1370); - annotationTypeElementDeclaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1371); - constantDeclaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1372); - classDeclaration(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1373); - interfaceDeclaration(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1374); - match(SEMI); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AnnotationTypeElementDeclarationContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public List annotationTypeElementModifier() { - return getRuleContexts(AnnotationTypeElementModifierContext.class); - } - public AnnotationTypeElementModifierContext annotationTypeElementModifier(int i) { - return getRuleContext(AnnotationTypeElementModifierContext.class,i); - } - public DimsContext dims() { - return getRuleContext(DimsContext.class,0); - } - public DefaultValueContext defaultValue() { - return getRuleContext(DefaultValueContext.class,0); - } - public AnnotationTypeElementDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_annotationTypeElementDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAnnotationTypeElementDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAnnotationTypeElementDeclaration(this); - } - } - - public final AnnotationTypeElementDeclarationContext annotationTypeElementDeclaration() throws RecognitionException { - AnnotationTypeElementDeclarationContext _localctx = new AnnotationTypeElementDeclarationContext(_ctx, getState()); - enterRule(_localctx, 222, RULE_annotationTypeElementDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1380); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==ABSTRACT || _la==PUBLIC || _la==AT) { - { - { - setState(1377); - annotationTypeElementModifier(); - } - } - setState(1382); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1383); - unannType(); - setState(1384); - match(Identifier); - setState(1385); - match(LPAREN); - setState(1386); - match(RPAREN); - setState(1388); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACK || _la==AT) { - { - setState(1387); - dims(); - } - } - - setState(1391); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==DEFAULT) { - { - setState(1390); - defaultValue(); - } - } - - setState(1393); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AnnotationTypeElementModifierContext extends ParserRuleContext { - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public TerminalNode PUBLIC() { return getToken(Java8Parser.PUBLIC, 0); } - public TerminalNode ABSTRACT() { return getToken(Java8Parser.ABSTRACT, 0); } - public AnnotationTypeElementModifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_annotationTypeElementModifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAnnotationTypeElementModifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAnnotationTypeElementModifier(this); - } - } - - public final AnnotationTypeElementModifierContext annotationTypeElementModifier() throws RecognitionException { - AnnotationTypeElementModifierContext _localctx = new AnnotationTypeElementModifierContext(_ctx, getState()); - enterRule(_localctx, 224, RULE_annotationTypeElementModifier); - try { - setState(1398); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AT: - enterOuterAlt(_localctx, 1); - { - setState(1395); - annotation(); - } - break; - case PUBLIC: - enterOuterAlt(_localctx, 2); - { - setState(1396); - match(PUBLIC); - } - break; - case ABSTRACT: - enterOuterAlt(_localctx, 3); - { - setState(1397); - match(ABSTRACT); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class DefaultValueContext extends ParserRuleContext { - public TerminalNode DEFAULT() { return getToken(Java8Parser.DEFAULT, 0); } - public ElementValueContext elementValue() { - return getRuleContext(ElementValueContext.class,0); - } - public DefaultValueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_defaultValue; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterDefaultValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitDefaultValue(this); - } - } - - public final DefaultValueContext defaultValue() throws RecognitionException { - DefaultValueContext _localctx = new DefaultValueContext(_ctx, getState()); - enterRule(_localctx, 226, RULE_defaultValue); - try { - enterOuterAlt(_localctx, 1); - { - setState(1400); - match(DEFAULT); - setState(1401); - elementValue(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AnnotationContext extends ParserRuleContext { - public NormalAnnotationContext normalAnnotation() { - return getRuleContext(NormalAnnotationContext.class,0); - } - public MarkerAnnotationContext markerAnnotation() { - return getRuleContext(MarkerAnnotationContext.class,0); - } - public SingleElementAnnotationContext singleElementAnnotation() { - return getRuleContext(SingleElementAnnotationContext.class,0); - } - public AnnotationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_annotation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAnnotation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAnnotation(this); - } - } - - public final AnnotationContext annotation() throws RecognitionException { - AnnotationContext _localctx = new AnnotationContext(_ctx, getState()); - enterRule(_localctx, 228, RULE_annotation); - try { - setState(1406); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,141,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1403); - normalAnnotation(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1404); - markerAnnotation(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1405); - singleElementAnnotation(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class NormalAnnotationContext extends ParserRuleContext { - public TerminalNode AT() { return getToken(Java8Parser.AT, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ElementValuePairListContext elementValuePairList() { - return getRuleContext(ElementValuePairListContext.class,0); - } - public NormalAnnotationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_normalAnnotation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterNormalAnnotation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitNormalAnnotation(this); - } - } - - public final NormalAnnotationContext normalAnnotation() throws RecognitionException { - NormalAnnotationContext _localctx = new NormalAnnotationContext(_ctx, getState()); - enterRule(_localctx, 230, RULE_normalAnnotation); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1408); - match(AT); - setState(1409); - typeName(); - setState(1410); - match(LPAREN); - setState(1412); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==Identifier) { - { - setState(1411); - elementValuePairList(); - } - } - - setState(1414); - match(RPAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ElementValuePairListContext extends ParserRuleContext { - public List elementValuePair() { - return getRuleContexts(ElementValuePairContext.class); - } - public ElementValuePairContext elementValuePair(int i) { - return getRuleContext(ElementValuePairContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public ElementValuePairListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_elementValuePairList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterElementValuePairList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitElementValuePairList(this); - } - } - - public final ElementValuePairListContext elementValuePairList() throws RecognitionException { - ElementValuePairListContext _localctx = new ElementValuePairListContext(_ctx, getState()); - enterRule(_localctx, 232, RULE_elementValuePairList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1416); - elementValuePair(); - setState(1421); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1417); - match(COMMA); - setState(1418); - elementValuePair(); - } - } - setState(1423); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ElementValuePairContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode ASSIGN() { return getToken(Java8Parser.ASSIGN, 0); } - public ElementValueContext elementValue() { - return getRuleContext(ElementValueContext.class,0); - } - public ElementValuePairContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_elementValuePair; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterElementValuePair(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitElementValuePair(this); - } - } - - public final ElementValuePairContext elementValuePair() throws RecognitionException { - ElementValuePairContext _localctx = new ElementValuePairContext(_ctx, getState()); - enterRule(_localctx, 234, RULE_elementValuePair); - try { - enterOuterAlt(_localctx, 1); - { - setState(1424); - match(Identifier); - setState(1425); - match(ASSIGN); - setState(1426); - elementValue(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ElementValueContext extends ParserRuleContext { - public ConditionalExpressionContext conditionalExpression() { - return getRuleContext(ConditionalExpressionContext.class,0); - } - public ElementValueArrayInitializerContext elementValueArrayInitializer() { - return getRuleContext(ElementValueArrayInitializerContext.class,0); - } - public AnnotationContext annotation() { - return getRuleContext(AnnotationContext.class,0); - } - public ElementValueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_elementValue; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterElementValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitElementValue(this); - } - } - - public final ElementValueContext elementValue() throws RecognitionException { - ElementValueContext _localctx = new ElementValueContext(_ctx, getState()); - enterRule(_localctx, 236, RULE_elementValue); - try { - setState(1431); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,144,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1428); - conditionalExpression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1429); - elementValueArrayInitializer(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1430); - annotation(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ElementValueArrayInitializerContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public ElementValueListContext elementValueList() { - return getRuleContext(ElementValueListContext.class,0); - } - public TerminalNode COMMA() { return getToken(Java8Parser.COMMA, 0); } - public ElementValueArrayInitializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_elementValueArrayInitializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterElementValueArrayInitializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitElementValueArrayInitializer(this); - } - } - - public final ElementValueArrayInitializerContext elementValueArrayInitializer() throws RecognitionException { - ElementValueArrayInitializerContext _localctx = new ElementValueArrayInitializerContext(_ctx, getState()); - enterRule(_localctx, 238, RULE_elementValueArrayInitializer); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1433); - match(LBRACE); - setState(1435); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 862730839481401640L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1434); - elementValueList(); - } - } - - setState(1438); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1437); - match(COMMA); - } - } - - setState(1440); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ElementValueListContext extends ParserRuleContext { - public List elementValue() { - return getRuleContexts(ElementValueContext.class); - } - public ElementValueContext elementValue(int i) { - return getRuleContext(ElementValueContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public ElementValueListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_elementValueList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterElementValueList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitElementValueList(this); - } - } - - public final ElementValueListContext elementValueList() throws RecognitionException { - ElementValueListContext _localctx = new ElementValueListContext(_ctx, getState()); - enterRule(_localctx, 240, RULE_elementValueList); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1442); - elementValue(); - setState(1447); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,147,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1443); - match(COMMA); - setState(1444); - elementValue(); - } - } - } - setState(1449); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,147,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MarkerAnnotationContext extends ParserRuleContext { - public TerminalNode AT() { return getToken(Java8Parser.AT, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public MarkerAnnotationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_markerAnnotation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMarkerAnnotation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMarkerAnnotation(this); - } - } - - public final MarkerAnnotationContext markerAnnotation() throws RecognitionException { - MarkerAnnotationContext _localctx = new MarkerAnnotationContext(_ctx, getState()); - enterRule(_localctx, 242, RULE_markerAnnotation); - try { - enterOuterAlt(_localctx, 1); - { - setState(1450); - match(AT); - setState(1451); - typeName(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SingleElementAnnotationContext extends ParserRuleContext { - public TerminalNode AT() { return getToken(Java8Parser.AT, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ElementValueContext elementValue() { - return getRuleContext(ElementValueContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public SingleElementAnnotationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_singleElementAnnotation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSingleElementAnnotation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSingleElementAnnotation(this); - } - } - - public final SingleElementAnnotationContext singleElementAnnotation() throws RecognitionException { - SingleElementAnnotationContext _localctx = new SingleElementAnnotationContext(_ctx, getState()); - enterRule(_localctx, 244, RULE_singleElementAnnotation); - try { - enterOuterAlt(_localctx, 1); - { - setState(1453); - match(AT); - setState(1454); - typeName(); - setState(1455); - match(LPAREN); - setState(1456); - elementValue(); - setState(1457); - match(RPAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayInitializerContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public VariableInitializerListContext variableInitializerList() { - return getRuleContext(VariableInitializerListContext.class,0); - } - public TerminalNode COMMA() { return getToken(Java8Parser.COMMA, 0); } - public ArrayInitializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arrayInitializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArrayInitializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArrayInitializer(this); - } - } - - public final ArrayInitializerContext arrayInitializer() throws RecognitionException { - ArrayInitializerContext _localctx = new ArrayInitializerContext(_ctx, getState()); - enterRule(_localctx, 246, RULE_arrayInitializer); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1459); - match(LBRACE); - setState(1461); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 862730839481401640L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1460); - variableInitializerList(); - } - } - - setState(1464); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1463); - match(COMMA); - } - } - - setState(1466); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class VariableInitializerListContext extends ParserRuleContext { - public List variableInitializer() { - return getRuleContexts(VariableInitializerContext.class); - } - public VariableInitializerContext variableInitializer(int i) { - return getRuleContext(VariableInitializerContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public VariableInitializerListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variableInitializerList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterVariableInitializerList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitVariableInitializerList(this); - } - } - - public final VariableInitializerListContext variableInitializerList() throws RecognitionException { - VariableInitializerListContext _localctx = new VariableInitializerListContext(_ctx, getState()); - enterRule(_localctx, 248, RULE_variableInitializerList); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1468); - variableInitializer(); - setState(1473); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,150,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1469); - match(COMMA); - setState(1470); - variableInitializer(); - } - } - } - setState(1475); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,150,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class BlockContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public BlockStatementsContext blockStatements() { - return getRuleContext(BlockStatementsContext.class,0); - } - public BlockContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_block; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterBlock(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitBlock(this); - } - } - - public final BlockContext block() throws RecognitionException { - BlockContext _localctx = new BlockContext(_ctx, getState()); - enterRule(_localctx, 250, RULE_block); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1476); - match(LBRACE); - setState(1478); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & -8359349417232995522L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0)) { - { - setState(1477); - blockStatements(); - } - } - - setState(1480); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class BlockStatementsContext extends ParserRuleContext { - public List blockStatement() { - return getRuleContexts(BlockStatementContext.class); - } - public BlockStatementContext blockStatement(int i) { - return getRuleContext(BlockStatementContext.class,i); - } - public BlockStatementsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_blockStatements; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterBlockStatements(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitBlockStatements(this); - } - } - - public final BlockStatementsContext blockStatements() throws RecognitionException { - BlockStatementsContext _localctx = new BlockStatementsContext(_ctx, getState()); - enterRule(_localctx, 252, RULE_blockStatements); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1483); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(1482); - blockStatement(); - } - } - setState(1485); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & -8359349417232995522L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0) ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class BlockStatementContext extends ParserRuleContext { - public LocalVariableDeclarationStatementContext localVariableDeclarationStatement() { - return getRuleContext(LocalVariableDeclarationStatementContext.class,0); - } - public ClassDeclarationContext classDeclaration() { - return getRuleContext(ClassDeclarationContext.class,0); - } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public BlockStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_blockStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterBlockStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitBlockStatement(this); - } - } - - public final BlockStatementContext blockStatement() throws RecognitionException { - BlockStatementContext _localctx = new BlockStatementContext(_ctx, getState()); - enterRule(_localctx, 254, RULE_blockStatement); - try { - setState(1490); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,153,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1487); - localVariableDeclarationStatement(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1488); - classDeclaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1489); - statement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LocalVariableDeclarationStatementContext extends ParserRuleContext { - public LocalVariableDeclarationContext localVariableDeclaration() { - return getRuleContext(LocalVariableDeclarationContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public LocalVariableDeclarationStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_localVariableDeclarationStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLocalVariableDeclarationStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLocalVariableDeclarationStatement(this); - } - } - - public final LocalVariableDeclarationStatementContext localVariableDeclarationStatement() throws RecognitionException { - LocalVariableDeclarationStatementContext _localctx = new LocalVariableDeclarationStatementContext(_ctx, getState()); - enterRule(_localctx, 256, RULE_localVariableDeclarationStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1492); - localVariableDeclaration(); - setState(1493); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LocalVariableDeclarationContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorListContext variableDeclaratorList() { - return getRuleContext(VariableDeclaratorListContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public LocalVariableDeclarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_localVariableDeclaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLocalVariableDeclaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLocalVariableDeclaration(this); - } - } - - public final LocalVariableDeclarationContext localVariableDeclaration() throws RecognitionException { - LocalVariableDeclarationContext _localctx = new LocalVariableDeclarationContext(_ctx, getState()); - enterRule(_localctx, 258, RULE_localVariableDeclaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1498); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1495); - variableModifier(); - } - } - setState(1500); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1501); - unannType(); - setState(1502); - variableDeclaratorList(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StatementContext extends ParserRuleContext { - public StatementWithoutTrailingSubstatementContext statementWithoutTrailingSubstatement() { - return getRuleContext(StatementWithoutTrailingSubstatementContext.class,0); - } - public LabeledStatementContext labeledStatement() { - return getRuleContext(LabeledStatementContext.class,0); - } - public IfThenStatementContext ifThenStatement() { - return getRuleContext(IfThenStatementContext.class,0); - } - public IfThenElseStatementContext ifThenElseStatement() { - return getRuleContext(IfThenElseStatementContext.class,0); - } - public WhileStatementContext whileStatement() { - return getRuleContext(WhileStatementContext.class,0); - } - public ForStatementContext forStatement() { - return getRuleContext(ForStatementContext.class,0); - } - public StatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStatement(this); - } - } - - public final StatementContext statement() throws RecognitionException { - StatementContext _localctx = new StatementContext(_ctx, getState()); - enterRule(_localctx, 260, RULE_statement); - try { - setState(1510); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,155,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1504); - statementWithoutTrailingSubstatement(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1505); - labeledStatement(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1506); - ifThenStatement(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1507); - ifThenElseStatement(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1508); - whileStatement(); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1509); - forStatement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StatementNoShortIfContext extends ParserRuleContext { - public StatementWithoutTrailingSubstatementContext statementWithoutTrailingSubstatement() { - return getRuleContext(StatementWithoutTrailingSubstatementContext.class,0); - } - public LabeledStatementNoShortIfContext labeledStatementNoShortIf() { - return getRuleContext(LabeledStatementNoShortIfContext.class,0); - } - public IfThenElseStatementNoShortIfContext ifThenElseStatementNoShortIf() { - return getRuleContext(IfThenElseStatementNoShortIfContext.class,0); - } - public WhileStatementNoShortIfContext whileStatementNoShortIf() { - return getRuleContext(WhileStatementNoShortIfContext.class,0); - } - public ForStatementNoShortIfContext forStatementNoShortIf() { - return getRuleContext(ForStatementNoShortIfContext.class,0); - } - public StatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStatementNoShortIf(this); - } - } - - public final StatementNoShortIfContext statementNoShortIf() throws RecognitionException { - StatementNoShortIfContext _localctx = new StatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 262, RULE_statementNoShortIf); - try { - setState(1517); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,156,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1512); - statementWithoutTrailingSubstatement(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1513); - labeledStatementNoShortIf(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1514); - ifThenElseStatementNoShortIf(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1515); - whileStatementNoShortIf(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1516); - forStatementNoShortIf(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StatementWithoutTrailingSubstatementContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public EmptyStatement_Context emptyStatement_() { - return getRuleContext(EmptyStatement_Context.class,0); - } - public ExpressionStatementContext expressionStatement() { - return getRuleContext(ExpressionStatementContext.class,0); - } - public AssertStatementContext assertStatement() { - return getRuleContext(AssertStatementContext.class,0); - } - public SwitchStatementContext switchStatement() { - return getRuleContext(SwitchStatementContext.class,0); - } - public DoStatementContext doStatement() { - return getRuleContext(DoStatementContext.class,0); - } - public BreakStatementContext breakStatement() { - return getRuleContext(BreakStatementContext.class,0); - } - public ContinueStatementContext continueStatement() { - return getRuleContext(ContinueStatementContext.class,0); - } - public ReturnStatementContext returnStatement() { - return getRuleContext(ReturnStatementContext.class,0); - } - public SynchronizedStatementContext synchronizedStatement() { - return getRuleContext(SynchronizedStatementContext.class,0); - } - public ThrowStatementContext throwStatement() { - return getRuleContext(ThrowStatementContext.class,0); - } - public TryStatementContext tryStatement() { - return getRuleContext(TryStatementContext.class,0); - } - public StatementWithoutTrailingSubstatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statementWithoutTrailingSubstatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStatementWithoutTrailingSubstatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStatementWithoutTrailingSubstatement(this); - } - } - - public final StatementWithoutTrailingSubstatementContext statementWithoutTrailingSubstatement() throws RecognitionException { - StatementWithoutTrailingSubstatementContext _localctx = new StatementWithoutTrailingSubstatementContext(_ctx, getState()); - enterRule(_localctx, 264, RULE_statementWithoutTrailingSubstatement); - try { - setState(1531); - _errHandler.sync(this); - switch (_input.LA(1)) { - case LBRACE: - enterOuterAlt(_localctx, 1); - { - setState(1519); - block(); - } - break; - case SEMI: - enterOuterAlt(_localctx, 2); - { - setState(1520); - emptyStatement_(); - } - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case NEW: - case SHORT: - case SUPER: - case THIS: - case VOID: - case IntegerLiteral: - case FloatingPointLiteral: - case BooleanLiteral: - case CharacterLiteral: - case StringLiteral: - case NullLiteral: - case LPAREN: - case INC: - case DEC: - case Identifier: - case AT: - enterOuterAlt(_localctx, 3); - { - setState(1521); - expressionStatement(); - } - break; - case ASSERT: - enterOuterAlt(_localctx, 4); - { - setState(1522); - assertStatement(); - } - break; - case SWITCH: - enterOuterAlt(_localctx, 5); - { - setState(1523); - switchStatement(); - } - break; - case DO: - enterOuterAlt(_localctx, 6); - { - setState(1524); - doStatement(); - } - break; - case BREAK: - enterOuterAlt(_localctx, 7); - { - setState(1525); - breakStatement(); - } - break; - case CONTINUE: - enterOuterAlt(_localctx, 8); - { - setState(1526); - continueStatement(); - } - break; - case RETURN: - enterOuterAlt(_localctx, 9); - { - setState(1527); - returnStatement(); - } - break; - case SYNCHRONIZED: - enterOuterAlt(_localctx, 10); - { - setState(1528); - synchronizedStatement(); - } - break; - case THROW: - enterOuterAlt(_localctx, 11); - { - setState(1529); - throwStatement(); - } - break; - case TRY: - enterOuterAlt(_localctx, 12); - { - setState(1530); - tryStatement(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EmptyStatement_Context extends ParserRuleContext { - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public EmptyStatement_Context(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_emptyStatement_; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEmptyStatement_(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEmptyStatement_(this); - } - } - - public final EmptyStatement_Context emptyStatement_() throws RecognitionException { - EmptyStatement_Context _localctx = new EmptyStatement_Context(_ctx, getState()); - enterRule(_localctx, 266, RULE_emptyStatement_); - try { - enterOuterAlt(_localctx, 1); - { - setState(1533); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LabeledStatementContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public LabeledStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_labeledStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLabeledStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLabeledStatement(this); - } - } - - public final LabeledStatementContext labeledStatement() throws RecognitionException { - LabeledStatementContext _localctx = new LabeledStatementContext(_ctx, getState()); - enterRule(_localctx, 268, RULE_labeledStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1535); - match(Identifier); - setState(1536); - match(COLON); - setState(1537); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LabeledStatementNoShortIfContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public StatementNoShortIfContext statementNoShortIf() { - return getRuleContext(StatementNoShortIfContext.class,0); - } - public LabeledStatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_labeledStatementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLabeledStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLabeledStatementNoShortIf(this); - } - } - - public final LabeledStatementNoShortIfContext labeledStatementNoShortIf() throws RecognitionException { - LabeledStatementNoShortIfContext _localctx = new LabeledStatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 270, RULE_labeledStatementNoShortIf); - try { - enterOuterAlt(_localctx, 1); - { - setState(1539); - match(Identifier); - setState(1540); - match(COLON); - setState(1541); - statementNoShortIf(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExpressionStatementContext extends ParserRuleContext { - public StatementExpressionContext statementExpression() { - return getRuleContext(StatementExpressionContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public ExpressionStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_expressionStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExpressionStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExpressionStatement(this); - } - } - - public final ExpressionStatementContext expressionStatement() throws RecognitionException { - ExpressionStatementContext _localctx = new ExpressionStatementContext(_ctx, getState()); - enterRule(_localctx, 272, RULE_expressionStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1543); - statementExpression(); - setState(1544); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StatementExpressionContext extends ParserRuleContext { - public AssignmentContext assignment() { - return getRuleContext(AssignmentContext.class,0); - } - public PreIncrementExpressionContext preIncrementExpression() { - return getRuleContext(PreIncrementExpressionContext.class,0); - } - public PreDecrementExpressionContext preDecrementExpression() { - return getRuleContext(PreDecrementExpressionContext.class,0); - } - public PostIncrementExpressionContext postIncrementExpression() { - return getRuleContext(PostIncrementExpressionContext.class,0); - } - public PostDecrementExpressionContext postDecrementExpression() { - return getRuleContext(PostDecrementExpressionContext.class,0); - } - public MethodInvocationContext methodInvocation() { - return getRuleContext(MethodInvocationContext.class,0); - } - public ClassInstanceCreationExpressionContext classInstanceCreationExpression() { - return getRuleContext(ClassInstanceCreationExpressionContext.class,0); - } - public StatementExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statementExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStatementExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStatementExpression(this); - } - } - - public final StatementExpressionContext statementExpression() throws RecognitionException { - StatementExpressionContext _localctx = new StatementExpressionContext(_ctx, getState()); - enterRule(_localctx, 274, RULE_statementExpression); - try { - setState(1553); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,158,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1546); - assignment(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1547); - preIncrementExpression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1548); - preDecrementExpression(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1549); - postIncrementExpression(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1550); - postDecrementExpression(); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1551); - methodInvocation(); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(1552); - classInstanceCreationExpression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class IfThenStatementContext extends ParserRuleContext { - public TerminalNode IF() { return getToken(Java8Parser.IF, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public IfThenStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ifThenStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterIfThenStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitIfThenStatement(this); - } - } - - public final IfThenStatementContext ifThenStatement() throws RecognitionException { - IfThenStatementContext _localctx = new IfThenStatementContext(_ctx, getState()); - enterRule(_localctx, 276, RULE_ifThenStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1555); - match(IF); - setState(1556); - match(LPAREN); - setState(1557); - expression(); - setState(1558); - match(RPAREN); - setState(1559); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class IfThenElseStatementContext extends ParserRuleContext { - public TerminalNode IF() { return getToken(Java8Parser.IF, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementNoShortIfContext statementNoShortIf() { - return getRuleContext(StatementNoShortIfContext.class,0); - } - public TerminalNode ELSE() { return getToken(Java8Parser.ELSE, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public IfThenElseStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ifThenElseStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterIfThenElseStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitIfThenElseStatement(this); - } - } - - public final IfThenElseStatementContext ifThenElseStatement() throws RecognitionException { - IfThenElseStatementContext _localctx = new IfThenElseStatementContext(_ctx, getState()); - enterRule(_localctx, 278, RULE_ifThenElseStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1561); - match(IF); - setState(1562); - match(LPAREN); - setState(1563); - expression(); - setState(1564); - match(RPAREN); - setState(1565); - statementNoShortIf(); - setState(1566); - match(ELSE); - setState(1567); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class IfThenElseStatementNoShortIfContext extends ParserRuleContext { - public TerminalNode IF() { return getToken(Java8Parser.IF, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public List statementNoShortIf() { - return getRuleContexts(StatementNoShortIfContext.class); - } - public StatementNoShortIfContext statementNoShortIf(int i) { - return getRuleContext(StatementNoShortIfContext.class,i); - } - public TerminalNode ELSE() { return getToken(Java8Parser.ELSE, 0); } - public IfThenElseStatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ifThenElseStatementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterIfThenElseStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitIfThenElseStatementNoShortIf(this); - } - } - - public final IfThenElseStatementNoShortIfContext ifThenElseStatementNoShortIf() throws RecognitionException { - IfThenElseStatementNoShortIfContext _localctx = new IfThenElseStatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 280, RULE_ifThenElseStatementNoShortIf); - try { - enterOuterAlt(_localctx, 1); - { - setState(1569); - match(IF); - setState(1570); - match(LPAREN); - setState(1571); - expression(); - setState(1572); - match(RPAREN); - setState(1573); - statementNoShortIf(); - setState(1574); - match(ELSE); - setState(1575); - statementNoShortIf(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AssertStatementContext extends ParserRuleContext { - public TerminalNode ASSERT() { return getToken(Java8Parser.ASSERT, 0); } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public AssertStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_assertStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAssertStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAssertStatement(this); - } - } - - public final AssertStatementContext assertStatement() throws RecognitionException { - AssertStatementContext _localctx = new AssertStatementContext(_ctx, getState()); - enterRule(_localctx, 282, RULE_assertStatement); - try { - setState(1587); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,159,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1577); - match(ASSERT); - setState(1578); - expression(); - setState(1579); - match(SEMI); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1581); - match(ASSERT); - setState(1582); - expression(); - setState(1583); - match(COLON); - setState(1584); - expression(); - setState(1585); - match(SEMI); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SwitchStatementContext extends ParserRuleContext { - public TerminalNode SWITCH() { return getToken(Java8Parser.SWITCH, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public SwitchBlockContext switchBlock() { - return getRuleContext(SwitchBlockContext.class,0); - } - public SwitchStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switchStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSwitchStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSwitchStatement(this); - } - } - - public final SwitchStatementContext switchStatement() throws RecognitionException { - SwitchStatementContext _localctx = new SwitchStatementContext(_ctx, getState()); - enterRule(_localctx, 284, RULE_switchStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1589); - match(SWITCH); - setState(1590); - match(LPAREN); - setState(1591); - expression(); - setState(1592); - match(RPAREN); - setState(1593); - switchBlock(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SwitchBlockContext extends ParserRuleContext { - public TerminalNode LBRACE() { return getToken(Java8Parser.LBRACE, 0); } - public TerminalNode RBRACE() { return getToken(Java8Parser.RBRACE, 0); } - public List switchBlockStatementGroup() { - return getRuleContexts(SwitchBlockStatementGroupContext.class); - } - public SwitchBlockStatementGroupContext switchBlockStatementGroup(int i) { - return getRuleContext(SwitchBlockStatementGroupContext.class,i); - } - public List switchLabel() { - return getRuleContexts(SwitchLabelContext.class); - } - public SwitchLabelContext switchLabel(int i) { - return getRuleContext(SwitchLabelContext.class,i); - } - public SwitchBlockContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switchBlock; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSwitchBlock(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSwitchBlock(this); - } - } - - public final SwitchBlockContext switchBlock() throws RecognitionException { - SwitchBlockContext _localctx = new SwitchBlockContext(_ctx, getState()); - enterRule(_localctx, 286, RULE_switchBlock); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1595); - match(LBRACE); - setState(1599); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,160,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1596); - switchBlockStatementGroup(); - } - } - } - setState(1601); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,160,_ctx); - } - setState(1605); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==CASE || _la==DEFAULT) { - { - { - setState(1602); - switchLabel(); - } - } - setState(1607); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1608); - match(RBRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SwitchBlockStatementGroupContext extends ParserRuleContext { - public SwitchLabelsContext switchLabels() { - return getRuleContext(SwitchLabelsContext.class,0); - } - public BlockStatementsContext blockStatements() { - return getRuleContext(BlockStatementsContext.class,0); - } - public SwitchBlockStatementGroupContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switchBlockStatementGroup; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSwitchBlockStatementGroup(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSwitchBlockStatementGroup(this); - } - } - - public final SwitchBlockStatementGroupContext switchBlockStatementGroup() throws RecognitionException { - SwitchBlockStatementGroupContext _localctx = new SwitchBlockStatementGroupContext(_ctx, getState()); - enterRule(_localctx, 288, RULE_switchBlockStatementGroup); - try { - enterOuterAlt(_localctx, 1); - { - setState(1610); - switchLabels(); - setState(1611); - blockStatements(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SwitchLabelsContext extends ParserRuleContext { - public List switchLabel() { - return getRuleContexts(SwitchLabelContext.class); - } - public SwitchLabelContext switchLabel(int i) { - return getRuleContext(SwitchLabelContext.class,i); - } - public SwitchLabelsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switchLabels; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSwitchLabels(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSwitchLabels(this); - } - } - - public final SwitchLabelsContext switchLabels() throws RecognitionException { - SwitchLabelsContext _localctx = new SwitchLabelsContext(_ctx, getState()); - enterRule(_localctx, 290, RULE_switchLabels); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1613); - switchLabel(); - setState(1617); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==CASE || _la==DEFAULT) { - { - { - setState(1614); - switchLabel(); - } - } - setState(1619); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SwitchLabelContext extends ParserRuleContext { - public TerminalNode CASE() { return getToken(Java8Parser.CASE, 0); } - public ConstantExpressionContext constantExpression() { - return getRuleContext(ConstantExpressionContext.class,0); - } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public EnumConstantNameContext enumConstantName() { - return getRuleContext(EnumConstantNameContext.class,0); - } - public TerminalNode DEFAULT() { return getToken(Java8Parser.DEFAULT, 0); } - public SwitchLabelContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switchLabel; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSwitchLabel(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSwitchLabel(this); - } - } - - public final SwitchLabelContext switchLabel() throws RecognitionException { - SwitchLabelContext _localctx = new SwitchLabelContext(_ctx, getState()); - enterRule(_localctx, 292, RULE_switchLabel); - try { - setState(1630); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,163,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1620); - match(CASE); - setState(1621); - constantExpression(); - setState(1622); - match(COLON); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1624); - match(CASE); - setState(1625); - enumConstantName(); - setState(1626); - match(COLON); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1628); - match(DEFAULT); - setState(1629); - match(COLON); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnumConstantNameContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public EnumConstantNameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enumConstantName; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnumConstantName(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnumConstantName(this); - } - } - - public final EnumConstantNameContext enumConstantName() throws RecognitionException { - EnumConstantNameContext _localctx = new EnumConstantNameContext(_ctx, getState()); - enterRule(_localctx, 294, RULE_enumConstantName); - try { - enterOuterAlt(_localctx, 1); - { - setState(1632); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class WhileStatementContext extends ParserRuleContext { - public TerminalNode WHILE() { return getToken(Java8Parser.WHILE, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public WhileStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_whileStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterWhileStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitWhileStatement(this); - } - } - - public final WhileStatementContext whileStatement() throws RecognitionException { - WhileStatementContext _localctx = new WhileStatementContext(_ctx, getState()); - enterRule(_localctx, 296, RULE_whileStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1634); - match(WHILE); - setState(1635); - match(LPAREN); - setState(1636); - expression(); - setState(1637); - match(RPAREN); - setState(1638); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class WhileStatementNoShortIfContext extends ParserRuleContext { - public TerminalNode WHILE() { return getToken(Java8Parser.WHILE, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementNoShortIfContext statementNoShortIf() { - return getRuleContext(StatementNoShortIfContext.class,0); - } - public WhileStatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_whileStatementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterWhileStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitWhileStatementNoShortIf(this); - } - } - - public final WhileStatementNoShortIfContext whileStatementNoShortIf() throws RecognitionException { - WhileStatementNoShortIfContext _localctx = new WhileStatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 298, RULE_whileStatementNoShortIf); - try { - enterOuterAlt(_localctx, 1); - { - setState(1640); - match(WHILE); - setState(1641); - match(LPAREN); - setState(1642); - expression(); - setState(1643); - match(RPAREN); - setState(1644); - statementNoShortIf(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class DoStatementContext extends ParserRuleContext { - public TerminalNode DO() { return getToken(Java8Parser.DO, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public TerminalNode WHILE() { return getToken(Java8Parser.WHILE, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public DoStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_doStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterDoStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitDoStatement(this); - } - } - - public final DoStatementContext doStatement() throws RecognitionException { - DoStatementContext _localctx = new DoStatementContext(_ctx, getState()); - enterRule(_localctx, 300, RULE_doStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1646); - match(DO); - setState(1647); - statement(); - setState(1648); - match(WHILE); - setState(1649); - match(LPAREN); - setState(1650); - expression(); - setState(1651); - match(RPAREN); - setState(1652); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ForStatementContext extends ParserRuleContext { - public BasicForStatementContext basicForStatement() { - return getRuleContext(BasicForStatementContext.class,0); - } - public EnhancedForStatementContext enhancedForStatement() { - return getRuleContext(EnhancedForStatementContext.class,0); - } - public ForStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_forStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterForStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitForStatement(this); - } - } - - public final ForStatementContext forStatement() throws RecognitionException { - ForStatementContext _localctx = new ForStatementContext(_ctx, getState()); - enterRule(_localctx, 302, RULE_forStatement); - try { - setState(1656); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,164,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1654); - basicForStatement(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1655); - enhancedForStatement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ForStatementNoShortIfContext extends ParserRuleContext { - public BasicForStatementNoShortIfContext basicForStatementNoShortIf() { - return getRuleContext(BasicForStatementNoShortIfContext.class,0); - } - public EnhancedForStatementNoShortIfContext enhancedForStatementNoShortIf() { - return getRuleContext(EnhancedForStatementNoShortIfContext.class,0); - } - public ForStatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_forStatementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterForStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitForStatementNoShortIf(this); - } - } - - public final ForStatementNoShortIfContext forStatementNoShortIf() throws RecognitionException { - ForStatementNoShortIfContext _localctx = new ForStatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 304, RULE_forStatementNoShortIf); - try { - setState(1660); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,165,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1658); - basicForStatementNoShortIf(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1659); - enhancedForStatementNoShortIf(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class BasicForStatementContext extends ParserRuleContext { - public TerminalNode FOR() { return getToken(Java8Parser.FOR, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public List SEMI() { return getTokens(Java8Parser.SEMI); } - public TerminalNode SEMI(int i) { - return getToken(Java8Parser.SEMI, i); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public ForInitContext forInit() { - return getRuleContext(ForInitContext.class,0); - } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ForUpdateContext forUpdate() { - return getRuleContext(ForUpdateContext.class,0); - } - public BasicForStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_basicForStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterBasicForStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitBasicForStatement(this); - } - } - - public final BasicForStatementContext basicForStatement() throws RecognitionException { - BasicForStatementContext _localctx = new BasicForStatementContext(_ctx, getState()); - enterRule(_localctx, 306, RULE_basicForStatement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1662); - match(FOR); - setState(1663); - match(LPAREN); - setState(1665); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087178240296L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0)) { - { - setState(1664); - forInit(); - } - } - - setState(1667); - match(SEMI); - setState(1669); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1668); - expression(); - } - } - - setState(1671); - match(SEMI); - setState(1673); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0)) { - { - setState(1672); - forUpdate(); - } - } - - setState(1675); - match(RPAREN); - setState(1676); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class BasicForStatementNoShortIfContext extends ParserRuleContext { - public TerminalNode FOR() { return getToken(Java8Parser.FOR, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public List SEMI() { return getTokens(Java8Parser.SEMI); } - public TerminalNode SEMI(int i) { - return getToken(Java8Parser.SEMI, i); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementNoShortIfContext statementNoShortIf() { - return getRuleContext(StatementNoShortIfContext.class,0); - } - public ForInitContext forInit() { - return getRuleContext(ForInitContext.class,0); - } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ForUpdateContext forUpdate() { - return getRuleContext(ForUpdateContext.class,0); - } - public BasicForStatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_basicForStatementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterBasicForStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitBasicForStatementNoShortIf(this); - } - } - - public final BasicForStatementNoShortIfContext basicForStatementNoShortIf() throws RecognitionException { - BasicForStatementNoShortIfContext _localctx = new BasicForStatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 308, RULE_basicForStatementNoShortIf); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1678); - match(FOR); - setState(1679); - match(LPAREN); - setState(1681); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087178240296L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0)) { - { - setState(1680); - forInit(); - } - } - - setState(1683); - match(SEMI); - setState(1685); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1684); - expression(); - } - } - - setState(1687); - match(SEMI); - setState(1689); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 79)) & ~0x3f) == 0 && ((1L << (_la - 79)) & 25165827L) != 0)) { - { - setState(1688); - forUpdate(); - } - } - - setState(1691); - match(RPAREN); - setState(1692); - statementNoShortIf(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ForInitContext extends ParserRuleContext { - public StatementExpressionListContext statementExpressionList() { - return getRuleContext(StatementExpressionListContext.class,0); - } - public LocalVariableDeclarationContext localVariableDeclaration() { - return getRuleContext(LocalVariableDeclarationContext.class,0); - } - public ForInitContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_forInit; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterForInit(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitForInit(this); - } - } - - public final ForInitContext forInit() throws RecognitionException { - ForInitContext _localctx = new ForInitContext(_ctx, getState()); - enterRule(_localctx, 310, RULE_forInit); - try { - setState(1696); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,172,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1694); - statementExpressionList(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1695); - localVariableDeclaration(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ForUpdateContext extends ParserRuleContext { - public StatementExpressionListContext statementExpressionList() { - return getRuleContext(StatementExpressionListContext.class,0); - } - public ForUpdateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_forUpdate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterForUpdate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitForUpdate(this); - } - } - - public final ForUpdateContext forUpdate() throws RecognitionException { - ForUpdateContext _localctx = new ForUpdateContext(_ctx, getState()); - enterRule(_localctx, 312, RULE_forUpdate); - try { - enterOuterAlt(_localctx, 1); - { - setState(1698); - statementExpressionList(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class StatementExpressionListContext extends ParserRuleContext { - public List statementExpression() { - return getRuleContexts(StatementExpressionContext.class); - } - public StatementExpressionContext statementExpression(int i) { - return getRuleContext(StatementExpressionContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public StatementExpressionListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statementExpressionList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterStatementExpressionList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitStatementExpressionList(this); - } - } - - public final StatementExpressionListContext statementExpressionList() throws RecognitionException { - StatementExpressionListContext _localctx = new StatementExpressionListContext(_ctx, getState()); - enterRule(_localctx, 314, RULE_statementExpressionList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1700); - statementExpression(); - setState(1705); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1701); - match(COMMA); - setState(1702); - statementExpression(); - } - } - setState(1707); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnhancedForStatementContext extends ParserRuleContext { - public TerminalNode FOR() { return getToken(Java8Parser.FOR, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public EnhancedForStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enhancedForStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnhancedForStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnhancedForStatement(this); - } - } - - public final EnhancedForStatementContext enhancedForStatement() throws RecognitionException { - EnhancedForStatementContext _localctx = new EnhancedForStatementContext(_ctx, getState()); - enterRule(_localctx, 316, RULE_enhancedForStatement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1708); - match(FOR); - setState(1709); - match(LPAREN); - setState(1713); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1710); - variableModifier(); - } - } - setState(1715); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1716); - unannType(); - setState(1717); - variableDeclaratorId(); - setState(1718); - match(COLON); - setState(1719); - expression(); - setState(1720); - match(RPAREN); - setState(1721); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EnhancedForStatementNoShortIfContext extends ParserRuleContext { - public TerminalNode FOR() { return getToken(Java8Parser.FOR, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public StatementNoShortIfContext statementNoShortIf() { - return getRuleContext(StatementNoShortIfContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public EnhancedForStatementNoShortIfContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enhancedForStatementNoShortIf; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEnhancedForStatementNoShortIf(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEnhancedForStatementNoShortIf(this); - } - } - - public final EnhancedForStatementNoShortIfContext enhancedForStatementNoShortIf() throws RecognitionException { - EnhancedForStatementNoShortIfContext _localctx = new EnhancedForStatementNoShortIfContext(_ctx, getState()); - enterRule(_localctx, 318, RULE_enhancedForStatementNoShortIf); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1723); - match(FOR); - setState(1724); - match(LPAREN); - setState(1728); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1725); - variableModifier(); - } - } - setState(1730); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1731); - unannType(); - setState(1732); - variableDeclaratorId(); - setState(1733); - match(COLON); - setState(1734); - expression(); - setState(1735); - match(RPAREN); - setState(1736); - statementNoShortIf(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class BreakStatementContext extends ParserRuleContext { - public TerminalNode BREAK() { return getToken(Java8Parser.BREAK, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public BreakStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_breakStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterBreakStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitBreakStatement(this); - } - } - - public final BreakStatementContext breakStatement() throws RecognitionException { - BreakStatementContext _localctx = new BreakStatementContext(_ctx, getState()); - enterRule(_localctx, 320, RULE_breakStatement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1738); - match(BREAK); - setState(1740); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==Identifier) { - { - setState(1739); - match(Identifier); - } - } - - setState(1742); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ContinueStatementContext extends ParserRuleContext { - public TerminalNode CONTINUE() { return getToken(Java8Parser.CONTINUE, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public ContinueStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_continueStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterContinueStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitContinueStatement(this); - } - } - - public final ContinueStatementContext continueStatement() throws RecognitionException { - ContinueStatementContext _localctx = new ContinueStatementContext(_ctx, getState()); - enterRule(_localctx, 322, RULE_continueStatement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1744); - match(CONTINUE); - setState(1746); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==Identifier) { - { - setState(1745); - match(Identifier); - } - } - - setState(1748); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ReturnStatementContext extends ParserRuleContext { - public TerminalNode RETURN() { return getToken(Java8Parser.RETURN, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ReturnStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_returnStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterReturnStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitReturnStatement(this); - } - } - - public final ReturnStatementContext returnStatement() throws RecognitionException { - ReturnStatementContext _localctx = new ReturnStatementContext(_ctx, getState()); - enterRule(_localctx, 324, RULE_returnStatement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1750); - match(RETURN); - setState(1752); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(1751); - expression(); - } - } - - setState(1754); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ThrowStatementContext extends ParserRuleContext { - public TerminalNode THROW() { return getToken(Java8Parser.THROW, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public ThrowStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_throwStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterThrowStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitThrowStatement(this); - } - } - - public final ThrowStatementContext throwStatement() throws RecognitionException { - ThrowStatementContext _localctx = new ThrowStatementContext(_ctx, getState()); - enterRule(_localctx, 326, RULE_throwStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1756); - match(THROW); - setState(1757); - expression(); - setState(1758); - match(SEMI); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class SynchronizedStatementContext extends ParserRuleContext { - public TerminalNode SYNCHRONIZED() { return getToken(Java8Parser.SYNCHRONIZED, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public SynchronizedStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_synchronizedStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterSynchronizedStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitSynchronizedStatement(this); - } - } - - public final SynchronizedStatementContext synchronizedStatement() throws RecognitionException { - SynchronizedStatementContext _localctx = new SynchronizedStatementContext(_ctx, getState()); - enterRule(_localctx, 328, RULE_synchronizedStatement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1760); - match(SYNCHRONIZED); - setState(1761); - match(LPAREN); - setState(1762); - expression(); - setState(1763); - match(RPAREN); - setState(1764); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TryStatementContext extends ParserRuleContext { - public TerminalNode TRY() { return getToken(Java8Parser.TRY, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public CatchesContext catches() { - return getRuleContext(CatchesContext.class,0); - } - public Finally_Context finally_() { - return getRuleContext(Finally_Context.class,0); - } - public TryWithResourcesStatementContext tryWithResourcesStatement() { - return getRuleContext(TryWithResourcesStatementContext.class,0); - } - public TryStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_tryStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTryStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTryStatement(this); - } - } - - public final TryStatementContext tryStatement() throws RecognitionException { - TryStatementContext _localctx = new TryStatementContext(_ctx, getState()); - enterRule(_localctx, 330, RULE_tryStatement); - int _la; - try { - setState(1778); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,180,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1766); - match(TRY); - setState(1767); - block(); - setState(1768); - catches(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1770); - match(TRY); - setState(1771); - block(); - setState(1773); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==CATCH) { - { - setState(1772); - catches(); - } - } - - setState(1775); - finally_(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1777); - tryWithResourcesStatement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class CatchesContext extends ParserRuleContext { - public List catchClause() { - return getRuleContexts(CatchClauseContext.class); - } - public CatchClauseContext catchClause(int i) { - return getRuleContext(CatchClauseContext.class,i); - } - public CatchesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_catches; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterCatches(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitCatches(this); - } - } - - public final CatchesContext catches() throws RecognitionException { - CatchesContext _localctx = new CatchesContext(_ctx, getState()); - enterRule(_localctx, 332, RULE_catches); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1780); - catchClause(); - setState(1784); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==CATCH) { - { - { - setState(1781); - catchClause(); - } - } - setState(1786); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class CatchClauseContext extends ParserRuleContext { - public TerminalNode CATCH() { return getToken(Java8Parser.CATCH, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public CatchFormalParameterContext catchFormalParameter() { - return getRuleContext(CatchFormalParameterContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public CatchClauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_catchClause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterCatchClause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitCatchClause(this); - } - } - - public final CatchClauseContext catchClause() throws RecognitionException { - CatchClauseContext _localctx = new CatchClauseContext(_ctx, getState()); - enterRule(_localctx, 334, RULE_catchClause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1787); - match(CATCH); - setState(1788); - match(LPAREN); - setState(1789); - catchFormalParameter(); - setState(1790); - match(RPAREN); - setState(1791); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class CatchFormalParameterContext extends ParserRuleContext { - public CatchTypeContext catchType() { - return getRuleContext(CatchTypeContext.class,0); - } - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public CatchFormalParameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_catchFormalParameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterCatchFormalParameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitCatchFormalParameter(this); - } - } - - public final CatchFormalParameterContext catchFormalParameter() throws RecognitionException { - CatchFormalParameterContext _localctx = new CatchFormalParameterContext(_ctx, getState()); - enterRule(_localctx, 336, RULE_catchFormalParameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1796); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1793); - variableModifier(); - } - } - setState(1798); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1799); - catchType(); - setState(1800); - variableDeclaratorId(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class CatchTypeContext extends ParserRuleContext { - public UnannClassTypeContext unannClassType() { - return getRuleContext(UnannClassTypeContext.class,0); - } - public List BITOR() { return getTokens(Java8Parser.BITOR); } - public TerminalNode BITOR(int i) { - return getToken(Java8Parser.BITOR, i); - } - public List classType() { - return getRuleContexts(ClassTypeContext.class); - } - public ClassTypeContext classType(int i) { - return getRuleContext(ClassTypeContext.class,i); - } - public CatchTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_catchType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterCatchType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitCatchType(this); - } - } - - public final CatchTypeContext catchType() throws RecognitionException { - CatchTypeContext _localctx = new CatchTypeContext(_ctx, getState()); - enterRule(_localctx, 338, RULE_catchType); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1802); - unannClassType(); - setState(1807); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==BITOR) { - { - { - setState(1803); - match(BITOR); - setState(1804); - classType(); - } - } - setState(1809); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class Finally_Context extends ParserRuleContext { - public TerminalNode FINALLY() { return getToken(Java8Parser.FINALLY, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Finally_Context(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_finally_; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFinally_(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFinally_(this); - } - } - - public final Finally_Context finally_() throws RecognitionException { - Finally_Context _localctx = new Finally_Context(_ctx, getState()); - enterRule(_localctx, 340, RULE_finally_); - try { - enterOuterAlt(_localctx, 1); - { - setState(1810); - match(FINALLY); - setState(1811); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TryWithResourcesStatementContext extends ParserRuleContext { - public TerminalNode TRY() { return getToken(Java8Parser.TRY, 0); } - public ResourceSpecificationContext resourceSpecification() { - return getRuleContext(ResourceSpecificationContext.class,0); - } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public CatchesContext catches() { - return getRuleContext(CatchesContext.class,0); - } - public Finally_Context finally_() { - return getRuleContext(Finally_Context.class,0); - } - public TryWithResourcesStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_tryWithResourcesStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTryWithResourcesStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTryWithResourcesStatement(this); - } - } - - public final TryWithResourcesStatementContext tryWithResourcesStatement() throws RecognitionException { - TryWithResourcesStatementContext _localctx = new TryWithResourcesStatementContext(_ctx, getState()); - enterRule(_localctx, 342, RULE_tryWithResourcesStatement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1813); - match(TRY); - setState(1814); - resourceSpecification(); - setState(1815); - block(); - setState(1817); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==CATCH) { - { - setState(1816); - catches(); - } - } - - setState(1820); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==FINALLY) { - { - setState(1819); - finally_(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ResourceSpecificationContext extends ParserRuleContext { - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ResourceListContext resourceList() { - return getRuleContext(ResourceListContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TerminalNode SEMI() { return getToken(Java8Parser.SEMI, 0); } - public ResourceSpecificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_resourceSpecification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterResourceSpecification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitResourceSpecification(this); - } - } - - public final ResourceSpecificationContext resourceSpecification() throws RecognitionException { - ResourceSpecificationContext _localctx = new ResourceSpecificationContext(_ctx, getState()); - enterRule(_localctx, 344, RULE_resourceSpecification); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1822); - match(LPAREN); - setState(1823); - resourceList(); - setState(1825); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMI) { - { - setState(1824); - match(SEMI); - } - } - - setState(1827); - match(RPAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ResourceListContext extends ParserRuleContext { - public List resource() { - return getRuleContexts(ResourceContext.class); - } - public ResourceContext resource(int i) { - return getRuleContext(ResourceContext.class,i); - } - public List SEMI() { return getTokens(Java8Parser.SEMI); } - public TerminalNode SEMI(int i) { - return getToken(Java8Parser.SEMI, i); - } - public ResourceListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_resourceList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterResourceList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitResourceList(this); - } - } - - public final ResourceListContext resourceList() throws RecognitionException { - ResourceListContext _localctx = new ResourceListContext(_ctx, getState()); - enterRule(_localctx, 346, RULE_resourceList); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1829); - resource(); - setState(1834); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,187,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1830); - match(SEMI); - setState(1831); - resource(); - } - } - } - setState(1836); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,187,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ResourceContext extends ParserRuleContext { - public UnannTypeContext unannType() { - return getRuleContext(UnannTypeContext.class,0); - } - public VariableDeclaratorIdContext variableDeclaratorId() { - return getRuleContext(VariableDeclaratorIdContext.class,0); - } - public TerminalNode ASSIGN() { return getToken(Java8Parser.ASSIGN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public List variableModifier() { - return getRuleContexts(VariableModifierContext.class); - } - public VariableModifierContext variableModifier(int i) { - return getRuleContext(VariableModifierContext.class,i); - } - public ResourceContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_resource; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterResource(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitResource(this); - } - } - - public final ResourceContext resource() throws RecognitionException { - ResourceContext _localctx = new ResourceContext(_ctx, getState()); - enterRule(_localctx, 348, RULE_resource); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1840); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==FINAL || _la==AT) { - { - { - setState(1837); - variableModifier(); - } - } - setState(1842); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1843); - unannType(); - setState(1844); - variableDeclaratorId(); - setState(1845); - match(ASSIGN); - setState(1846); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryContext extends ParserRuleContext { - public PrimaryNoNewArray_lfno_primaryContext primaryNoNewArray_lfno_primary() { - return getRuleContext(PrimaryNoNewArray_lfno_primaryContext.class,0); - } - public ArrayCreationExpressionContext arrayCreationExpression() { - return getRuleContext(ArrayCreationExpressionContext.class,0); - } - public List primaryNoNewArray_lf_primary() { - return getRuleContexts(PrimaryNoNewArray_lf_primaryContext.class); - } - public PrimaryNoNewArray_lf_primaryContext primaryNoNewArray_lf_primary(int i) { - return getRuleContext(PrimaryNoNewArray_lf_primaryContext.class,i); - } - public PrimaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimary(this); - } - } - - public final PrimaryContext primary() throws RecognitionException { - PrimaryContext _localctx = new PrimaryContext(_ctx, getState()); - enterRule(_localctx, 350, RULE_primary); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1850); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,189,_ctx) ) { - case 1: - { - setState(1848); - primaryNoNewArray_lfno_primary(); - } - break; - case 2: - { - setState(1849); - arrayCreationExpression(); - } - break; - } - setState(1855); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,190,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1852); - primaryNoNewArray_lf_primary(); - } - } - } - setState(1857); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,190,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArrayContext extends ParserRuleContext { - public LiteralContext literal() { - return getRuleContext(LiteralContext.class,0); - } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode CLASS() { return getToken(Java8Parser.CLASS, 0); } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public TerminalNode VOID() { return getToken(Java8Parser.VOID, 0); } - public TerminalNode THIS() { return getToken(Java8Parser.THIS, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ClassInstanceCreationExpressionContext classInstanceCreationExpression() { - return getRuleContext(ClassInstanceCreationExpressionContext.class,0); - } - public FieldAccessContext fieldAccess() { - return getRuleContext(FieldAccessContext.class,0); - } - public ArrayAccessContext arrayAccess() { - return getRuleContext(ArrayAccessContext.class,0); - } - public MethodInvocationContext methodInvocation() { - return getRuleContext(MethodInvocationContext.class,0); - } - public MethodReferenceContext methodReference() { - return getRuleContext(MethodReferenceContext.class,0); - } - public PrimaryNoNewArrayContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray(this); - } - } - - public final PrimaryNoNewArrayContext primaryNoNewArray() throws RecognitionException { - PrimaryNoNewArrayContext _localctx = new PrimaryNoNewArrayContext(_ctx, getState()); - enterRule(_localctx, 352, RULE_primaryNoNewArray); - int _la; - try { - setState(1887); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,192,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1858); - literal(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1859); - typeName(); - setState(1864); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(1860); - match(LBRACK); - setState(1861); - match(RBRACK); - } - } - setState(1866); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1867); - match(DOT); - setState(1868); - match(CLASS); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1870); - match(VOID); - setState(1871); - match(DOT); - setState(1872); - match(CLASS); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1873); - match(THIS); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1874); - typeName(); - setState(1875); - match(DOT); - setState(1876); - match(THIS); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1878); - match(LPAREN); - setState(1879); - expression(); - setState(1880); - match(RPAREN); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(1882); - classInstanceCreationExpression(); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(1883); - fieldAccess(); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(1884); - arrayAccess(); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(1885); - methodInvocation(); - } - break; - case 11: - enterOuterAlt(_localctx, 11); - { - setState(1886); - methodReference(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lf_arrayAccessContext extends ParserRuleContext { - public PrimaryNoNewArray_lf_arrayAccessContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lf_arrayAccess; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lf_arrayAccess(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lf_arrayAccess(this); - } - } - - public final PrimaryNoNewArray_lf_arrayAccessContext primaryNoNewArray_lf_arrayAccess() throws RecognitionException { - PrimaryNoNewArray_lf_arrayAccessContext _localctx = new PrimaryNoNewArray_lf_arrayAccessContext(_ctx, getState()); - enterRule(_localctx, 354, RULE_primaryNoNewArray_lf_arrayAccess); - try { - enterOuterAlt(_localctx, 1); - { - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lfno_arrayAccessContext extends ParserRuleContext { - public LiteralContext literal() { - return getRuleContext(LiteralContext.class,0); - } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode CLASS() { return getToken(Java8Parser.CLASS, 0); } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public TerminalNode VOID() { return getToken(Java8Parser.VOID, 0); } - public TerminalNode THIS() { return getToken(Java8Parser.THIS, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ClassInstanceCreationExpressionContext classInstanceCreationExpression() { - return getRuleContext(ClassInstanceCreationExpressionContext.class,0); - } - public FieldAccessContext fieldAccess() { - return getRuleContext(FieldAccessContext.class,0); - } - public MethodInvocationContext methodInvocation() { - return getRuleContext(MethodInvocationContext.class,0); - } - public MethodReferenceContext methodReference() { - return getRuleContext(MethodReferenceContext.class,0); - } - public PrimaryNoNewArray_lfno_arrayAccessContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lfno_arrayAccess; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lfno_arrayAccess(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lfno_arrayAccess(this); - } - } - - public final PrimaryNoNewArray_lfno_arrayAccessContext primaryNoNewArray_lfno_arrayAccess() throws RecognitionException { - PrimaryNoNewArray_lfno_arrayAccessContext _localctx = new PrimaryNoNewArray_lfno_arrayAccessContext(_ctx, getState()); - enterRule(_localctx, 356, RULE_primaryNoNewArray_lfno_arrayAccess); - int _la; - try { - setState(1919); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,194,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1891); - literal(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1892); - typeName(); - setState(1897); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(1893); - match(LBRACK); - setState(1894); - match(RBRACK); - } - } - setState(1899); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1900); - match(DOT); - setState(1901); - match(CLASS); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1903); - match(VOID); - setState(1904); - match(DOT); - setState(1905); - match(CLASS); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1906); - match(THIS); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1907); - typeName(); - setState(1908); - match(DOT); - setState(1909); - match(THIS); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1911); - match(LPAREN); - setState(1912); - expression(); - setState(1913); - match(RPAREN); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(1915); - classInstanceCreationExpression(); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(1916); - fieldAccess(); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(1917); - methodInvocation(); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(1918); - methodReference(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lf_primaryContext extends ParserRuleContext { - public ClassInstanceCreationExpression_lf_primaryContext classInstanceCreationExpression_lf_primary() { - return getRuleContext(ClassInstanceCreationExpression_lf_primaryContext.class,0); - } - public FieldAccess_lf_primaryContext fieldAccess_lf_primary() { - return getRuleContext(FieldAccess_lf_primaryContext.class,0); - } - public ArrayAccess_lf_primaryContext arrayAccess_lf_primary() { - return getRuleContext(ArrayAccess_lf_primaryContext.class,0); - } - public MethodInvocation_lf_primaryContext methodInvocation_lf_primary() { - return getRuleContext(MethodInvocation_lf_primaryContext.class,0); - } - public MethodReference_lf_primaryContext methodReference_lf_primary() { - return getRuleContext(MethodReference_lf_primaryContext.class,0); - } - public PrimaryNoNewArray_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lf_primary(this); - } - } - - public final PrimaryNoNewArray_lf_primaryContext primaryNoNewArray_lf_primary() throws RecognitionException { - PrimaryNoNewArray_lf_primaryContext _localctx = new PrimaryNoNewArray_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 358, RULE_primaryNoNewArray_lf_primary); - try { - setState(1926); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,195,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1921); - classInstanceCreationExpression_lf_primary(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1922); - fieldAccess_lf_primary(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1923); - arrayAccess_lf_primary(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1924); - methodInvocation_lf_primary(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1925); - methodReference_lf_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext extends ParserRuleContext { - public PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(this); - } - } - - public final PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary() throws RecognitionException { - PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext _localctx = new PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 360, RULE_primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary); - try { - enterOuterAlt(_localctx, 1); - { - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext extends ParserRuleContext { - public ClassInstanceCreationExpression_lf_primaryContext classInstanceCreationExpression_lf_primary() { - return getRuleContext(ClassInstanceCreationExpression_lf_primaryContext.class,0); - } - public FieldAccess_lf_primaryContext fieldAccess_lf_primary() { - return getRuleContext(FieldAccess_lf_primaryContext.class,0); - } - public MethodInvocation_lf_primaryContext methodInvocation_lf_primary() { - return getRuleContext(MethodInvocation_lf_primaryContext.class,0); - } - public MethodReference_lf_primaryContext methodReference_lf_primary() { - return getRuleContext(MethodReference_lf_primaryContext.class,0); - } - public PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(this); - } - } - - public final PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary() throws RecognitionException { - PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext _localctx = new PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 362, RULE_primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary); - try { - setState(1934); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,196,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1930); - classInstanceCreationExpression_lf_primary(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1931); - fieldAccess_lf_primary(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1932); - methodInvocation_lf_primary(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1933); - methodReference_lf_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lfno_primaryContext extends ParserRuleContext { - public LiteralContext literal() { - return getRuleContext(LiteralContext.class,0); - } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode CLASS() { return getToken(Java8Parser.CLASS, 0); } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public UnannPrimitiveTypeContext unannPrimitiveType() { - return getRuleContext(UnannPrimitiveTypeContext.class,0); - } - public TerminalNode VOID() { return getToken(Java8Parser.VOID, 0); } - public TerminalNode THIS() { return getToken(Java8Parser.THIS, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ClassInstanceCreationExpression_lfno_primaryContext classInstanceCreationExpression_lfno_primary() { - return getRuleContext(ClassInstanceCreationExpression_lfno_primaryContext.class,0); - } - public FieldAccess_lfno_primaryContext fieldAccess_lfno_primary() { - return getRuleContext(FieldAccess_lfno_primaryContext.class,0); - } - public ArrayAccess_lfno_primaryContext arrayAccess_lfno_primary() { - return getRuleContext(ArrayAccess_lfno_primaryContext.class,0); - } - public MethodInvocation_lfno_primaryContext methodInvocation_lfno_primary() { - return getRuleContext(MethodInvocation_lfno_primaryContext.class,0); - } - public MethodReference_lfno_primaryContext methodReference_lfno_primary() { - return getRuleContext(MethodReference_lfno_primaryContext.class,0); - } - public PrimaryNoNewArray_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lfno_primary(this); - } - } - - public final PrimaryNoNewArray_lfno_primaryContext primaryNoNewArray_lfno_primary() throws RecognitionException { - PrimaryNoNewArray_lfno_primaryContext _localctx = new PrimaryNoNewArray_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 364, RULE_primaryNoNewArray_lfno_primary); - int _la; - try { - setState(1976); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,199,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1936); - literal(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1937); - typeName(); - setState(1942); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(1938); - match(LBRACK); - setState(1939); - match(RBRACK); - } - } - setState(1944); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1945); - match(DOT); - setState(1946); - match(CLASS); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1948); - unannPrimitiveType(); - setState(1953); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(1949); - match(LBRACK); - setState(1950); - match(RBRACK); - } - } - setState(1955); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1956); - match(DOT); - setState(1957); - match(CLASS); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1959); - match(VOID); - setState(1960); - match(DOT); - setState(1961); - match(CLASS); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1962); - match(THIS); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1963); - typeName(); - setState(1964); - match(DOT); - setState(1965); - match(THIS); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(1967); - match(LPAREN); - setState(1968); - expression(); - setState(1969); - match(RPAREN); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(1971); - classInstanceCreationExpression_lfno_primary(); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(1972); - fieldAccess_lfno_primary(); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(1973); - arrayAccess_lfno_primary(); - } - break; - case 11: - enterOuterAlt(_localctx, 11); - { - setState(1974); - methodInvocation_lfno_primary(); - } - break; - case 12: - enterOuterAlt(_localctx, 12); - { - setState(1975); - methodReference_lfno_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext extends ParserRuleContext { - public PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(this); - } - } - - public final PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary() throws RecognitionException { - PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext _localctx = new PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 366, RULE_primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary); - try { - enterOuterAlt(_localctx, 1); - { - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext extends ParserRuleContext { - public LiteralContext literal() { - return getRuleContext(LiteralContext.class,0); - } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode CLASS() { return getToken(Java8Parser.CLASS, 0); } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public UnannPrimitiveTypeContext unannPrimitiveType() { - return getRuleContext(UnannPrimitiveTypeContext.class,0); - } - public TerminalNode VOID() { return getToken(Java8Parser.VOID, 0); } - public TerminalNode THIS() { return getToken(Java8Parser.THIS, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ClassInstanceCreationExpression_lfno_primaryContext classInstanceCreationExpression_lfno_primary() { - return getRuleContext(ClassInstanceCreationExpression_lfno_primaryContext.class,0); - } - public FieldAccess_lfno_primaryContext fieldAccess_lfno_primary() { - return getRuleContext(FieldAccess_lfno_primaryContext.class,0); - } - public MethodInvocation_lfno_primaryContext methodInvocation_lfno_primary() { - return getRuleContext(MethodInvocation_lfno_primaryContext.class,0); - } - public MethodReference_lfno_primaryContext methodReference_lfno_primary() { - return getRuleContext(MethodReference_lfno_primaryContext.class,0); - } - public PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(this); - } - } - - public final PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary() throws RecognitionException { - PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext _localctx = new PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 368, RULE_primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary); - int _la; - try { - setState(2019); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,202,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1980); - literal(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1981); - typeName(); - setState(1986); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(1982); - match(LBRACK); - setState(1983); - match(RBRACK); - } - } - setState(1988); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1989); - match(DOT); - setState(1990); - match(CLASS); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1992); - unannPrimitiveType(); - setState(1997); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(1993); - match(LBRACK); - setState(1994); - match(RBRACK); - } - } - setState(1999); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2000); - match(DOT); - setState(2001); - match(CLASS); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2003); - match(VOID); - setState(2004); - match(DOT); - setState(2005); - match(CLASS); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(2006); - match(THIS); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(2007); - typeName(); - setState(2008); - match(DOT); - setState(2009); - match(THIS); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(2011); - match(LPAREN); - setState(2012); - expression(); - setState(2013); - match(RPAREN); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(2015); - classInstanceCreationExpression_lfno_primary(); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(2016); - fieldAccess_lfno_primary(); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(2017); - methodInvocation_lfno_primary(); - } - break; - case 11: - enterOuterAlt(_localctx, 11); - { - setState(2018); - methodReference_lfno_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassInstanceCreationExpressionContext extends ParserRuleContext { - public TerminalNode NEW() { return getToken(Java8Parser.NEW, 0); } - public List Identifier() { return getTokens(Java8Parser.Identifier); } - public TerminalNode Identifier(int i) { - return getToken(Java8Parser.Identifier, i); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public List DOT() { return getTokens(Java8Parser.DOT); } - public TerminalNode DOT(int i) { - return getToken(Java8Parser.DOT, i); - } - public TypeArgumentsOrDiamondContext typeArgumentsOrDiamond() { - return getRuleContext(TypeArgumentsOrDiamondContext.class,0); - } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public ClassBodyContext classBody() { - return getRuleContext(ClassBodyContext.class,0); - } - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public PrimaryContext primary() { - return getRuleContext(PrimaryContext.class,0); - } - public ClassInstanceCreationExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classInstanceCreationExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassInstanceCreationExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassInstanceCreationExpression(this); - } - } - - public final ClassInstanceCreationExpressionContext classInstanceCreationExpression() throws RecognitionException { - ClassInstanceCreationExpressionContext _localctx = new ClassInstanceCreationExpressionContext(_ctx, getState()); - enterRule(_localctx, 370, RULE_classInstanceCreationExpression); - int _la; - try { - setState(2104); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,220,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2021); - match(NEW); - setState(2023); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2022); - typeArguments(); - } - } - - setState(2028); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2025); - annotation(); - } - } - setState(2030); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2031); - match(Identifier); - setState(2042); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==DOT) { - { - { - setState(2032); - match(DOT); - setState(2036); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2033); - annotation(); - } - } - setState(2038); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2039); - match(Identifier); - } - } - setState(2044); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2046); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2045); - typeArgumentsOrDiamond(); - } - } - - setState(2048); - match(LPAREN); - setState(2050); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2049); - argumentList(); - } - } - - setState(2052); - match(RPAREN); - setState(2054); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACE) { - { - setState(2053); - classBody(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2056); - expressionName(); - setState(2057); - match(DOT); - setState(2058); - match(NEW); - setState(2060); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2059); - typeArguments(); - } - } - - setState(2065); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2062); - annotation(); - } - } - setState(2067); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2068); - match(Identifier); - setState(2070); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2069); - typeArgumentsOrDiamond(); - } - } - - setState(2072); - match(LPAREN); - setState(2074); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2073); - argumentList(); - } - } - - setState(2076); - match(RPAREN); - setState(2078); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACE) { - { - setState(2077); - classBody(); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2080); - primary(); - setState(2081); - match(DOT); - setState(2082); - match(NEW); - setState(2084); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2083); - typeArguments(); - } - } - - setState(2089); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2086); - annotation(); - } - } - setState(2091); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2092); - match(Identifier); - setState(2094); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2093); - typeArgumentsOrDiamond(); - } - } - - setState(2096); - match(LPAREN); - setState(2098); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2097); - argumentList(); - } - } - - setState(2100); - match(RPAREN); - setState(2102); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LBRACE) { - { - setState(2101); - classBody(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassInstanceCreationExpression_lf_primaryContext extends ParserRuleContext { - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode NEW() { return getToken(Java8Parser.NEW, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public TypeArgumentsOrDiamondContext typeArgumentsOrDiamond() { - return getRuleContext(TypeArgumentsOrDiamondContext.class,0); - } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public ClassBodyContext classBody() { - return getRuleContext(ClassBodyContext.class,0); - } - public ClassInstanceCreationExpression_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classInstanceCreationExpression_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassInstanceCreationExpression_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassInstanceCreationExpression_lf_primary(this); - } - } - - public final ClassInstanceCreationExpression_lf_primaryContext classInstanceCreationExpression_lf_primary() throws RecognitionException { - ClassInstanceCreationExpression_lf_primaryContext _localctx = new ClassInstanceCreationExpression_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 372, RULE_classInstanceCreationExpression_lf_primary); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2106); - match(DOT); - setState(2107); - match(NEW); - setState(2109); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2108); - typeArguments(); - } - } - - setState(2114); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2111); - annotation(); - } - } - setState(2116); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2117); - match(Identifier); - setState(2119); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2118); - typeArgumentsOrDiamond(); - } - } - - setState(2121); - match(LPAREN); - setState(2123); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2122); - argumentList(); - } - } - - setState(2125); - match(RPAREN); - setState(2127); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,225,_ctx) ) { - case 1: - { - setState(2126); - classBody(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ClassInstanceCreationExpression_lfno_primaryContext extends ParserRuleContext { - public TerminalNode NEW() { return getToken(Java8Parser.NEW, 0); } - public List Identifier() { return getTokens(Java8Parser.Identifier); } - public TerminalNode Identifier(int i) { - return getToken(Java8Parser.Identifier, i); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public List DOT() { return getTokens(Java8Parser.DOT); } - public TerminalNode DOT(int i) { - return getToken(Java8Parser.DOT, i); - } - public TypeArgumentsOrDiamondContext typeArgumentsOrDiamond() { - return getRuleContext(TypeArgumentsOrDiamondContext.class,0); - } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public ClassBodyContext classBody() { - return getRuleContext(ClassBodyContext.class,0); - } - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public ClassInstanceCreationExpression_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_classInstanceCreationExpression_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterClassInstanceCreationExpression_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitClassInstanceCreationExpression_lfno_primary(this); - } - } - - public final ClassInstanceCreationExpression_lfno_primaryContext classInstanceCreationExpression_lfno_primary() throws RecognitionException { - ClassInstanceCreationExpression_lfno_primaryContext _localctx = new ClassInstanceCreationExpression_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 374, RULE_classInstanceCreationExpression_lfno_primary); - int _la; - try { - setState(2188); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NEW: - enterOuterAlt(_localctx, 1); - { - setState(2129); - match(NEW); - setState(2131); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2130); - typeArguments(); - } - } - - setState(2136); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2133); - annotation(); - } - } - setState(2138); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2139); - match(Identifier); - setState(2150); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==DOT) { - { - { - setState(2140); - match(DOT); - setState(2144); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2141); - annotation(); - } - } - setState(2146); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2147); - match(Identifier); - } - } - setState(2152); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2154); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2153); - typeArgumentsOrDiamond(); - } - } - - setState(2156); - match(LPAREN); - setState(2158); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2157); - argumentList(); - } - } - - setState(2160); - match(RPAREN); - setState(2162); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,232,_ctx) ) { - case 1: - { - setState(2161); - classBody(); - } - break; - } - } - break; - case Identifier: - enterOuterAlt(_localctx, 2); - { - setState(2164); - expressionName(); - setState(2165); - match(DOT); - setState(2166); - match(NEW); - setState(2168); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2167); - typeArguments(); - } - } - - setState(2173); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2170); - annotation(); - } - } - setState(2175); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2176); - match(Identifier); - setState(2178); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2177); - typeArgumentsOrDiamond(); - } - } - - setState(2180); - match(LPAREN); - setState(2182); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2181); - argumentList(); - } - } - - setState(2184); - match(RPAREN); - setState(2186); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,237,_ctx) ) { - case 1: - { - setState(2185); - classBody(); - } - break; - } - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeArgumentsOrDiamondContext extends ParserRuleContext { - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public TerminalNode LT() { return getToken(Java8Parser.LT, 0); } - public TerminalNode GT() { return getToken(Java8Parser.GT, 0); } - public TypeArgumentsOrDiamondContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeArgumentsOrDiamond; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterTypeArgumentsOrDiamond(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitTypeArgumentsOrDiamond(this); - } - } - - public final TypeArgumentsOrDiamondContext typeArgumentsOrDiamond() throws RecognitionException { - TypeArgumentsOrDiamondContext _localctx = new TypeArgumentsOrDiamondContext(_ctx, getState()); - enterRule(_localctx, 376, RULE_typeArgumentsOrDiamond); - try { - setState(2193); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,239,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2190); - typeArguments(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2191); - match(LT); - setState(2192); - match(GT); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FieldAccessContext extends ParserRuleContext { - public PrimaryContext primary() { - return getRuleContext(PrimaryContext.class,0); - } - public List DOT() { return getTokens(Java8Parser.DOT); } - public TerminalNode DOT(int i) { - return getToken(Java8Parser.DOT, i); - } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public FieldAccessContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fieldAccess; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFieldAccess(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFieldAccess(this); - } - } - - public final FieldAccessContext fieldAccess() throws RecognitionException { - FieldAccessContext _localctx = new FieldAccessContext(_ctx, getState()); - enterRule(_localctx, 378, RULE_fieldAccess); - try { - setState(2208); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,240,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2195); - primary(); - setState(2196); - match(DOT); - setState(2197); - match(Identifier); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2199); - match(SUPER); - setState(2200); - match(DOT); - setState(2201); - match(Identifier); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2202); - typeName(); - setState(2203); - match(DOT); - setState(2204); - match(SUPER); - setState(2205); - match(DOT); - setState(2206); - match(Identifier); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FieldAccess_lf_primaryContext extends ParserRuleContext { - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public FieldAccess_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fieldAccess_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFieldAccess_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFieldAccess_lf_primary(this); - } - } - - public final FieldAccess_lf_primaryContext fieldAccess_lf_primary() throws RecognitionException { - FieldAccess_lf_primaryContext _localctx = new FieldAccess_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 380, RULE_fieldAccess_lf_primary); - try { - enterOuterAlt(_localctx, 1); - { - setState(2210); - match(DOT); - setState(2211); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FieldAccess_lfno_primaryContext extends ParserRuleContext { - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public List DOT() { return getTokens(Java8Parser.DOT); } - public TerminalNode DOT(int i) { - return getToken(Java8Parser.DOT, i); - } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public FieldAccess_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fieldAccess_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterFieldAccess_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitFieldAccess_lfno_primary(this); - } - } - - public final FieldAccess_lfno_primaryContext fieldAccess_lfno_primary() throws RecognitionException { - FieldAccess_lfno_primaryContext _localctx = new FieldAccess_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 382, RULE_fieldAccess_lfno_primary); - try { - setState(2222); - _errHandler.sync(this); - switch (_input.LA(1)) { - case SUPER: - enterOuterAlt(_localctx, 1); - { - setState(2213); - match(SUPER); - setState(2214); - match(DOT); - setState(2215); - match(Identifier); - } - break; - case Identifier: - enterOuterAlt(_localctx, 2); - { - setState(2216); - typeName(); - setState(2217); - match(DOT); - setState(2218); - match(SUPER); - setState(2219); - match(DOT); - setState(2220); - match(Identifier); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayAccessContext extends ParserRuleContext { - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public PrimaryNoNewArray_lfno_arrayAccessContext primaryNoNewArray_lfno_arrayAccess() { - return getRuleContext(PrimaryNoNewArray_lfno_arrayAccessContext.class,0); - } - public List primaryNoNewArray_lf_arrayAccess() { - return getRuleContexts(PrimaryNoNewArray_lf_arrayAccessContext.class); - } - public PrimaryNoNewArray_lf_arrayAccessContext primaryNoNewArray_lf_arrayAccess(int i) { - return getRuleContext(PrimaryNoNewArray_lf_arrayAccessContext.class,i); - } - public ArrayAccessContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arrayAccess; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArrayAccess(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArrayAccess(this); - } - } - - public final ArrayAccessContext arrayAccess() throws RecognitionException { - ArrayAccessContext _localctx = new ArrayAccessContext(_ctx, getState()); - enterRule(_localctx, 384, RULE_arrayAccess); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2234); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,242,_ctx) ) { - case 1: - { - setState(2224); - expressionName(); - setState(2225); - match(LBRACK); - setState(2226); - expression(); - setState(2227); - match(RBRACK); - } - break; - case 2: - { - setState(2229); - primaryNoNewArray_lfno_arrayAccess(); - setState(2230); - match(LBRACK); - setState(2231); - expression(); - setState(2232); - match(RBRACK); - } - break; - } - setState(2243); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==LBRACK) { - { - { - setState(2236); - primaryNoNewArray_lf_arrayAccess(); - setState(2237); - match(LBRACK); - setState(2238); - expression(); - setState(2239); - match(RBRACK); - } - } - setState(2245); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayAccess_lf_primaryContext extends ParserRuleContext { - public PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary() { - return getRuleContext(PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext.class,0); - } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public List primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary() { - return getRuleContexts(PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext.class); - } - public PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(int i) { - return getRuleContext(PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext.class,i); - } - public ArrayAccess_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arrayAccess_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArrayAccess_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArrayAccess_lf_primary(this); - } - } - - public final ArrayAccess_lf_primaryContext arrayAccess_lf_primary() throws RecognitionException { - ArrayAccess_lf_primaryContext _localctx = new ArrayAccess_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 386, RULE_arrayAccess_lf_primary); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2246); - primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(); - setState(2247); - match(LBRACK); - setState(2248); - expression(); - setState(2249); - match(RBRACK); - setState(2257); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,244,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2250); - primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(); - setState(2251); - match(LBRACK); - setState(2252); - expression(); - setState(2253); - match(RBRACK); - } - } - } - setState(2259); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,244,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayAccess_lfno_primaryContext extends ParserRuleContext { - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public List LBRACK() { return getTokens(Java8Parser.LBRACK); } - public TerminalNode LBRACK(int i) { - return getToken(Java8Parser.LBRACK, i); - } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List RBRACK() { return getTokens(Java8Parser.RBRACK); } - public TerminalNode RBRACK(int i) { - return getToken(Java8Parser.RBRACK, i); - } - public PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary() { - return getRuleContext(PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext.class,0); - } - public List primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary() { - return getRuleContexts(PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext.class); - } - public PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(int i) { - return getRuleContext(PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext.class,i); - } - public ArrayAccess_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arrayAccess_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArrayAccess_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArrayAccess_lfno_primary(this); - } - } - - public final ArrayAccess_lfno_primaryContext arrayAccess_lfno_primary() throws RecognitionException { - ArrayAccess_lfno_primaryContext _localctx = new ArrayAccess_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 388, RULE_arrayAccess_lfno_primary); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2270); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,245,_ctx) ) { - case 1: - { - setState(2260); - expressionName(); - setState(2261); - match(LBRACK); - setState(2262); - expression(); - setState(2263); - match(RBRACK); - } - break; - case 2: - { - setState(2265); - primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(); - setState(2266); - match(LBRACK); - setState(2267); - expression(); - setState(2268); - match(RBRACK); - } - break; - } - setState(2279); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,246,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2272); - primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(); - setState(2273); - match(LBRACK); - setState(2274); - expression(); - setState(2275); - match(RBRACK); - } - } - } - setState(2281); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,246,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodInvocationContext extends ParserRuleContext { - public MethodNameContext methodName() { - return getRuleContext(MethodNameContext.class,0); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public List DOT() { return getTokens(Java8Parser.DOT); } - public TerminalNode DOT(int i) { - return getToken(Java8Parser.DOT, i); - } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public PrimaryContext primary() { - return getRuleContext(PrimaryContext.class,0); - } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public MethodInvocationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodInvocation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodInvocation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodInvocation(this); - } - } - - public final MethodInvocationContext methodInvocation() throws RecognitionException { - MethodInvocationContext _localctx = new MethodInvocationContext(_ctx, getState()); - enterRule(_localctx, 390, RULE_methodInvocation); - int _la; - try { - setState(2350); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,258,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2282); - methodName(); - setState(2283); - match(LPAREN); - setState(2285); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2284); - argumentList(); - } - } - - setState(2287); - match(RPAREN); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2289); - typeName(); - setState(2290); - match(DOT); - setState(2292); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2291); - typeArguments(); - } - } - - setState(2294); - match(Identifier); - setState(2295); - match(LPAREN); - setState(2297); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2296); - argumentList(); - } - } - - setState(2299); - match(RPAREN); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2301); - expressionName(); - setState(2302); - match(DOT); - setState(2304); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2303); - typeArguments(); - } - } - - setState(2306); - match(Identifier); - setState(2307); - match(LPAREN); - setState(2309); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2308); - argumentList(); - } - } - - setState(2311); - match(RPAREN); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2313); - primary(); - setState(2314); - match(DOT); - setState(2316); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2315); - typeArguments(); - } - } - - setState(2318); - match(Identifier); - setState(2319); - match(LPAREN); - setState(2321); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2320); - argumentList(); - } - } - - setState(2323); - match(RPAREN); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(2325); - match(SUPER); - setState(2326); - match(DOT); - setState(2328); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2327); - typeArguments(); - } - } - - setState(2330); - match(Identifier); - setState(2331); - match(LPAREN); - setState(2333); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2332); - argumentList(); - } - } - - setState(2335); - match(RPAREN); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(2336); - typeName(); - setState(2337); - match(DOT); - setState(2338); - match(SUPER); - setState(2339); - match(DOT); - setState(2341); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2340); - typeArguments(); - } - } - - setState(2343); - match(Identifier); - setState(2344); - match(LPAREN); - setState(2346); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2345); - argumentList(); - } - } - - setState(2348); - match(RPAREN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodInvocation_lf_primaryContext extends ParserRuleContext { - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public MethodInvocation_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodInvocation_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodInvocation_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodInvocation_lf_primary(this); - } - } - - public final MethodInvocation_lf_primaryContext methodInvocation_lf_primary() throws RecognitionException { - MethodInvocation_lf_primaryContext _localctx = new MethodInvocation_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 392, RULE_methodInvocation_lf_primary); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2352); - match(DOT); - setState(2354); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2353); - typeArguments(); - } - } - - setState(2356); - match(Identifier); - setState(2357); - match(LPAREN); - setState(2359); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2358); - argumentList(); - } - } - - setState(2361); - match(RPAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodInvocation_lfno_primaryContext extends ParserRuleContext { - public MethodNameContext methodName() { - return getRuleContext(MethodNameContext.class,0); - } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public ArgumentListContext argumentList() { - return getRuleContext(ArgumentListContext.class,0); - } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public List DOT() { return getTokens(Java8Parser.DOT); } - public TerminalNode DOT(int i) { - return getToken(Java8Parser.DOT, i); - } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public MethodInvocation_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodInvocation_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodInvocation_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodInvocation_lfno_primary(this); - } - } - - public final MethodInvocation_lfno_primaryContext methodInvocation_lfno_primary() throws RecognitionException { - MethodInvocation_lfno_primaryContext _localctx = new MethodInvocation_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 394, RULE_methodInvocation_lfno_primary); - int _la; - try { - setState(2419); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,270,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2363); - methodName(); - setState(2364); - match(LPAREN); - setState(2366); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2365); - argumentList(); - } - } - - setState(2368); - match(RPAREN); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2370); - typeName(); - setState(2371); - match(DOT); - setState(2373); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2372); - typeArguments(); - } - } - - setState(2375); - match(Identifier); - setState(2376); - match(LPAREN); - setState(2378); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2377); - argumentList(); - } - } - - setState(2380); - match(RPAREN); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2382); - expressionName(); - setState(2383); - match(DOT); - setState(2385); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2384); - typeArguments(); - } - } - - setState(2387); - match(Identifier); - setState(2388); - match(LPAREN); - setState(2390); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2389); - argumentList(); - } - } - - setState(2392); - match(RPAREN); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2394); - match(SUPER); - setState(2395); - match(DOT); - setState(2397); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2396); - typeArguments(); - } - } - - setState(2399); - match(Identifier); - setState(2400); - match(LPAREN); - setState(2402); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2401); - argumentList(); - } - } - - setState(2404); - match(RPAREN); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(2405); - typeName(); - setState(2406); - match(DOT); - setState(2407); - match(SUPER); - setState(2408); - match(DOT); - setState(2410); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2409); - typeArguments(); - } - } - - setState(2412); - match(Identifier); - setState(2413); - match(LPAREN); - setState(2415); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 286270087177978152L) != 0) || ((((_la - 69)) & ~0x3f) == 0 && ((1L << (_la - 69)) & 25769819139L) != 0)) { - { - setState(2414); - argumentList(); - } - } - - setState(2417); - match(RPAREN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArgumentListContext extends ParserRuleContext { - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public ArgumentListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_argumentList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArgumentList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArgumentList(this); - } - } - - public final ArgumentListContext argumentList() throws RecognitionException { - ArgumentListContext _localctx = new ArgumentListContext(_ctx, getState()); - enterRule(_localctx, 396, RULE_argumentList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2421); - expression(); - setState(2426); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2422); - match(COMMA); - setState(2423); - expression(); - } - } - setState(2428); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodReferenceContext extends ParserRuleContext { - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public TerminalNode COLONCOLON() { return getToken(Java8Parser.COLONCOLON, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ReferenceTypeContext referenceType() { - return getRuleContext(ReferenceTypeContext.class,0); - } - public PrimaryContext primary() { - return getRuleContext(PrimaryContext.class,0); - } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public ClassTypeContext classType() { - return getRuleContext(ClassTypeContext.class,0); - } - public TerminalNode NEW() { return getToken(Java8Parser.NEW, 0); } - public ArrayTypeContext arrayType() { - return getRuleContext(ArrayTypeContext.class,0); - } - public MethodReferenceContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodReference; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodReference(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodReference(this); - } - } - - public final MethodReferenceContext methodReference() throws RecognitionException { - MethodReferenceContext _localctx = new MethodReferenceContext(_ctx, getState()); - enterRule(_localctx, 398, RULE_methodReference); - int _la; - try { - setState(2476); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,278,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2429); - expressionName(); - setState(2430); - match(COLONCOLON); - setState(2432); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2431); - typeArguments(); - } - } - - setState(2434); - match(Identifier); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2436); - referenceType(); - setState(2437); - match(COLONCOLON); - setState(2439); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2438); - typeArguments(); - } - } - - setState(2441); - match(Identifier); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2443); - primary(); - setState(2444); - match(COLONCOLON); - setState(2446); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2445); - typeArguments(); - } - } - - setState(2448); - match(Identifier); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2450); - match(SUPER); - setState(2451); - match(COLONCOLON); - setState(2453); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2452); - typeArguments(); - } - } - - setState(2455); - match(Identifier); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(2456); - typeName(); - setState(2457); - match(DOT); - setState(2458); - match(SUPER); - setState(2459); - match(COLONCOLON); - setState(2461); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2460); - typeArguments(); - } - } - - setState(2463); - match(Identifier); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(2465); - classType(); - setState(2466); - match(COLONCOLON); - setState(2468); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2467); - typeArguments(); - } - } - - setState(2470); - match(NEW); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(2472); - arrayType(); - setState(2473); - match(COLONCOLON); - setState(2474); - match(NEW); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodReference_lf_primaryContext extends ParserRuleContext { - public TerminalNode COLONCOLON() { return getToken(Java8Parser.COLONCOLON, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public MethodReference_lf_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodReference_lf_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodReference_lf_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodReference_lf_primary(this); - } - } - - public final MethodReference_lf_primaryContext methodReference_lf_primary() throws RecognitionException { - MethodReference_lf_primaryContext _localctx = new MethodReference_lf_primaryContext(_ctx, getState()); - enterRule(_localctx, 400, RULE_methodReference_lf_primary); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2478); - match(COLONCOLON); - setState(2480); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2479); - typeArguments(); - } - } - - setState(2482); - match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MethodReference_lfno_primaryContext extends ParserRuleContext { - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public TerminalNode COLONCOLON() { return getToken(Java8Parser.COLONCOLON, 0); } - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TypeArgumentsContext typeArguments() { - return getRuleContext(TypeArgumentsContext.class,0); - } - public ReferenceTypeContext referenceType() { - return getRuleContext(ReferenceTypeContext.class,0); - } - public TerminalNode SUPER() { return getToken(Java8Parser.SUPER, 0); } - public TypeNameContext typeName() { - return getRuleContext(TypeNameContext.class,0); - } - public TerminalNode DOT() { return getToken(Java8Parser.DOT, 0); } - public ClassTypeContext classType() { - return getRuleContext(ClassTypeContext.class,0); - } - public TerminalNode NEW() { return getToken(Java8Parser.NEW, 0); } - public ArrayTypeContext arrayType() { - return getRuleContext(ArrayTypeContext.class,0); - } - public MethodReference_lfno_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_methodReference_lfno_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMethodReference_lfno_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMethodReference_lfno_primary(this); - } - } - - public final MethodReference_lfno_primaryContext methodReference_lfno_primary() throws RecognitionException { - MethodReference_lfno_primaryContext _localctx = new MethodReference_lfno_primaryContext(_ctx, getState()); - enterRule(_localctx, 402, RULE_methodReference_lfno_primary); - int _la; - try { - setState(2524); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,285,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2484); - expressionName(); - setState(2485); - match(COLONCOLON); - setState(2487); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2486); - typeArguments(); - } - } - - setState(2489); - match(Identifier); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2491); - referenceType(); - setState(2492); - match(COLONCOLON); - setState(2494); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2493); - typeArguments(); - } - } - - setState(2496); - match(Identifier); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2498); - match(SUPER); - setState(2499); - match(COLONCOLON); - setState(2501); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2500); - typeArguments(); - } - } - - setState(2503); - match(Identifier); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2504); - typeName(); - setState(2505); - match(DOT); - setState(2506); - match(SUPER); - setState(2507); - match(COLONCOLON); - setState(2509); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2508); - typeArguments(); - } - } - - setState(2511); - match(Identifier); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(2513); - classType(); - setState(2514); - match(COLONCOLON); - setState(2516); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2515); - typeArguments(); - } - } - - setState(2518); - match(NEW); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(2520); - arrayType(); - setState(2521); - match(COLONCOLON); - setState(2522); - match(NEW); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayCreationExpressionContext extends ParserRuleContext { - public TerminalNode NEW() { return getToken(Java8Parser.NEW, 0); } - public PrimitiveTypeContext primitiveType() { - return getRuleContext(PrimitiveTypeContext.class,0); - } - public DimExprsContext dimExprs() { - return getRuleContext(DimExprsContext.class,0); - } - public DimsContext dims() { - return getRuleContext(DimsContext.class,0); - } - public ClassOrInterfaceTypeContext classOrInterfaceType() { - return getRuleContext(ClassOrInterfaceTypeContext.class,0); - } - public ArrayInitializerContext arrayInitializer() { - return getRuleContext(ArrayInitializerContext.class,0); - } - public ArrayCreationExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arrayCreationExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterArrayCreationExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitArrayCreationExpression(this); - } - } - - public final ArrayCreationExpressionContext arrayCreationExpression() throws RecognitionException { - ArrayCreationExpressionContext _localctx = new ArrayCreationExpressionContext(_ctx, getState()); - enterRule(_localctx, 404, RULE_arrayCreationExpression); - try { - setState(2548); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,288,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2526); - match(NEW); - setState(2527); - primitiveType(); - setState(2528); - dimExprs(); - setState(2530); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,286,_ctx) ) { - case 1: - { - setState(2529); - dims(); - } - break; - } - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2532); - match(NEW); - setState(2533); - classOrInterfaceType(); - setState(2534); - dimExprs(); - setState(2536); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,287,_ctx) ) { - case 1: - { - setState(2535); - dims(); - } - break; - } - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2538); - match(NEW); - setState(2539); - primitiveType(); - setState(2540); - dims(); - setState(2541); - arrayInitializer(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2543); - match(NEW); - setState(2544); - classOrInterfaceType(); - setState(2545); - dims(); - setState(2546); - arrayInitializer(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class DimExprsContext extends ParserRuleContext { - public List dimExpr() { - return getRuleContexts(DimExprContext.class); - } - public DimExprContext dimExpr(int i) { - return getRuleContext(DimExprContext.class,i); - } - public DimExprsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_dimExprs; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterDimExprs(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitDimExprs(this); - } - } - - public final DimExprsContext dimExprs() throws RecognitionException { - DimExprsContext _localctx = new DimExprsContext(_ctx, getState()); - enterRule(_localctx, 406, RULE_dimExprs); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2550); - dimExpr(); - setState(2554); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,289,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2551); - dimExpr(); - } - } - } - setState(2556); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,289,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class DimExprContext extends ParserRuleContext { - public TerminalNode LBRACK() { return getToken(Java8Parser.LBRACK, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode RBRACK() { return getToken(Java8Parser.RBRACK, 0); } - public List annotation() { - return getRuleContexts(AnnotationContext.class); - } - public AnnotationContext annotation(int i) { - return getRuleContext(AnnotationContext.class,i); - } - public DimExprContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_dimExpr; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterDimExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitDimExpr(this); - } - } - - public final DimExprContext dimExpr() throws RecognitionException { - DimExprContext _localctx = new DimExprContext(_ctx, getState()); - enterRule(_localctx, 408, RULE_dimExpr); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2560); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AT) { - { - { - setState(2557); - annotation(); - } - } - setState(2562); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2563); - match(LBRACK); - setState(2564); - expression(); - setState(2565); - match(RBRACK); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConstantExpressionContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ConstantExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constantExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConstantExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConstantExpression(this); - } - } - - public final ConstantExpressionContext constantExpression() throws RecognitionException { - ConstantExpressionContext _localctx = new ConstantExpressionContext(_ctx, getState()); - enterRule(_localctx, 410, RULE_constantExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2567); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExpressionContext extends ParserRuleContext { - public LambdaExpressionContext lambdaExpression() { - return getRuleContext(LambdaExpressionContext.class,0); - } - public AssignmentExpressionContext assignmentExpression() { - return getRuleContext(AssignmentExpressionContext.class,0); - } - public ExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExpression(this); - } - } - - public final ExpressionContext expression() throws RecognitionException { - ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); - enterRule(_localctx, 412, RULE_expression); - try { - setState(2571); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,291,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2569); - lambdaExpression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2570); - assignmentExpression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LambdaExpressionContext extends ParserRuleContext { - public LambdaParametersContext lambdaParameters() { - return getRuleContext(LambdaParametersContext.class,0); - } - public TerminalNode ARROW() { return getToken(Java8Parser.ARROW, 0); } - public LambdaBodyContext lambdaBody() { - return getRuleContext(LambdaBodyContext.class,0); - } - public LambdaExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_lambdaExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLambdaExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLambdaExpression(this); - } - } - - public final LambdaExpressionContext lambdaExpression() throws RecognitionException { - LambdaExpressionContext _localctx = new LambdaExpressionContext(_ctx, getState()); - enterRule(_localctx, 414, RULE_lambdaExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2573); - lambdaParameters(); - setState(2574); - match(ARROW); - setState(2575); - lambdaBody(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LambdaParametersContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(Java8Parser.Identifier, 0); } - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public FormalParameterListContext formalParameterList() { - return getRuleContext(FormalParameterListContext.class,0); - } - public InferredFormalParameterListContext inferredFormalParameterList() { - return getRuleContext(InferredFormalParameterListContext.class,0); - } - public LambdaParametersContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_lambdaParameters; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLambdaParameters(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLambdaParameters(this); - } - } - - public final LambdaParametersContext lambdaParameters() throws RecognitionException { - LambdaParametersContext _localctx = new LambdaParametersContext(_ctx, getState()); - enterRule(_localctx, 416, RULE_lambdaParameters); - int _la; - try { - setState(2587); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,293,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2577); - match(Identifier); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2578); - match(LPAREN); - setState(2580); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 138111369512L) != 0) || _la==Identifier || _la==AT) { - { - setState(2579); - formalParameterList(); - } - } - - setState(2582); - match(RPAREN); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2583); - match(LPAREN); - setState(2584); - inferredFormalParameterList(); - setState(2585); - match(RPAREN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InferredFormalParameterListContext extends ParserRuleContext { - public List Identifier() { return getTokens(Java8Parser.Identifier); } - public TerminalNode Identifier(int i) { - return getToken(Java8Parser.Identifier, i); - } - public List COMMA() { return getTokens(Java8Parser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(Java8Parser.COMMA, i); - } - public InferredFormalParameterListContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_inferredFormalParameterList; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInferredFormalParameterList(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInferredFormalParameterList(this); - } - } - - public final InferredFormalParameterListContext inferredFormalParameterList() throws RecognitionException { - InferredFormalParameterListContext _localctx = new InferredFormalParameterListContext(_ctx, getState()); - enterRule(_localctx, 418, RULE_inferredFormalParameterList); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2589); - match(Identifier); - setState(2594); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2590); - match(COMMA); - setState(2591); - match(Identifier); - } - } - setState(2596); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LambdaBodyContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public LambdaBodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_lambdaBody; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLambdaBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLambdaBody(this); - } - } - - public final LambdaBodyContext lambdaBody() throws RecognitionException { - LambdaBodyContext _localctx = new LambdaBodyContext(_ctx, getState()); - enterRule(_localctx, 420, RULE_lambdaBody); - try { - setState(2599); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case NEW: - case SHORT: - case SUPER: - case THIS: - case VOID: - case IntegerLiteral: - case FloatingPointLiteral: - case BooleanLiteral: - case CharacterLiteral: - case StringLiteral: - case NullLiteral: - case LPAREN: - case BANG: - case TILDE: - case INC: - case DEC: - case ADD: - case SUB: - case Identifier: - case AT: - enterOuterAlt(_localctx, 1); - { - setState(2597); - expression(); - } - break; - case LBRACE: - enterOuterAlt(_localctx, 2); - { - setState(2598); - block(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AssignmentExpressionContext extends ParserRuleContext { - public ConditionalExpressionContext conditionalExpression() { - return getRuleContext(ConditionalExpressionContext.class,0); - } - public AssignmentContext assignment() { - return getRuleContext(AssignmentContext.class,0); - } - public AssignmentExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_assignmentExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAssignmentExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAssignmentExpression(this); - } - } - - public final AssignmentExpressionContext assignmentExpression() throws RecognitionException { - AssignmentExpressionContext _localctx = new AssignmentExpressionContext(_ctx, getState()); - enterRule(_localctx, 422, RULE_assignmentExpression); - try { - setState(2603); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,296,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2601); - conditionalExpression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2602); - assignment(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AssignmentContext extends ParserRuleContext { - public LeftHandSideContext leftHandSide() { - return getRuleContext(LeftHandSideContext.class,0); - } - public AssignmentOperatorContext assignmentOperator() { - return getRuleContext(AssignmentOperatorContext.class,0); - } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public AssignmentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_assignment; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAssignment(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAssignment(this); - } - } - - public final AssignmentContext assignment() throws RecognitionException { - AssignmentContext _localctx = new AssignmentContext(_ctx, getState()); - enterRule(_localctx, 424, RULE_assignment); - try { - enterOuterAlt(_localctx, 1); - { - setState(2605); - leftHandSide(); - setState(2606); - assignmentOperator(); - setState(2607); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class LeftHandSideContext extends ParserRuleContext { - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public FieldAccessContext fieldAccess() { - return getRuleContext(FieldAccessContext.class,0); - } - public ArrayAccessContext arrayAccess() { - return getRuleContext(ArrayAccessContext.class,0); - } - public LeftHandSideContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_leftHandSide; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterLeftHandSide(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitLeftHandSide(this); - } - } - - public final LeftHandSideContext leftHandSide() throws RecognitionException { - LeftHandSideContext _localctx = new LeftHandSideContext(_ctx, getState()); - enterRule(_localctx, 426, RULE_leftHandSide); - try { - setState(2612); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,297,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2609); - expressionName(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2610); - fieldAccess(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2611); - arrayAccess(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AssignmentOperatorContext extends ParserRuleContext { - public TerminalNode ASSIGN() { return getToken(Java8Parser.ASSIGN, 0); } - public TerminalNode MUL_ASSIGN() { return getToken(Java8Parser.MUL_ASSIGN, 0); } - public TerminalNode DIV_ASSIGN() { return getToken(Java8Parser.DIV_ASSIGN, 0); } - public TerminalNode MOD_ASSIGN() { return getToken(Java8Parser.MOD_ASSIGN, 0); } - public TerminalNode ADD_ASSIGN() { return getToken(Java8Parser.ADD_ASSIGN, 0); } - public TerminalNode SUB_ASSIGN() { return getToken(Java8Parser.SUB_ASSIGN, 0); } - public TerminalNode LSHIFT_ASSIGN() { return getToken(Java8Parser.LSHIFT_ASSIGN, 0); } - public TerminalNode RSHIFT_ASSIGN() { return getToken(Java8Parser.RSHIFT_ASSIGN, 0); } - public TerminalNode URSHIFT_ASSIGN() { return getToken(Java8Parser.URSHIFT_ASSIGN, 0); } - public TerminalNode AND_ASSIGN() { return getToken(Java8Parser.AND_ASSIGN, 0); } - public TerminalNode XOR_ASSIGN() { return getToken(Java8Parser.XOR_ASSIGN, 0); } - public TerminalNode OR_ASSIGN() { return getToken(Java8Parser.OR_ASSIGN, 0); } - public AssignmentOperatorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_assignmentOperator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAssignmentOperator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAssignmentOperator(this); - } - } - - public final AssignmentOperatorContext assignmentOperator() throws RecognitionException { - AssignmentOperatorContext _localctx = new AssignmentOperatorContext(_ctx, getState()); - enterRule(_localctx, 428, RULE_assignmentOperator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2614); - _la = _input.LA(1); - if ( !(((((_la - 66)) & ~0x3f) == 0 && ((1L << (_la - 66)) & 68685922305L) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConditionalExpressionContext extends ParserRuleContext { - public ConditionalOrExpressionContext conditionalOrExpression() { - return getRuleContext(ConditionalOrExpressionContext.class,0); - } - public TerminalNode QUESTION() { return getToken(Java8Parser.QUESTION, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode COLON() { return getToken(Java8Parser.COLON, 0); } - public ConditionalExpressionContext conditionalExpression() { - return getRuleContext(ConditionalExpressionContext.class,0); - } - public ConditionalExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conditionalExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConditionalExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConditionalExpression(this); - } - } - - public final ConditionalExpressionContext conditionalExpression() throws RecognitionException { - ConditionalExpressionContext _localctx = new ConditionalExpressionContext(_ctx, getState()); - enterRule(_localctx, 430, RULE_conditionalExpression); - try { - setState(2623); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,298,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2616); - conditionalOrExpression(0); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2617); - conditionalOrExpression(0); - setState(2618); - match(QUESTION); - setState(2619); - expression(); - setState(2620); - match(COLON); - setState(2621); - conditionalExpression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConditionalOrExpressionContext extends ParserRuleContext { - public ConditionalAndExpressionContext conditionalAndExpression() { - return getRuleContext(ConditionalAndExpressionContext.class,0); - } - public ConditionalOrExpressionContext conditionalOrExpression() { - return getRuleContext(ConditionalOrExpressionContext.class,0); - } - public TerminalNode OR() { return getToken(Java8Parser.OR, 0); } - public ConditionalOrExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conditionalOrExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConditionalOrExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConditionalOrExpression(this); - } - } - - public final ConditionalOrExpressionContext conditionalOrExpression() throws RecognitionException { - return conditionalOrExpression(0); - } - - private ConditionalOrExpressionContext conditionalOrExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - ConditionalOrExpressionContext _localctx = new ConditionalOrExpressionContext(_ctx, _parentState); - ConditionalOrExpressionContext _prevctx = _localctx; - int _startState = 432; - enterRecursionRule(_localctx, 432, RULE_conditionalOrExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2626); - conditionalAndExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2633); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,299,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new ConditionalOrExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_conditionalOrExpression); - setState(2628); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2629); - match(OR); - setState(2630); - conditionalAndExpression(0); - } - } - } - setState(2635); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,299,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ConditionalAndExpressionContext extends ParserRuleContext { - public InclusiveOrExpressionContext inclusiveOrExpression() { - return getRuleContext(InclusiveOrExpressionContext.class,0); - } - public ConditionalAndExpressionContext conditionalAndExpression() { - return getRuleContext(ConditionalAndExpressionContext.class,0); - } - public TerminalNode AND() { return getToken(Java8Parser.AND, 0); } - public ConditionalAndExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conditionalAndExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterConditionalAndExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitConditionalAndExpression(this); - } - } - - public final ConditionalAndExpressionContext conditionalAndExpression() throws RecognitionException { - return conditionalAndExpression(0); - } - - private ConditionalAndExpressionContext conditionalAndExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - ConditionalAndExpressionContext _localctx = new ConditionalAndExpressionContext(_ctx, _parentState); - ConditionalAndExpressionContext _prevctx = _localctx; - int _startState = 434; - enterRecursionRule(_localctx, 434, RULE_conditionalAndExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2637); - inclusiveOrExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2644); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,300,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new ConditionalAndExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_conditionalAndExpression); - setState(2639); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2640); - match(AND); - setState(2641); - inclusiveOrExpression(0); - } - } - } - setState(2646); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,300,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class InclusiveOrExpressionContext extends ParserRuleContext { - public ExclusiveOrExpressionContext exclusiveOrExpression() { - return getRuleContext(ExclusiveOrExpressionContext.class,0); - } - public InclusiveOrExpressionContext inclusiveOrExpression() { - return getRuleContext(InclusiveOrExpressionContext.class,0); - } - public TerminalNode BITOR() { return getToken(Java8Parser.BITOR, 0); } - public InclusiveOrExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_inclusiveOrExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterInclusiveOrExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitInclusiveOrExpression(this); - } - } - - public final InclusiveOrExpressionContext inclusiveOrExpression() throws RecognitionException { - return inclusiveOrExpression(0); - } - - private InclusiveOrExpressionContext inclusiveOrExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - InclusiveOrExpressionContext _localctx = new InclusiveOrExpressionContext(_ctx, _parentState); - InclusiveOrExpressionContext _prevctx = _localctx; - int _startState = 436; - enterRecursionRule(_localctx, 436, RULE_inclusiveOrExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2648); - exclusiveOrExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2655); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,301,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new InclusiveOrExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_inclusiveOrExpression); - setState(2650); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2651); - match(BITOR); - setState(2652); - exclusiveOrExpression(0); - } - } - } - setState(2657); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,301,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ExclusiveOrExpressionContext extends ParserRuleContext { - public AndExpressionContext andExpression() { - return getRuleContext(AndExpressionContext.class,0); - } - public ExclusiveOrExpressionContext exclusiveOrExpression() { - return getRuleContext(ExclusiveOrExpressionContext.class,0); - } - public TerminalNode CARET() { return getToken(Java8Parser.CARET, 0); } - public ExclusiveOrExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exclusiveOrExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterExclusiveOrExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitExclusiveOrExpression(this); - } - } - - public final ExclusiveOrExpressionContext exclusiveOrExpression() throws RecognitionException { - return exclusiveOrExpression(0); - } - - private ExclusiveOrExpressionContext exclusiveOrExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - ExclusiveOrExpressionContext _localctx = new ExclusiveOrExpressionContext(_ctx, _parentState); - ExclusiveOrExpressionContext _prevctx = _localctx; - int _startState = 438; - enterRecursionRule(_localctx, 438, RULE_exclusiveOrExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2659); - andExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2666); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,302,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new ExclusiveOrExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_exclusiveOrExpression); - setState(2661); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2662); - match(CARET); - setState(2663); - andExpression(0); - } - } - } - setState(2668); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,302,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AndExpressionContext extends ParserRuleContext { - public EqualityExpressionContext equalityExpression() { - return getRuleContext(EqualityExpressionContext.class,0); - } - public AndExpressionContext andExpression() { - return getRuleContext(AndExpressionContext.class,0); - } - public TerminalNode BITAND() { return getToken(Java8Parser.BITAND, 0); } - public AndExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_andExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAndExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAndExpression(this); - } - } - - public final AndExpressionContext andExpression() throws RecognitionException { - return andExpression(0); - } - - private AndExpressionContext andExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - AndExpressionContext _localctx = new AndExpressionContext(_ctx, _parentState); - AndExpressionContext _prevctx = _localctx; - int _startState = 440; - enterRecursionRule(_localctx, 440, RULE_andExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2670); - equalityExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2677); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,303,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - { - _localctx = new AndExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_andExpression); - setState(2672); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2673); - match(BITAND); - setState(2674); - equalityExpression(0); - } - } - } - setState(2679); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,303,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class EqualityExpressionContext extends ParserRuleContext { - public RelationalExpressionContext relationalExpression() { - return getRuleContext(RelationalExpressionContext.class,0); - } - public EqualityExpressionContext equalityExpression() { - return getRuleContext(EqualityExpressionContext.class,0); - } - public TerminalNode EQUAL() { return getToken(Java8Parser.EQUAL, 0); } - public TerminalNode NOTEQUAL() { return getToken(Java8Parser.NOTEQUAL, 0); } - public EqualityExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_equalityExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterEqualityExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitEqualityExpression(this); - } - } - - public final EqualityExpressionContext equalityExpression() throws RecognitionException { - return equalityExpression(0); - } - - private EqualityExpressionContext equalityExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - EqualityExpressionContext _localctx = new EqualityExpressionContext(_ctx, _parentState); - EqualityExpressionContext _prevctx = _localctx; - int _startState = 442; - enterRecursionRule(_localctx, 442, RULE_equalityExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2681); - relationalExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2691); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,305,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - setState(2689); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,304,_ctx) ) { - case 1: - { - _localctx = new EqualityExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_equalityExpression); - setState(2683); - if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(2684); - match(EQUAL); - setState(2685); - relationalExpression(0); - } - break; - case 2: - { - _localctx = new EqualityExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_equalityExpression); - setState(2686); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2687); - match(NOTEQUAL); - setState(2688); - relationalExpression(0); - } - break; - } - } - } - setState(2693); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,305,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class RelationalExpressionContext extends ParserRuleContext { - public ShiftExpressionContext shiftExpression() { - return getRuleContext(ShiftExpressionContext.class,0); - } - public RelationalExpressionContext relationalExpression() { - return getRuleContext(RelationalExpressionContext.class,0); - } - public TerminalNode LT() { return getToken(Java8Parser.LT, 0); } - public TerminalNode GT() { return getToken(Java8Parser.GT, 0); } - public TerminalNode LE() { return getToken(Java8Parser.LE, 0); } - public TerminalNode GE() { return getToken(Java8Parser.GE, 0); } - public TerminalNode INSTANCEOF() { return getToken(Java8Parser.INSTANCEOF, 0); } - public ReferenceTypeContext referenceType() { - return getRuleContext(ReferenceTypeContext.class,0); - } - public RelationalExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_relationalExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterRelationalExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitRelationalExpression(this); - } - } - - public final RelationalExpressionContext relationalExpression() throws RecognitionException { - return relationalExpression(0); - } - - private RelationalExpressionContext relationalExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - RelationalExpressionContext _localctx = new RelationalExpressionContext(_ctx, _parentState); - RelationalExpressionContext _prevctx = _localctx; - int _startState = 444; - enterRecursionRule(_localctx, 444, RULE_relationalExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2695); - shiftExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2714); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,307,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - setState(2712); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,306,_ctx) ) { - case 1: - { - _localctx = new RelationalExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); - setState(2697); - if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)"); - setState(2698); - match(LT); - setState(2699); - shiftExpression(0); - } - break; - case 2: - { - _localctx = new RelationalExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); - setState(2700); - if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); - setState(2701); - match(GT); - setState(2702); - shiftExpression(0); - } - break; - case 3: - { - _localctx = new RelationalExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); - setState(2703); - if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); - setState(2704); - match(LE); - setState(2705); - shiftExpression(0); - } - break; - case 4: - { - _localctx = new RelationalExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); - setState(2706); - if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(2707); - match(GE); - setState(2708); - shiftExpression(0); - } - break; - case 5: - { - _localctx = new RelationalExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); - setState(2709); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2710); - match(INSTANCEOF); - setState(2711); - referenceType(); - } - break; - } - } - } - setState(2716); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,307,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ShiftExpressionContext extends ParserRuleContext { - public AdditiveExpressionContext additiveExpression() { - return getRuleContext(AdditiveExpressionContext.class,0); - } - public ShiftExpressionContext shiftExpression() { - return getRuleContext(ShiftExpressionContext.class,0); - } - public List LT() { return getTokens(Java8Parser.LT); } - public TerminalNode LT(int i) { - return getToken(Java8Parser.LT, i); - } - public List GT() { return getTokens(Java8Parser.GT); } - public TerminalNode GT(int i) { - return getToken(Java8Parser.GT, i); - } - public ShiftExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_shiftExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterShiftExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitShiftExpression(this); - } - } - - public final ShiftExpressionContext shiftExpression() throws RecognitionException { - return shiftExpression(0); - } - - private ShiftExpressionContext shiftExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - ShiftExpressionContext _localctx = new ShiftExpressionContext(_ctx, _parentState); - ShiftExpressionContext _prevctx = _localctx; - int _startState = 446; - enterRecursionRule(_localctx, 446, RULE_shiftExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2718); - additiveExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2735); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,309,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - setState(2733); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,308,_ctx) ) { - case 1: - { - _localctx = new ShiftExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_shiftExpression); - setState(2720); - if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); - setState(2721); - match(LT); - setState(2722); - match(LT); - setState(2723); - additiveExpression(0); - } - break; - case 2: - { - _localctx = new ShiftExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_shiftExpression); - setState(2724); - if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(2725); - match(GT); - setState(2726); - match(GT); - setState(2727); - additiveExpression(0); - } - break; - case 3: - { - _localctx = new ShiftExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_shiftExpression); - setState(2728); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2729); - match(GT); - setState(2730); - match(GT); - setState(2731); - match(GT); - setState(2732); - additiveExpression(0); - } - break; - } - } - } - setState(2737); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,309,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AdditiveExpressionContext extends ParserRuleContext { - public MultiplicativeExpressionContext multiplicativeExpression() { - return getRuleContext(MultiplicativeExpressionContext.class,0); - } - public AdditiveExpressionContext additiveExpression() { - return getRuleContext(AdditiveExpressionContext.class,0); - } - public TerminalNode ADD() { return getToken(Java8Parser.ADD, 0); } - public TerminalNode SUB() { return getToken(Java8Parser.SUB, 0); } - public AdditiveExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_additiveExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterAdditiveExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitAdditiveExpression(this); - } - } - - public final AdditiveExpressionContext additiveExpression() throws RecognitionException { - return additiveExpression(0); - } - - private AdditiveExpressionContext additiveExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - AdditiveExpressionContext _localctx = new AdditiveExpressionContext(_ctx, _parentState); - AdditiveExpressionContext _prevctx = _localctx; - int _startState = 448; - enterRecursionRule(_localctx, 448, RULE_additiveExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2739); - multiplicativeExpression(0); - } - _ctx.stop = _input.LT(-1); - setState(2749); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,311,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - setState(2747); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,310,_ctx) ) { - case 1: - { - _localctx = new AdditiveExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_additiveExpression); - setState(2741); - if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(2742); - match(ADD); - setState(2743); - multiplicativeExpression(0); - } - break; - case 2: - { - _localctx = new AdditiveExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_additiveExpression); - setState(2744); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2745); - match(SUB); - setState(2746); - multiplicativeExpression(0); - } - break; - } - } - } - setState(2751); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,311,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class MultiplicativeExpressionContext extends ParserRuleContext { - public UnaryExpressionContext unaryExpression() { - return getRuleContext(UnaryExpressionContext.class,0); - } - public MultiplicativeExpressionContext multiplicativeExpression() { - return getRuleContext(MultiplicativeExpressionContext.class,0); - } - public TerminalNode MUL() { return getToken(Java8Parser.MUL, 0); } - public TerminalNode DIV() { return getToken(Java8Parser.DIV, 0); } - public TerminalNode MOD() { return getToken(Java8Parser.MOD, 0); } - public MultiplicativeExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_multiplicativeExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterMultiplicativeExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitMultiplicativeExpression(this); - } - } - - public final MultiplicativeExpressionContext multiplicativeExpression() throws RecognitionException { - return multiplicativeExpression(0); - } - - private MultiplicativeExpressionContext multiplicativeExpression(int _p) throws RecognitionException { - ParserRuleContext _parentctx = _ctx; - int _parentState = getState(); - MultiplicativeExpressionContext _localctx = new MultiplicativeExpressionContext(_ctx, _parentState); - MultiplicativeExpressionContext _prevctx = _localctx; - int _startState = 450; - enterRecursionRule(_localctx, 450, RULE_multiplicativeExpression, _p); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - { - setState(2753); - unaryExpression(); - } - _ctx.stop = _input.LT(-1); - setState(2766); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,313,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( _parseListeners!=null ) triggerExitRuleEvent(); - _prevctx = _localctx; - { - setState(2764); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,312,_ctx) ) { - case 1: - { - _localctx = new MultiplicativeExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_multiplicativeExpression); - setState(2755); - if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); - setState(2756); - match(MUL); - setState(2757); - unaryExpression(); - } - break; - case 2: - { - _localctx = new MultiplicativeExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_multiplicativeExpression); - setState(2758); - if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(2759); - match(DIV); - setState(2760); - unaryExpression(); - } - break; - case 3: - { - _localctx = new MultiplicativeExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_multiplicativeExpression); - setState(2761); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(2762); - match(MOD); - setState(2763); - unaryExpression(); - } - break; - } - } - } - setState(2768); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,313,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - unrollRecursionContexts(_parentctx); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnaryExpressionContext extends ParserRuleContext { - public PreIncrementExpressionContext preIncrementExpression() { - return getRuleContext(PreIncrementExpressionContext.class,0); - } - public PreDecrementExpressionContext preDecrementExpression() { - return getRuleContext(PreDecrementExpressionContext.class,0); - } - public TerminalNode ADD() { return getToken(Java8Parser.ADD, 0); } - public UnaryExpressionContext unaryExpression() { - return getRuleContext(UnaryExpressionContext.class,0); - } - public TerminalNode SUB() { return getToken(Java8Parser.SUB, 0); } - public UnaryExpressionNotPlusMinusContext unaryExpressionNotPlusMinus() { - return getRuleContext(UnaryExpressionNotPlusMinusContext.class,0); - } - public UnaryExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unaryExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnaryExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnaryExpression(this); - } - } - - public final UnaryExpressionContext unaryExpression() throws RecognitionException { - UnaryExpressionContext _localctx = new UnaryExpressionContext(_ctx, getState()); - enterRule(_localctx, 452, RULE_unaryExpression); - try { - setState(2776); - _errHandler.sync(this); - switch (_input.LA(1)) { - case INC: - enterOuterAlt(_localctx, 1); - { - setState(2769); - preIncrementExpression(); - } - break; - case DEC: - enterOuterAlt(_localctx, 2); - { - setState(2770); - preDecrementExpression(); - } - break; - case ADD: - enterOuterAlt(_localctx, 3); - { - setState(2771); - match(ADD); - setState(2772); - unaryExpression(); - } - break; - case SUB: - enterOuterAlt(_localctx, 4); - { - setState(2773); - match(SUB); - setState(2774); - unaryExpression(); - } - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case NEW: - case SHORT: - case SUPER: - case THIS: - case VOID: - case IntegerLiteral: - case FloatingPointLiteral: - case BooleanLiteral: - case CharacterLiteral: - case StringLiteral: - case NullLiteral: - case LPAREN: - case BANG: - case TILDE: - case Identifier: - case AT: - enterOuterAlt(_localctx, 5); - { - setState(2775); - unaryExpressionNotPlusMinus(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PreIncrementExpressionContext extends ParserRuleContext { - public TerminalNode INC() { return getToken(Java8Parser.INC, 0); } - public UnaryExpressionContext unaryExpression() { - return getRuleContext(UnaryExpressionContext.class,0); - } - public PreIncrementExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_preIncrementExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPreIncrementExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPreIncrementExpression(this); - } - } - - public final PreIncrementExpressionContext preIncrementExpression() throws RecognitionException { - PreIncrementExpressionContext _localctx = new PreIncrementExpressionContext(_ctx, getState()); - enterRule(_localctx, 454, RULE_preIncrementExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2778); - match(INC); - setState(2779); - unaryExpression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PreDecrementExpressionContext extends ParserRuleContext { - public TerminalNode DEC() { return getToken(Java8Parser.DEC, 0); } - public UnaryExpressionContext unaryExpression() { - return getRuleContext(UnaryExpressionContext.class,0); - } - public PreDecrementExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_preDecrementExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPreDecrementExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPreDecrementExpression(this); - } - } - - public final PreDecrementExpressionContext preDecrementExpression() throws RecognitionException { - PreDecrementExpressionContext _localctx = new PreDecrementExpressionContext(_ctx, getState()); - enterRule(_localctx, 456, RULE_preDecrementExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2781); - match(DEC); - setState(2782); - unaryExpression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class UnaryExpressionNotPlusMinusContext extends ParserRuleContext { - public PostfixExpressionContext postfixExpression() { - return getRuleContext(PostfixExpressionContext.class,0); - } - public TerminalNode TILDE() { return getToken(Java8Parser.TILDE, 0); } - public UnaryExpressionContext unaryExpression() { - return getRuleContext(UnaryExpressionContext.class,0); - } - public TerminalNode BANG() { return getToken(Java8Parser.BANG, 0); } - public CastExpressionContext castExpression() { - return getRuleContext(CastExpressionContext.class,0); - } - public UnaryExpressionNotPlusMinusContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unaryExpressionNotPlusMinus; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterUnaryExpressionNotPlusMinus(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitUnaryExpressionNotPlusMinus(this); - } - } - - public final UnaryExpressionNotPlusMinusContext unaryExpressionNotPlusMinus() throws RecognitionException { - UnaryExpressionNotPlusMinusContext _localctx = new UnaryExpressionNotPlusMinusContext(_ctx, getState()); - enterRule(_localctx, 458, RULE_unaryExpressionNotPlusMinus); - try { - setState(2790); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,315,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2784); - postfixExpression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2785); - match(TILDE); - setState(2786); - unaryExpression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2787); - match(BANG); - setState(2788); - unaryExpression(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(2789); - castExpression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PostfixExpressionContext extends ParserRuleContext { - public PrimaryContext primary() { - return getRuleContext(PrimaryContext.class,0); - } - public ExpressionNameContext expressionName() { - return getRuleContext(ExpressionNameContext.class,0); - } - public List postIncrementExpression_lf_postfixExpression() { - return getRuleContexts(PostIncrementExpression_lf_postfixExpressionContext.class); - } - public PostIncrementExpression_lf_postfixExpressionContext postIncrementExpression_lf_postfixExpression(int i) { - return getRuleContext(PostIncrementExpression_lf_postfixExpressionContext.class,i); - } - public List postDecrementExpression_lf_postfixExpression() { - return getRuleContexts(PostDecrementExpression_lf_postfixExpressionContext.class); - } - public PostDecrementExpression_lf_postfixExpressionContext postDecrementExpression_lf_postfixExpression(int i) { - return getRuleContext(PostDecrementExpression_lf_postfixExpressionContext.class,i); - } - public PostfixExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_postfixExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPostfixExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPostfixExpression(this); - } - } - - public final PostfixExpressionContext postfixExpression() throws RecognitionException { - PostfixExpressionContext _localctx = new PostfixExpressionContext(_ctx, getState()); - enterRule(_localctx, 460, RULE_postfixExpression); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2794); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,316,_ctx) ) { - case 1: - { - setState(2792); - primary(); - } - break; - case 2: - { - setState(2793); - expressionName(); - } - break; - } - setState(2800); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,318,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - setState(2798); - _errHandler.sync(this); - switch (_input.LA(1)) { - case INC: - { - setState(2796); - postIncrementExpression_lf_postfixExpression(); - } - break; - case DEC: - { - setState(2797); - postDecrementExpression_lf_postfixExpression(); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - setState(2802); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,318,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PostIncrementExpressionContext extends ParserRuleContext { - public PostfixExpressionContext postfixExpression() { - return getRuleContext(PostfixExpressionContext.class,0); - } - public TerminalNode INC() { return getToken(Java8Parser.INC, 0); } - public PostIncrementExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_postIncrementExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPostIncrementExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPostIncrementExpression(this); - } - } - - public final PostIncrementExpressionContext postIncrementExpression() throws RecognitionException { - PostIncrementExpressionContext _localctx = new PostIncrementExpressionContext(_ctx, getState()); - enterRule(_localctx, 462, RULE_postIncrementExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2803); - postfixExpression(); - setState(2804); - match(INC); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PostIncrementExpression_lf_postfixExpressionContext extends ParserRuleContext { - public TerminalNode INC() { return getToken(Java8Parser.INC, 0); } - public PostIncrementExpression_lf_postfixExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_postIncrementExpression_lf_postfixExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPostIncrementExpression_lf_postfixExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPostIncrementExpression_lf_postfixExpression(this); - } - } - - public final PostIncrementExpression_lf_postfixExpressionContext postIncrementExpression_lf_postfixExpression() throws RecognitionException { - PostIncrementExpression_lf_postfixExpressionContext _localctx = new PostIncrementExpression_lf_postfixExpressionContext(_ctx, getState()); - enterRule(_localctx, 464, RULE_postIncrementExpression_lf_postfixExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2806); - match(INC); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PostDecrementExpressionContext extends ParserRuleContext { - public PostfixExpressionContext postfixExpression() { - return getRuleContext(PostfixExpressionContext.class,0); - } - public TerminalNode DEC() { return getToken(Java8Parser.DEC, 0); } - public PostDecrementExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_postDecrementExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPostDecrementExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPostDecrementExpression(this); - } - } - - public final PostDecrementExpressionContext postDecrementExpression() throws RecognitionException { - PostDecrementExpressionContext _localctx = new PostDecrementExpressionContext(_ctx, getState()); - enterRule(_localctx, 466, RULE_postDecrementExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2808); - postfixExpression(); - setState(2809); - match(DEC); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PostDecrementExpression_lf_postfixExpressionContext extends ParserRuleContext { - public TerminalNode DEC() { return getToken(Java8Parser.DEC, 0); } - public PostDecrementExpression_lf_postfixExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_postDecrementExpression_lf_postfixExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterPostDecrementExpression_lf_postfixExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitPostDecrementExpression_lf_postfixExpression(this); - } - } - - public final PostDecrementExpression_lf_postfixExpressionContext postDecrementExpression_lf_postfixExpression() throws RecognitionException { - PostDecrementExpression_lf_postfixExpressionContext _localctx = new PostDecrementExpression_lf_postfixExpressionContext(_ctx, getState()); - enterRule(_localctx, 468, RULE_postDecrementExpression_lf_postfixExpression); - try { - enterOuterAlt(_localctx, 1); - { - setState(2811); - match(DEC); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class CastExpressionContext extends ParserRuleContext { - public TerminalNode LPAREN() { return getToken(Java8Parser.LPAREN, 0); } - public PrimitiveTypeContext primitiveType() { - return getRuleContext(PrimitiveTypeContext.class,0); - } - public TerminalNode RPAREN() { return getToken(Java8Parser.RPAREN, 0); } - public UnaryExpressionContext unaryExpression() { - return getRuleContext(UnaryExpressionContext.class,0); - } - public ReferenceTypeContext referenceType() { - return getRuleContext(ReferenceTypeContext.class,0); - } - public UnaryExpressionNotPlusMinusContext unaryExpressionNotPlusMinus() { - return getRuleContext(UnaryExpressionNotPlusMinusContext.class,0); - } - public List additionalBound() { - return getRuleContexts(AdditionalBoundContext.class); - } - public AdditionalBoundContext additionalBound(int i) { - return getRuleContext(AdditionalBoundContext.class,i); - } - public LambdaExpressionContext lambdaExpression() { - return getRuleContext(LambdaExpressionContext.class,0); - } - public CastExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_castExpression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).enterCastExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof Java8ParserListener ) ((Java8ParserListener)listener).exitCastExpression(this); - } - } - - public final CastExpressionContext castExpression() throws RecognitionException { - CastExpressionContext _localctx = new CastExpressionContext(_ctx, getState()); - enterRule(_localctx, 470, RULE_castExpression); - int _la; - try { - setState(2840); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,321,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2813); - match(LPAREN); - setState(2814); - primitiveType(); - setState(2815); - match(RPAREN); - setState(2816); - unaryExpression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2818); - match(LPAREN); - setState(2819); - referenceType(); - setState(2823); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==BITAND) { - { - { - setState(2820); - additionalBound(); - } - } - setState(2825); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2826); - match(RPAREN); - setState(2827); - unaryExpressionNotPlusMinus(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(2829); - match(LPAREN); - setState(2830); - referenceType(); - setState(2834); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==BITAND) { - { - { - setState(2831); - additionalBound(); - } - } - setState(2836); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2837); - match(RPAREN); - setState(2838); - lambdaExpression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { - switch (ruleIndex) { - case 25: - return packageName_sempred((PackageNameContext)_localctx, predIndex); - case 27: - return packageOrTypeName_sempred((PackageOrTypeNameContext)_localctx, predIndex); - case 30: - return ambiguousName_sempred((AmbiguousNameContext)_localctx, predIndex); - case 216: - return conditionalOrExpression_sempred((ConditionalOrExpressionContext)_localctx, predIndex); - case 217: - return conditionalAndExpression_sempred((ConditionalAndExpressionContext)_localctx, predIndex); - case 218: - return inclusiveOrExpression_sempred((InclusiveOrExpressionContext)_localctx, predIndex); - case 219: - return exclusiveOrExpression_sempred((ExclusiveOrExpressionContext)_localctx, predIndex); - case 220: - return andExpression_sempred((AndExpressionContext)_localctx, predIndex); - case 221: - return equalityExpression_sempred((EqualityExpressionContext)_localctx, predIndex); - case 222: - return relationalExpression_sempred((RelationalExpressionContext)_localctx, predIndex); - case 223: - return shiftExpression_sempred((ShiftExpressionContext)_localctx, predIndex); - case 224: - return additiveExpression_sempred((AdditiveExpressionContext)_localctx, predIndex); - case 225: - return multiplicativeExpression_sempred((MultiplicativeExpressionContext)_localctx, predIndex); - } - return true; - } - private boolean packageName_sempred(PackageNameContext _localctx, int predIndex) { - switch (predIndex) { - case 0: - return precpred(_ctx, 1); - } - return true; - } - private boolean packageOrTypeName_sempred(PackageOrTypeNameContext _localctx, int predIndex) { - switch (predIndex) { - case 1: - return precpred(_ctx, 1); - } - return true; - } - private boolean ambiguousName_sempred(AmbiguousNameContext _localctx, int predIndex) { - switch (predIndex) { - case 2: - return precpred(_ctx, 1); - } - return true; - } - private boolean conditionalOrExpression_sempred(ConditionalOrExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 3: - return precpred(_ctx, 1); - } - return true; - } - private boolean conditionalAndExpression_sempred(ConditionalAndExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 4: - return precpred(_ctx, 1); - } - return true; - } - private boolean inclusiveOrExpression_sempred(InclusiveOrExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 5: - return precpred(_ctx, 1); - } - return true; - } - private boolean exclusiveOrExpression_sempred(ExclusiveOrExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 6: - return precpred(_ctx, 1); - } - return true; - } - private boolean andExpression_sempred(AndExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 7: - return precpred(_ctx, 1); - } - return true; - } - private boolean equalityExpression_sempred(EqualityExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 8: - return precpred(_ctx, 2); - case 9: - return precpred(_ctx, 1); - } - return true; - } - private boolean relationalExpression_sempred(RelationalExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 10: - return precpred(_ctx, 5); - case 11: - return precpred(_ctx, 4); - case 12: - return precpred(_ctx, 3); - case 13: - return precpred(_ctx, 2); - case 14: - return precpred(_ctx, 1); - } - return true; - } - private boolean shiftExpression_sempred(ShiftExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 15: - return precpred(_ctx, 3); - case 16: - return precpred(_ctx, 2); - case 17: - return precpred(_ctx, 1); - } - return true; - } - private boolean additiveExpression_sempred(AdditiveExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 18: - return precpred(_ctx, 2); - case 19: - return precpred(_ctx, 1); - } - return true; - } - private boolean multiplicativeExpression_sempred(MultiplicativeExpressionContext _localctx, int predIndex) { - switch (predIndex) { - case 20: - return precpred(_ctx, 3); - case 21: - return precpred(_ctx, 2); - case 22: - return precpred(_ctx, 1); - } - return true; - } - - private static final String _serializedATNSegment0 = - "\u0004\u0001k\u0b1b\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ - "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ - "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+ - "\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002"+ - "\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007\u000f"+ - "\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007\u0012"+ - "\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007\u0015"+ - "\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002\u0018\u0007\u0018"+ - "\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002\u001b\u0007\u001b"+ - "\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002\u001e\u0007\u001e"+ - "\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007!\u0002\"\u0007\"\u0002"+ - "#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007&\u0002\'\u0007\'\u0002"+ - "(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007+\u0002,\u0007,\u0002"+ - "-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u00070\u00021\u00071\u0002"+ - "2\u00072\u00023\u00073\u00024\u00074\u00025\u00075\u00026\u00076\u0002"+ - "7\u00077\u00028\u00078\u00029\u00079\u0002:\u0007:\u0002;\u0007;\u0002"+ - "<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007?\u0002@\u0007@\u0002"+ - "A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007D\u0002E\u0007E\u0002"+ - "F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007I\u0002J\u0007J\u0002"+ - "K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007N\u0002O\u0007O\u0002"+ - "P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007S\u0002T\u0007T\u0002"+ - "U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002X\u0007X\u0002Y\u0007Y\u0002"+ - "Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002]\u0007]\u0002^\u0007^\u0002"+ - "_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002b\u0007b\u0002c\u0007c\u0002"+ - "d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002g\u0007g\u0002h\u0007h\u0002"+ - "i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002l\u0007l\u0002m\u0007m\u0002"+ - "n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002q\u0007q\u0002r\u0007r\u0002"+ - "s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002v\u0007v\u0002w\u0007w\u0002"+ - "x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002{\u0007{\u0002|\u0007|\u0002"+ - "}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f\u0002\u0080\u0007\u0080"+ - "\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082\u0002\u0083\u0007\u0083"+ - "\u0002\u0084\u0007\u0084\u0002\u0085\u0007\u0085\u0002\u0086\u0007\u0086"+ - "\u0002\u0087\u0007\u0087\u0002\u0088\u0007\u0088\u0002\u0089\u0007\u0089"+ - "\u0002\u008a\u0007\u008a\u0002\u008b\u0007\u008b\u0002\u008c\u0007\u008c"+ - "\u0002\u008d\u0007\u008d\u0002\u008e\u0007\u008e\u0002\u008f\u0007\u008f"+ - "\u0002\u0090\u0007\u0090\u0002\u0091\u0007\u0091\u0002\u0092\u0007\u0092"+ - "\u0002\u0093\u0007\u0093\u0002\u0094\u0007\u0094\u0002\u0095\u0007\u0095"+ - "\u0002\u0096\u0007\u0096\u0002\u0097\u0007\u0097\u0002\u0098\u0007\u0098"+ - "\u0002\u0099\u0007\u0099\u0002\u009a\u0007\u009a\u0002\u009b\u0007\u009b"+ - "\u0002\u009c\u0007\u009c\u0002\u009d\u0007\u009d\u0002\u009e\u0007\u009e"+ - "\u0002\u009f\u0007\u009f\u0002\u00a0\u0007\u00a0\u0002\u00a1\u0007\u00a1"+ - "\u0002\u00a2\u0007\u00a2\u0002\u00a3\u0007\u00a3\u0002\u00a4\u0007\u00a4"+ - "\u0002\u00a5\u0007\u00a5\u0002\u00a6\u0007\u00a6\u0002\u00a7\u0007\u00a7"+ - "\u0002\u00a8\u0007\u00a8\u0002\u00a9\u0007\u00a9\u0002\u00aa\u0007\u00aa"+ - "\u0002\u00ab\u0007\u00ab\u0002\u00ac\u0007\u00ac\u0002\u00ad\u0007\u00ad"+ - "\u0002\u00ae\u0007\u00ae\u0002\u00af\u0007\u00af\u0002\u00b0\u0007\u00b0"+ - "\u0002\u00b1\u0007\u00b1\u0002\u00b2\u0007\u00b2\u0002\u00b3\u0007\u00b3"+ - "\u0002\u00b4\u0007\u00b4\u0002\u00b5\u0007\u00b5\u0002\u00b6\u0007\u00b6"+ - "\u0002\u00b7\u0007\u00b7\u0002\u00b8\u0007\u00b8\u0002\u00b9\u0007\u00b9"+ - "\u0002\u00ba\u0007\u00ba\u0002\u00bb\u0007\u00bb\u0002\u00bc\u0007\u00bc"+ - "\u0002\u00bd\u0007\u00bd\u0002\u00be\u0007\u00be\u0002\u00bf\u0007\u00bf"+ - "\u0002\u00c0\u0007\u00c0\u0002\u00c1\u0007\u00c1\u0002\u00c2\u0007\u00c2"+ - "\u0002\u00c3\u0007\u00c3\u0002\u00c4\u0007\u00c4\u0002\u00c5\u0007\u00c5"+ - "\u0002\u00c6\u0007\u00c6\u0002\u00c7\u0007\u00c7\u0002\u00c8\u0007\u00c8"+ - "\u0002\u00c9\u0007\u00c9\u0002\u00ca\u0007\u00ca\u0002\u00cb\u0007\u00cb"+ - "\u0002\u00cc\u0007\u00cc\u0002\u00cd\u0007\u00cd\u0002\u00ce\u0007\u00ce"+ - "\u0002\u00cf\u0007\u00cf\u0002\u00d0\u0007\u00d0\u0002\u00d1\u0007\u00d1"+ - "\u0002\u00d2\u0007\u00d2\u0002\u00d3\u0007\u00d3\u0002\u00d4\u0007\u00d4"+ - "\u0002\u00d5\u0007\u00d5\u0002\u00d6\u0007\u00d6\u0002\u00d7\u0007\u00d7"+ - "\u0002\u00d8\u0007\u00d8\u0002\u00d9\u0007\u00d9\u0002\u00da\u0007\u00da"+ - "\u0002\u00db\u0007\u00db\u0002\u00dc\u0007\u00dc\u0002\u00dd\u0007\u00dd"+ - "\u0002\u00de\u0007\u00de\u0002\u00df\u0007\u00df\u0002\u00e0\u0007\u00e0"+ - "\u0002\u00e1\u0007\u00e1\u0002\u00e2\u0007\u00e2\u0002\u00e3\u0007\u00e3"+ - "\u0002\u00e4\u0007\u00e4\u0002\u00e5\u0007\u00e5\u0002\u00e6\u0007\u00e6"+ - "\u0002\u00e7\u0007\u00e7\u0002\u00e8\u0007\u00e8\u0002\u00e9\u0007\u00e9"+ - "\u0002\u00ea\u0007\u00ea\u0002\u00eb\u0007\u00eb\u0001\u0000\u0001\u0000"+ - "\u0001\u0001\u0005\u0001\u01dc\b\u0001\n\u0001\f\u0001\u01df\t\u0001\u0001"+ - "\u0001\u0001\u0001\u0005\u0001\u01e3\b\u0001\n\u0001\f\u0001\u01e6\t\u0001"+ - "\u0001\u0001\u0003\u0001\u01e9\b\u0001\u0001\u0002\u0001\u0002\u0003\u0002"+ - "\u01ed\b\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0005"+ - "\u0001\u0005\u0001\u0005\u0003\u0005\u01f6\b\u0005\u0001\u0006\u0001\u0006"+ - "\u0003\u0006\u01fa\b\u0006\u0001\u0006\u0001\u0006\u0005\u0006\u01fe\b"+ - "\u0006\n\u0006\f\u0006\u0201\t\u0006\u0001\u0007\u0005\u0007\u0204\b\u0007"+ - "\n\u0007\f\u0007\u0207\t\u0007\u0001\u0007\u0001\u0007\u0003\u0007\u020b"+ - "\b\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0005\u0007\u0210\b\u0007"+ - "\n\u0007\f\u0007\u0213\t\u0007\u0001\u0007\u0001\u0007\u0003\u0007\u0217"+ - "\b\u0007\u0003\u0007\u0219\b\u0007\u0001\b\u0001\b\u0005\b\u021d\b\b\n"+ - "\b\f\b\u0220\t\b\u0001\b\u0001\b\u0003\b\u0224\b\b\u0001\t\u0005\t\u0227"+ - "\b\t\n\t\f\t\u022a\t\t\u0001\t\u0001\t\u0003\t\u022e\b\t\u0001\n\u0001"+ - "\n\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\r\u0005\r\u0237\b\r\n"+ - "\r\f\r\u023a\t\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001"+ - "\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0003"+ - "\u000e\u0247\b\u000e\u0001\u000f\u0005\u000f\u024a\b\u000f\n\u000f\f\u000f"+ - "\u024d\t\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0005\u000f\u0252\b"+ - "\u000f\n\u000f\f\u000f\u0255\t\u000f\u0001\u000f\u0001\u000f\u0005\u000f"+ - "\u0259\b\u000f\n\u000f\f\u000f\u025c\t\u000f\u0001\u0010\u0005\u0010\u025f"+ - "\b\u0010\n\u0010\f\u0010\u0262\t\u0010\u0001\u0010\u0001\u0010\u0003\u0010"+ - "\u0266\b\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012"+ - "\u0001\u0012\u0001\u0012\u0005\u0012\u026f\b\u0012\n\u0012\f\u0012\u0272"+ - "\t\u0012\u0003\u0012\u0274\b\u0012\u0001\u0013\u0001\u0013\u0001\u0013"+ - "\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+ - "\u0001\u0015\u0005\u0015\u0280\b\u0015\n\u0015\f\u0015\u0283\t\u0015\u0001"+ - "\u0016\u0001\u0016\u0003\u0016\u0287\b\u0016\u0001\u0017\u0005\u0017\u028a"+ - "\b\u0017\n\u0017\f\u0017\u028d\t\u0017\u0001\u0017\u0001\u0017\u0003\u0017"+ - "\u0291\b\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0003\u0018"+ - "\u0297\b\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019"+ - "\u0001\u0019\u0005\u0019\u029f\b\u0019\n\u0019\f\u0019\u02a2\t\u0019\u0001"+ - "\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0003\u001a\u02a9"+ - "\b\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001"+ - "\u001b\u0005\u001b\u02b1\b\u001b\n\u001b\f\u001b\u02b4\t\u001b\u0001\u001c"+ - "\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0003\u001c\u02bb\b\u001c"+ - "\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e"+ - "\u0001\u001e\u0001\u001e\u0005\u001e\u02c5\b\u001e\n\u001e\f\u001e\u02c8"+ - "\t\u001e\u0001\u001f\u0003\u001f\u02cb\b\u001f\u0001\u001f\u0005\u001f"+ - "\u02ce\b\u001f\n\u001f\f\u001f\u02d1\t\u001f\u0001\u001f\u0005\u001f\u02d4"+ - "\b\u001f\n\u001f\f\u001f\u02d7\t\u001f\u0001\u001f\u0001\u001f\u0001 "+ - "\u0005 \u02dc\b \n \f \u02df\t \u0001 \u0001 \u0001 \u0001 \u0001!\u0001"+ - "!\u0001\"\u0001\"\u0001\"\u0001\"\u0003\"\u02eb\b\"\u0001#\u0001#\u0001"+ - "#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0001$\u0001%\u0001%\u0001"+ - "%\u0001%\u0001%\u0001%\u0001%\u0001&\u0001&\u0001&\u0001&\u0001&\u0001"+ - "&\u0001&\u0001\'\u0001\'\u0001\'\u0003\'\u0308\b\'\u0001(\u0001(\u0003"+ - "(\u030c\b(\u0001)\u0005)\u030f\b)\n)\f)\u0312\t)\u0001)\u0001)\u0001)"+ - "\u0003)\u0317\b)\u0001)\u0003)\u031a\b)\u0001)\u0003)\u031d\b)\u0001)"+ - "\u0001)\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0003"+ - "*\u0329\b*\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001,\u0005,\u0332"+ - "\b,\n,\f,\u0335\t,\u0001-\u0001-\u0001-\u0001.\u0001.\u0001.\u0001/\u0001"+ - "/\u0001/\u0005/\u0340\b/\n/\f/\u0343\t/\u00010\u00010\u00050\u0347\b0"+ - "\n0\f0\u034a\t0\u00010\u00010\u00011\u00011\u00011\u00011\u00031\u0352"+ - "\b1\u00012\u00012\u00012\u00012\u00012\u00032\u0359\b2\u00013\u00053\u035c"+ - "\b3\n3\f3\u035f\t3\u00013\u00013\u00013\u00013\u00014\u00014\u00014\u0001"+ - "4\u00014\u00014\u00014\u00014\u00034\u036d\b4\u00015\u00015\u00015\u0005"+ - "5\u0372\b5\n5\f5\u0375\t5\u00016\u00016\u00016\u00036\u037a\b6\u00017"+ - "\u00017\u00037\u037e\b7\u00018\u00018\u00038\u0382\b8\u00019\u00019\u0003"+ - "9\u0386\b9\u0001:\u0001:\u0003:\u038a\b:\u0001;\u0001;\u0001;\u0003;\u038f"+ - "\b;\u0001<\u0001<\u0003<\u0393\b<\u0001<\u0001<\u0005<\u0397\b<\n<\f<"+ - "\u039a\t<\u0001=\u0001=\u0003=\u039e\b=\u0001=\u0001=\u0001=\u0005=\u03a3"+ - "\b=\n=\f=\u03a6\t=\u0001=\u0001=\u0003=\u03aa\b=\u0003=\u03ac\b=\u0001"+ - ">\u0001>\u0005>\u03b0\b>\n>\f>\u03b3\t>\u0001>\u0001>\u0003>\u03b7\b>"+ - "\u0001?\u0001?\u0003?\u03bb\b?\u0001@\u0001@\u0001A\u0001A\u0001B\u0001"+ - "B\u0001C\u0001C\u0001D\u0001D\u0001D\u0001D\u0001D\u0001D\u0001D\u0001"+ - "D\u0001D\u0003D\u03ce\bD\u0001E\u0005E\u03d1\bE\nE\fE\u03d4\tE\u0001E"+ - "\u0001E\u0001E\u0001F\u0001F\u0001F\u0001F\u0001F\u0001F\u0001F\u0001"+ - "F\u0001F\u0001F\u0003F\u03e3\bF\u0001G\u0001G\u0001G\u0003G\u03e8\bG\u0001"+ - "G\u0001G\u0005G\u03ec\bG\nG\fG\u03ef\tG\u0001G\u0001G\u0001G\u0003G\u03f4"+ - "\bG\u0003G\u03f6\bG\u0001H\u0001H\u0003H\u03fa\bH\u0001I\u0001I\u0001"+ - "I\u0003I\u03ff\bI\u0001I\u0001I\u0003I\u0403\bI\u0001J\u0001J\u0001J\u0001"+ - "J\u0001J\u0001J\u0003J\u040b\bJ\u0001K\u0001K\u0001K\u0005K\u0410\bK\n"+ - "K\fK\u0413\tK\u0001K\u0001K\u0001K\u0005K\u0418\bK\nK\fK\u041b\tK\u0003"+ - "K\u041d\bK\u0001L\u0005L\u0420\bL\nL\fL\u0423\tL\u0001L\u0001L\u0001L"+ - "\u0001M\u0001M\u0003M\u042a\bM\u0001N\u0005N\u042d\bN\nN\fN\u0430\tN\u0001"+ - "N\u0001N\u0005N\u0434\bN\nN\fN\u0437\tN\u0001N\u0001N\u0001N\u0001N\u0003"+ - "N\u043d\bN\u0001O\u0005O\u0440\bO\nO\fO\u0443\tO\u0001O\u0001O\u0001O"+ - "\u0003O\u0448\bO\u0001O\u0001O\u0001P\u0001P\u0001P\u0001Q\u0001Q\u0001"+ - "Q\u0005Q\u0452\bQ\nQ\fQ\u0455\tQ\u0001R\u0001R\u0003R\u0459\bR\u0001S"+ - "\u0001S\u0003S\u045d\bS\u0001T\u0001T\u0001U\u0001U\u0001U\u0001V\u0005"+ - "V\u0465\bV\nV\fV\u0468\tV\u0001V\u0001V\u0003V\u046c\bV\u0001V\u0001V"+ - "\u0001W\u0001W\u0001W\u0001W\u0003W\u0474\bW\u0001X\u0003X\u0477\bX\u0001"+ - "X\u0001X\u0001X\u0003X\u047c\bX\u0001X\u0001X\u0001Y\u0001Y\u0001Z\u0001"+ - "Z\u0003Z\u0484\bZ\u0001Z\u0003Z\u0487\bZ\u0001Z\u0001Z\u0001[\u0003[\u048c"+ - "\b[\u0001[\u0001[\u0001[\u0003[\u0491\b[\u0001[\u0001[\u0001[\u0003[\u0496"+ - "\b[\u0001[\u0001[\u0001[\u0003[\u049b\b[\u0001[\u0001[\u0001[\u0001[\u0001"+ - "[\u0003[\u04a2\b[\u0001[\u0001[\u0001[\u0003[\u04a7\b[\u0001[\u0001[\u0001"+ - "[\u0001[\u0001[\u0001[\u0003[\u04af\b[\u0001[\u0001[\u0001[\u0003[\u04b4"+ - "\b[\u0001[\u0001[\u0001[\u0003[\u04b9\b[\u0001\\\u0005\\\u04bc\b\\\n\\"+ - "\f\\\u04bf\t\\\u0001\\\u0001\\\u0001\\\u0003\\\u04c4\b\\\u0001\\\u0001"+ - "\\\u0001]\u0001]\u0003]\u04ca\b]\u0001]\u0003]\u04cd\b]\u0001]\u0003]"+ - "\u04d0\b]\u0001]\u0001]\u0001^\u0001^\u0001^\u0005^\u04d7\b^\n^\f^\u04da"+ - "\t^\u0001_\u0005_\u04dd\b_\n_\f_\u04e0\t_\u0001_\u0001_\u0001_\u0003_"+ - "\u04e5\b_\u0001_\u0003_\u04e8\b_\u0001_\u0003_\u04eb\b_\u0001`\u0001`"+ - "\u0001a\u0001a\u0005a\u04f1\ba\na\fa\u04f4\ta\u0001b\u0001b\u0003b\u04f8"+ - "\bb\u0001c\u0005c\u04fb\bc\nc\fc\u04fe\tc\u0001c\u0001c\u0001c\u0003c"+ - "\u0503\bc\u0001c\u0003c\u0506\bc\u0001c\u0001c\u0001d\u0001d\u0001d\u0001"+ - "d\u0001d\u0001d\u0001d\u0003d\u0511\bd\u0001e\u0001e\u0001e\u0001f\u0001"+ - "f\u0005f\u0518\bf\nf\ff\u051b\tf\u0001f\u0001f\u0001g\u0001g\u0001g\u0001"+ - "g\u0001g\u0003g\u0524\bg\u0001h\u0005h\u0527\bh\nh\fh\u052a\th\u0001h"+ - "\u0001h\u0001h\u0001h\u0001i\u0001i\u0001i\u0001i\u0003i\u0534\bi\u0001"+ - "j\u0005j\u0537\bj\nj\fj\u053a\tj\u0001j\u0001j\u0001j\u0001k\u0001k\u0001"+ - "k\u0001k\u0001k\u0001k\u0003k\u0545\bk\u0001l\u0005l\u0548\bl\nl\fl\u054b"+ - "\tl\u0001l\u0001l\u0001l\u0001l\u0001l\u0001m\u0001m\u0005m\u0554\bm\n"+ - "m\fm\u0557\tm\u0001m\u0001m\u0001n\u0001n\u0001n\u0001n\u0001n\u0003n"+ - "\u0560\bn\u0001o\u0005o\u0563\bo\no\fo\u0566\to\u0001o\u0001o\u0001o\u0001"+ - "o\u0001o\u0003o\u056d\bo\u0001o\u0003o\u0570\bo\u0001o\u0001o\u0001p\u0001"+ - "p\u0001p\u0003p\u0577\bp\u0001q\u0001q\u0001q\u0001r\u0001r\u0001r\u0003"+ - "r\u057f\br\u0001s\u0001s\u0001s\u0001s\u0003s\u0585\bs\u0001s\u0001s\u0001"+ - "t\u0001t\u0001t\u0005t\u058c\bt\nt\ft\u058f\tt\u0001u\u0001u\u0001u\u0001"+ - "u\u0001v\u0001v\u0001v\u0003v\u0598\bv\u0001w\u0001w\u0003w\u059c\bw\u0001"+ - "w\u0003w\u059f\bw\u0001w\u0001w\u0001x\u0001x\u0001x\u0005x\u05a6\bx\n"+ - "x\fx\u05a9\tx\u0001y\u0001y\u0001y\u0001z\u0001z\u0001z\u0001z\u0001z"+ - "\u0001z\u0001{\u0001{\u0003{\u05b6\b{\u0001{\u0003{\u05b9\b{\u0001{\u0001"+ - "{\u0001|\u0001|\u0001|\u0005|\u05c0\b|\n|\f|\u05c3\t|\u0001}\u0001}\u0003"+ - "}\u05c7\b}\u0001}\u0001}\u0001~\u0004~\u05cc\b~\u000b~\f~\u05cd\u0001"+ - "\u007f\u0001\u007f\u0001\u007f\u0003\u007f\u05d3\b\u007f\u0001\u0080\u0001"+ - "\u0080\u0001\u0080\u0001\u0081\u0005\u0081\u05d9\b\u0081\n\u0081\f\u0081"+ - "\u05dc\t\u0081\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0082\u0001\u0082"+ - "\u0001\u0082\u0001\u0082\u0001\u0082\u0001\u0082\u0003\u0082\u05e7\b\u0082"+ - "\u0001\u0083\u0001\u0083\u0001\u0083\u0001\u0083\u0001\u0083\u0003\u0083"+ - "\u05ee\b\u0083\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0084"+ - "\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0084"+ - "\u0001\u0084\u0003\u0084\u05fc\b\u0084\u0001\u0085\u0001\u0085\u0001\u0086"+ - "\u0001\u0086\u0001\u0086\u0001\u0086\u0001\u0087\u0001\u0087\u0001\u0087"+ - "\u0001\u0087\u0001\u0088\u0001\u0088\u0001\u0088\u0001\u0089\u0001\u0089"+ - "\u0001\u0089\u0001\u0089\u0001\u0089\u0001\u0089\u0001\u0089\u0003\u0089"+ - "\u0612\b\u0089\u0001\u008a\u0001\u008a\u0001\u008a\u0001\u008a\u0001\u008a"+ - "\u0001\u008a\u0001\u008b\u0001\u008b\u0001\u008b\u0001\u008b\u0001\u008b"+ - "\u0001\u008b\u0001\u008b\u0001\u008b\u0001\u008c\u0001\u008c\u0001\u008c"+ - "\u0001\u008c\u0001\u008c\u0001\u008c\u0001\u008c\u0001\u008c\u0001\u008d"+ - "\u0001\u008d\u0001\u008d\u0001\u008d\u0001\u008d\u0001\u008d\u0001\u008d"+ - "\u0001\u008d\u0001\u008d\u0001\u008d\u0003\u008d\u0634\b\u008d\u0001\u008e"+ - "\u0001\u008e\u0001\u008e\u0001\u008e\u0001\u008e\u0001\u008e\u0001\u008f"+ - "\u0001\u008f\u0005\u008f\u063e\b\u008f\n\u008f\f\u008f\u0641\t\u008f\u0001"+ - "\u008f\u0005\u008f\u0644\b\u008f\n\u008f\f\u008f\u0647\t\u008f\u0001\u008f"+ - "\u0001\u008f\u0001\u0090\u0001\u0090\u0001\u0090\u0001\u0091\u0001\u0091"+ - "\u0005\u0091\u0650\b\u0091\n\u0091\f\u0091\u0653\t\u0091\u0001\u0092\u0001"+ - "\u0092\u0001\u0092\u0001\u0092\u0001\u0092\u0001\u0092\u0001\u0092\u0001"+ - "\u0092\u0001\u0092\u0001\u0092\u0003\u0092\u065f\b\u0092\u0001\u0093\u0001"+ - "\u0093\u0001\u0094\u0001\u0094\u0001\u0094\u0001\u0094\u0001\u0094\u0001"+ - "\u0094\u0001\u0095\u0001\u0095\u0001\u0095\u0001\u0095\u0001\u0095\u0001"+ - "\u0095\u0001\u0096\u0001\u0096\u0001\u0096\u0001\u0096\u0001\u0096\u0001"+ - "\u0096\u0001\u0096\u0001\u0096\u0001\u0097\u0001\u0097\u0003\u0097\u0679"+ - "\b\u0097\u0001\u0098\u0001\u0098\u0003\u0098\u067d\b\u0098\u0001\u0099"+ - "\u0001\u0099\u0001\u0099\u0003\u0099\u0682\b\u0099\u0001\u0099\u0001\u0099"+ - "\u0003\u0099\u0686\b\u0099\u0001\u0099\u0001\u0099\u0003\u0099\u068a\b"+ - "\u0099\u0001\u0099\u0001\u0099\u0001\u0099\u0001\u009a\u0001\u009a\u0001"+ - "\u009a\u0003\u009a\u0692\b\u009a\u0001\u009a\u0001\u009a\u0003\u009a\u0696"+ - "\b\u009a\u0001\u009a\u0001\u009a\u0003\u009a\u069a\b\u009a\u0001\u009a"+ - "\u0001\u009a\u0001\u009a\u0001\u009b\u0001\u009b\u0003\u009b\u06a1\b\u009b"+ - "\u0001\u009c\u0001\u009c\u0001\u009d\u0001\u009d\u0001\u009d\u0005\u009d"+ - "\u06a8\b\u009d\n\u009d\f\u009d\u06ab\t\u009d\u0001\u009e\u0001\u009e\u0001"+ - "\u009e\u0005\u009e\u06b0\b\u009e\n\u009e\f\u009e\u06b3\t\u009e\u0001\u009e"+ - "\u0001\u009e\u0001\u009e\u0001\u009e\u0001\u009e\u0001\u009e\u0001\u009e"+ - "\u0001\u009f\u0001\u009f\u0001\u009f\u0005\u009f\u06bf\b\u009f\n\u009f"+ - "\f\u009f\u06c2\t\u009f\u0001\u009f\u0001\u009f\u0001\u009f\u0001\u009f"+ - "\u0001\u009f\u0001\u009f\u0001\u009f\u0001\u00a0\u0001\u00a0\u0003\u00a0"+ - "\u06cd\b\u00a0\u0001\u00a0\u0001\u00a0\u0001\u00a1\u0001\u00a1\u0003\u00a1"+ - "\u06d3\b\u00a1\u0001\u00a1\u0001\u00a1\u0001\u00a2\u0001\u00a2\u0003\u00a2"+ - "\u06d9\b\u00a2\u0001\u00a2\u0001\u00a2\u0001\u00a3\u0001\u00a3\u0001\u00a3"+ - "\u0001\u00a3\u0001\u00a4\u0001\u00a4\u0001\u00a4\u0001\u00a4\u0001\u00a4"+ - "\u0001\u00a4\u0001\u00a5\u0001\u00a5\u0001\u00a5\u0001\u00a5\u0001\u00a5"+ - "\u0001\u00a5\u0001\u00a5\u0003\u00a5\u06ee\b\u00a5\u0001\u00a5\u0001\u00a5"+ - "\u0001\u00a5\u0003\u00a5\u06f3\b\u00a5\u0001\u00a6\u0001\u00a6\u0005\u00a6"+ - "\u06f7\b\u00a6\n\u00a6\f\u00a6\u06fa\t\u00a6\u0001\u00a7\u0001\u00a7\u0001"+ - "\u00a7\u0001\u00a7\u0001\u00a7\u0001\u00a7\u0001\u00a8\u0005\u00a8\u0703"+ - "\b\u00a8\n\u00a8\f\u00a8\u0706\t\u00a8\u0001\u00a8\u0001\u00a8\u0001\u00a8"+ - "\u0001\u00a9\u0001\u00a9\u0001\u00a9\u0005\u00a9\u070e\b\u00a9\n\u00a9"+ - "\f\u00a9\u0711\t\u00a9\u0001\u00aa\u0001\u00aa\u0001\u00aa\u0001\u00ab"+ - "\u0001\u00ab\u0001\u00ab\u0001\u00ab\u0003\u00ab\u071a\b\u00ab\u0001\u00ab"+ - "\u0003\u00ab\u071d\b\u00ab\u0001\u00ac\u0001\u00ac\u0001\u00ac\u0003\u00ac"+ - "\u0722\b\u00ac\u0001\u00ac\u0001\u00ac\u0001\u00ad\u0001\u00ad\u0001\u00ad"+ - "\u0005\u00ad\u0729\b\u00ad\n\u00ad\f\u00ad\u072c\t\u00ad\u0001\u00ae\u0005"+ - "\u00ae\u072f\b\u00ae\n\u00ae\f\u00ae\u0732\t\u00ae\u0001\u00ae\u0001\u00ae"+ - "\u0001\u00ae\u0001\u00ae\u0001\u00ae\u0001\u00af\u0001\u00af\u0003\u00af"+ - "\u073b\b\u00af\u0001\u00af\u0005\u00af\u073e\b\u00af\n\u00af\f\u00af\u0741"+ - "\t\u00af\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0005\u00b0\u0747"+ - "\b\u00b0\n\u00b0\f\u00b0\u074a\t\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0"+ - "\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0"+ - "\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0"+ - "\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0001\u00b0\u0003\u00b0"+ - "\u0760\b\u00b0\u0001\u00b1\u0001\u00b1\u0001\u00b2\u0001\u00b2\u0001\u00b2"+ - "\u0001\u00b2\u0005\u00b2\u0768\b\u00b2\n\u00b2\f\u00b2\u076b\t\u00b2\u0001"+ - "\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001"+ - "\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001"+ - "\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001\u00b2\u0001"+ - "\u00b2\u0003\u00b2\u0780\b\u00b2\u0001\u00b3\u0001\u00b3\u0001\u00b3\u0001"+ - "\u00b3\u0001\u00b3\u0003\u00b3\u0787\b\u00b3\u0001\u00b4\u0001\u00b4\u0001"+ - "\u00b5\u0001\u00b5\u0001\u00b5\u0001\u00b5\u0003\u00b5\u078f\b\u00b5\u0001"+ - "\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0005\u00b6\u0795\b\u00b6\n"+ - "\u00b6\f\u00b6\u0798\t\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001"+ - "\u00b6\u0001\u00b6\u0001\u00b6\u0005\u00b6\u07a0\b\u00b6\n\u00b6\f\u00b6"+ - "\u07a3\t\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6"+ - "\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6"+ - "\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0001\u00b6"+ - "\u0001\u00b6\u0001\u00b6\u0001\u00b6\u0003\u00b6\u07b9\b\u00b6\u0001\u00b7"+ - "\u0001\u00b7\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0005\u00b8"+ - "\u07c1\b\u00b8\n\u00b8\f\u00b8\u07c4\t\u00b8\u0001\u00b8\u0001\u00b8\u0001"+ - "\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0005\u00b8\u07cc\b\u00b8\n"+ - "\u00b8\f\u00b8\u07cf\t\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001"+ - "\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001"+ - "\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0001"+ - "\u00b8\u0001\u00b8\u0001\u00b8\u0001\u00b8\u0003\u00b8\u07e4\b\u00b8\u0001"+ - "\u00b9\u0001\u00b9\u0003\u00b9\u07e8\b\u00b9\u0001\u00b9\u0005\u00b9\u07eb"+ - "\b\u00b9\n\u00b9\f\u00b9\u07ee\t\u00b9\u0001\u00b9\u0001\u00b9\u0001\u00b9"+ - "\u0005\u00b9\u07f3\b\u00b9\n\u00b9\f\u00b9\u07f6\t\u00b9\u0001\u00b9\u0005"+ - "\u00b9\u07f9\b\u00b9\n\u00b9\f\u00b9\u07fc\t\u00b9\u0001\u00b9\u0003\u00b9"+ - "\u07ff\b\u00b9\u0001\u00b9\u0001\u00b9\u0003\u00b9\u0803\b\u00b9\u0001"+ - "\u00b9\u0001\u00b9\u0003\u00b9\u0807\b\u00b9\u0001\u00b9\u0001\u00b9\u0001"+ - "\u00b9\u0001\u00b9\u0003\u00b9\u080d\b\u00b9\u0001\u00b9\u0005\u00b9\u0810"+ - "\b\u00b9\n\u00b9\f\u00b9\u0813\t\u00b9\u0001\u00b9\u0001\u00b9\u0003\u00b9"+ - "\u0817\b\u00b9\u0001\u00b9\u0001\u00b9\u0003\u00b9\u081b\b\u00b9\u0001"+ - "\u00b9\u0001\u00b9\u0003\u00b9\u081f\b\u00b9\u0001\u00b9\u0001\u00b9\u0001"+ - "\u00b9\u0001\u00b9\u0003\u00b9\u0825\b\u00b9\u0001\u00b9\u0005\u00b9\u0828"+ - "\b\u00b9\n\u00b9\f\u00b9\u082b\t\u00b9\u0001\u00b9\u0001\u00b9\u0003\u00b9"+ - "\u082f\b\u00b9\u0001\u00b9\u0001\u00b9\u0003\u00b9\u0833\b\u00b9\u0001"+ - "\u00b9\u0001\u00b9\u0003\u00b9\u0837\b\u00b9\u0003\u00b9\u0839\b\u00b9"+ - "\u0001\u00ba\u0001\u00ba\u0001\u00ba\u0003\u00ba\u083e\b\u00ba\u0001\u00ba"+ - "\u0005\u00ba\u0841\b\u00ba\n\u00ba\f\u00ba\u0844\t\u00ba\u0001\u00ba\u0001"+ - "\u00ba\u0003\u00ba\u0848\b\u00ba\u0001\u00ba\u0001\u00ba\u0003\u00ba\u084c"+ - "\b\u00ba\u0001\u00ba\u0001\u00ba\u0003\u00ba\u0850\b\u00ba\u0001\u00bb"+ - "\u0001\u00bb\u0003\u00bb\u0854\b\u00bb\u0001\u00bb\u0005\u00bb\u0857\b"+ - "\u00bb\n\u00bb\f\u00bb\u085a\t\u00bb\u0001\u00bb\u0001\u00bb\u0001\u00bb"+ - "\u0005\u00bb\u085f\b\u00bb\n\u00bb\f\u00bb\u0862\t\u00bb\u0001\u00bb\u0005"+ - "\u00bb\u0865\b\u00bb\n\u00bb\f\u00bb\u0868\t\u00bb\u0001\u00bb\u0003\u00bb"+ - "\u086b\b\u00bb\u0001\u00bb\u0001\u00bb\u0003\u00bb\u086f\b\u00bb\u0001"+ - "\u00bb\u0001\u00bb\u0003\u00bb\u0873\b\u00bb\u0001\u00bb\u0001\u00bb\u0001"+ - "\u00bb\u0001\u00bb\u0003\u00bb\u0879\b\u00bb\u0001\u00bb\u0005\u00bb\u087c"+ - "\b\u00bb\n\u00bb\f\u00bb\u087f\t\u00bb\u0001\u00bb\u0001\u00bb\u0003\u00bb"+ - "\u0883\b\u00bb\u0001\u00bb\u0001\u00bb\u0003\u00bb\u0887\b\u00bb\u0001"+ - "\u00bb\u0001\u00bb\u0003\u00bb\u088b\b\u00bb\u0003\u00bb\u088d\b\u00bb"+ - "\u0001\u00bc\u0001\u00bc\u0001\u00bc\u0003\u00bc\u0892\b\u00bc\u0001\u00bd"+ - "\u0001\u00bd\u0001\u00bd\u0001\u00bd\u0001\u00bd\u0001\u00bd\u0001\u00bd"+ - "\u0001\u00bd\u0001\u00bd\u0001\u00bd\u0001\u00bd\u0001\u00bd\u0001\u00bd"+ - "\u0003\u00bd\u08a1\b\u00bd\u0001\u00be\u0001\u00be\u0001\u00be\u0001\u00bf"+ - "\u0001\u00bf\u0001\u00bf\u0001\u00bf\u0001\u00bf\u0001\u00bf\u0001\u00bf"+ - "\u0001\u00bf\u0001\u00bf\u0003\u00bf\u08af\b\u00bf\u0001\u00c0\u0001\u00c0"+ - "\u0001\u00c0\u0001\u00c0\u0001\u00c0\u0001\u00c0\u0001\u00c0\u0001\u00c0"+ - "\u0001\u00c0\u0001\u00c0\u0003\u00c0\u08bb\b\u00c0\u0001\u00c0\u0001\u00c0"+ - "\u0001\u00c0\u0001\u00c0\u0001\u00c0\u0005\u00c0\u08c2\b\u00c0\n\u00c0"+ - "\f\u00c0\u08c5\t\u00c0\u0001\u00c1\u0001\u00c1\u0001\u00c1\u0001\u00c1"+ - "\u0001\u00c1\u0001\u00c1\u0001\u00c1\u0001\u00c1\u0001\u00c1\u0005\u00c1"+ - "\u08d0\b\u00c1\n\u00c1\f\u00c1\u08d3\t\u00c1\u0001\u00c2\u0001\u00c2\u0001"+ - "\u00c2\u0001\u00c2\u0001\u00c2\u0001\u00c2\u0001\u00c2\u0001\u00c2\u0001"+ - "\u00c2\u0001\u00c2\u0003\u00c2\u08df\b\u00c2\u0001\u00c2\u0001\u00c2\u0001"+ - "\u00c2\u0001\u00c2\u0001\u00c2\u0005\u00c2\u08e6\b\u00c2\n\u00c2\f\u00c2"+ - "\u08e9\t\u00c2\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003\u00c3\u08ee\b"+ - "\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003"+ - "\u00c3\u08f5\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003\u00c3\u08fa"+ - "\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003"+ - "\u00c3\u0901\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003\u00c3\u0906"+ - "\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003"+ - "\u00c3\u090d\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003\u00c3\u0912"+ - "\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003"+ - "\u00c3\u0919\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003\u00c3\u091e"+ - "\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0001"+ - "\u00c3\u0003\u00c3\u0926\b\u00c3\u0001\u00c3\u0001\u00c3\u0001\u00c3\u0003"+ - "\u00c3\u092b\b\u00c3\u0001\u00c3\u0001\u00c3\u0003\u00c3\u092f\b\u00c3"+ - "\u0001\u00c4\u0001\u00c4\u0003\u00c4\u0933\b\u00c4\u0001\u00c4\u0001\u00c4"+ - "\u0001\u00c4\u0003\u00c4\u0938\b\u00c4\u0001\u00c4\u0001\u00c4\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0003\u00c5\u093f\b\u00c5\u0001\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0001\u00c5\u0003\u00c5\u0946\b\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0003\u00c5\u094b\b\u00c5\u0001\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0001\u00c5\u0003\u00c5\u0952\b\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0003\u00c5\u0957\b\u00c5\u0001\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0001\u00c5\u0003\u00c5\u095e\b\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0003\u00c5\u0963\b\u00c5\u0001\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0001\u00c5\u0001\u00c5\u0003\u00c5\u096b\b\u00c5"+ - "\u0001\u00c5\u0001\u00c5\u0001\u00c5\u0003\u00c5\u0970\b\u00c5\u0001\u00c5"+ - "\u0001\u00c5\u0003\u00c5\u0974\b\u00c5\u0001\u00c6\u0001\u00c6\u0001\u00c6"+ - "\u0005\u00c6\u0979\b\u00c6\n\u00c6\f\u00c6\u097c\t\u00c6\u0001\u00c7\u0001"+ - "\u00c7\u0001\u00c7\u0003\u00c7\u0981\b\u00c7\u0001\u00c7\u0001\u00c7\u0001"+ - "\u00c7\u0001\u00c7\u0001\u00c7\u0003\u00c7\u0988\b\u00c7\u0001\u00c7\u0001"+ - "\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0003\u00c7\u098f\b\u00c7\u0001"+ - "\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0003\u00c7\u0996"+ - "\b\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0001"+ - "\u00c7\u0003\u00c7\u099e\b\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0001"+ - "\u00c7\u0001\u00c7\u0003\u00c7\u09a5\b\u00c7\u0001\u00c7\u0001\u00c7\u0001"+ - "\u00c7\u0001\u00c7\u0001\u00c7\u0001\u00c7\u0003\u00c7\u09ad\b\u00c7\u0001"+ - "\u00c8\u0001\u00c8\u0003\u00c8\u09b1\b\u00c8\u0001\u00c8\u0001\u00c8\u0001"+ - "\u00c9\u0001\u00c9\u0001\u00c9\u0003\u00c9\u09b8\b\u00c9\u0001\u00c9\u0001"+ - "\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0003\u00c9\u09bf\b\u00c9\u0001"+ - "\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0003\u00c9\u09c6"+ - "\b\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0001"+ - "\u00c9\u0003\u00c9\u09ce\b\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0001"+ - "\u00c9\u0001\u00c9\u0003\u00c9\u09d5\b\u00c9\u0001\u00c9\u0001\u00c9\u0001"+ - "\u00c9\u0001\u00c9\u0001\u00c9\u0001\u00c9\u0003\u00c9\u09dd\b\u00c9\u0001"+ - "\u00ca\u0001\u00ca\u0001\u00ca\u0001\u00ca\u0003\u00ca\u09e3\b\u00ca\u0001"+ - "\u00ca\u0001\u00ca\u0001\u00ca\u0001\u00ca\u0003\u00ca\u09e9\b\u00ca\u0001"+ - "\u00ca\u0001\u00ca\u0001\u00ca\u0001\u00ca\u0001\u00ca\u0001\u00ca\u0001"+ - "\u00ca\u0001\u00ca\u0001\u00ca\u0001\u00ca\u0003\u00ca\u09f5\b\u00ca\u0001"+ - "\u00cb\u0001\u00cb\u0005\u00cb\u09f9\b\u00cb\n\u00cb\f\u00cb\u09fc\t\u00cb"+ - "\u0001\u00cc\u0005\u00cc\u09ff\b\u00cc\n\u00cc\f\u00cc\u0a02\t\u00cc\u0001"+ - "\u00cc\u0001\u00cc\u0001\u00cc\u0001\u00cc\u0001\u00cd\u0001\u00cd\u0001"+ - "\u00ce\u0001\u00ce\u0003\u00ce\u0a0c\b\u00ce\u0001\u00cf\u0001\u00cf\u0001"+ - "\u00cf\u0001\u00cf\u0001\u00d0\u0001\u00d0\u0001\u00d0\u0003\u00d0\u0a15"+ - "\b\u00d0\u0001\u00d0\u0001\u00d0\u0001\u00d0\u0001\u00d0\u0001\u00d0\u0003"+ - "\u00d0\u0a1c\b\u00d0\u0001\u00d1\u0001\u00d1\u0001\u00d1\u0005\u00d1\u0a21"+ - "\b\u00d1\n\u00d1\f\u00d1\u0a24\t\u00d1\u0001\u00d2\u0001\u00d2\u0003\u00d2"+ - "\u0a28\b\u00d2\u0001\u00d3\u0001\u00d3\u0003\u00d3\u0a2c\b\u00d3\u0001"+ - "\u00d4\u0001\u00d4\u0001\u00d4\u0001\u00d4\u0001\u00d5\u0001\u00d5\u0001"+ - "\u00d5\u0003\u00d5\u0a35\b\u00d5\u0001\u00d6\u0001\u00d6\u0001\u00d7\u0001"+ - "\u00d7\u0001\u00d7\u0001\u00d7\u0001\u00d7\u0001\u00d7\u0001\u00d7\u0003"+ - "\u00d7\u0a40\b\u00d7\u0001\u00d8\u0001\u00d8\u0001\u00d8\u0001\u00d8\u0001"+ - "\u00d8\u0001\u00d8\u0005\u00d8\u0a48\b\u00d8\n\u00d8\f\u00d8\u0a4b\t\u00d8"+ - "\u0001\u00d9\u0001\u00d9\u0001\u00d9\u0001\u00d9\u0001\u00d9\u0001\u00d9"+ - "\u0005\u00d9\u0a53\b\u00d9\n\u00d9\f\u00d9\u0a56\t\u00d9\u0001\u00da\u0001"+ - "\u00da\u0001\u00da\u0001\u00da\u0001\u00da\u0001\u00da\u0005\u00da\u0a5e"+ - "\b\u00da\n\u00da\f\u00da\u0a61\t\u00da\u0001\u00db\u0001\u00db\u0001\u00db"+ - "\u0001\u00db\u0001\u00db\u0001\u00db\u0005\u00db\u0a69\b\u00db\n\u00db"+ - "\f\u00db\u0a6c\t\u00db\u0001\u00dc\u0001\u00dc\u0001\u00dc\u0001\u00dc"+ - "\u0001\u00dc\u0001\u00dc\u0005\u00dc\u0a74\b\u00dc\n\u00dc\f\u00dc\u0a77"+ - "\t\u00dc\u0001\u00dd\u0001\u00dd\u0001\u00dd\u0001\u00dd\u0001\u00dd\u0001"+ - "\u00dd\u0001\u00dd\u0001\u00dd\u0001\u00dd\u0005\u00dd\u0a82\b\u00dd\n"+ - "\u00dd\f\u00dd\u0a85\t\u00dd\u0001\u00de\u0001\u00de\u0001\u00de\u0001"+ - "\u00de\u0001\u00de\u0001\u00de\u0001\u00de\u0001\u00de\u0001\u00de\u0001"+ - "\u00de\u0001\u00de\u0001\u00de\u0001\u00de\u0001\u00de\u0001\u00de\u0001"+ - "\u00de\u0001\u00de\u0001\u00de\u0005\u00de\u0a99\b\u00de\n\u00de\f\u00de"+ - "\u0a9c\t\u00de\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df"+ - "\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df"+ - "\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df\u0001\u00df\u0005\u00df"+ - "\u0aae\b\u00df\n\u00df\f\u00df\u0ab1\t\u00df\u0001\u00e0\u0001\u00e0\u0001"+ - "\u00e0\u0001\u00e0\u0001\u00e0\u0001\u00e0\u0001\u00e0\u0001\u00e0\u0001"+ - "\u00e0\u0005\u00e0\u0abc\b\u00e0\n\u00e0\f\u00e0\u0abf\t\u00e0\u0001\u00e1"+ - "\u0001\u00e1\u0001\u00e1\u0001\u00e1\u0001\u00e1\u0001\u00e1\u0001\u00e1"+ - "\u0001\u00e1\u0001\u00e1\u0001\u00e1\u0001\u00e1\u0001\u00e1\u0005\u00e1"+ - "\u0acd\b\u00e1\n\u00e1\f\u00e1\u0ad0\t\u00e1\u0001\u00e2\u0001\u00e2\u0001"+ - "\u00e2\u0001\u00e2\u0001\u00e2\u0001\u00e2\u0001\u00e2\u0003\u00e2\u0ad9"+ - "\b\u00e2\u0001\u00e3\u0001\u00e3\u0001\u00e3\u0001\u00e4\u0001\u00e4\u0001"+ - "\u00e4\u0001\u00e5\u0001\u00e5\u0001\u00e5\u0001\u00e5\u0001\u00e5\u0001"+ - "\u00e5\u0003\u00e5\u0ae7\b\u00e5\u0001\u00e6\u0001\u00e6\u0003\u00e6\u0aeb"+ - "\b\u00e6\u0001\u00e6\u0001\u00e6\u0005\u00e6\u0aef\b\u00e6\n\u00e6\f\u00e6"+ - "\u0af2\t\u00e6\u0001\u00e7\u0001\u00e7\u0001\u00e7\u0001\u00e8\u0001\u00e8"+ - "\u0001\u00e9\u0001\u00e9\u0001\u00e9\u0001\u00ea\u0001\u00ea\u0001\u00eb"+ - "\u0001\u00eb\u0001\u00eb\u0001\u00eb\u0001\u00eb\u0001\u00eb\u0001\u00eb"+ - "\u0001\u00eb\u0005\u00eb\u0b06\b\u00eb\n\u00eb\f\u00eb\u0b09\t\u00eb\u0001"+ - "\u00eb\u0001\u00eb\u0001\u00eb\u0001\u00eb\u0001\u00eb\u0001\u00eb\u0005"+ - "\u00eb\u0b11\b\u00eb\n\u00eb\f\u00eb\u0b14\t\u00eb\u0001\u00eb\u0001\u00eb"+ - "\u0001\u00eb\u0003\u00eb\u0b19\b\u00eb\u0001\u00eb\u0000\r26<\u01b0\u01b2"+ - "\u01b4\u01b6\u01b8\u01ba\u01bc\u01be\u01c0\u01c2\u00ec\u0000\u0002\u0004"+ - "\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a\u001c\u001e \""+ - "$&(*,.02468:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086"+ - "\u0088\u008a\u008c\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e"+ - "\u00a0\u00a2\u00a4\u00a6\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6"+ - "\u00b8\u00ba\u00bc\u00be\u00c0\u00c2\u00c4\u00c6\u00c8\u00ca\u00cc\u00ce"+ - "\u00d0\u00d2\u00d4\u00d6\u00d8\u00da\u00dc\u00de\u00e0\u00e2\u00e4\u00e6"+ - "\u00e8\u00ea\u00ec\u00ee\u00f0\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe"+ - "\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116"+ - "\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e"+ - "\u0130\u0132\u0134\u0136\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146"+ - "\u0148\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e"+ - "\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176"+ - "\u0178\u017a\u017c\u017e\u0180\u0182\u0184\u0186\u0188\u018a\u018c\u018e"+ - "\u0190\u0192\u0194\u0196\u0198\u019a\u019c\u019e\u01a0\u01a2\u01a4\u01a6"+ - "\u01a8\u01aa\u01ac\u01ae\u01b0\u01b2\u01b4\u01b6\u01b8\u01ba\u01bc\u01be"+ - "\u01c0\u01c2\u01c4\u01c6\u01c8\u01ca\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6"+ - "\u0000\u0004\u0001\u000038\u0005\u0000\u0005\u0005\b\b\u001b\u001b\u001d"+ - "\u001d%%\u0002\u0000\u000e\u000e\u0014\u0014\u0002\u0000BB[e\u0c0c\u0000"+ - "\u01d8\u0001\u0000\u0000\u0000\u0002\u01e8\u0001\u0000\u0000\u0000\u0004"+ - "\u01ec\u0001\u0000\u0000\u0000\u0006\u01ee\u0001\u0000\u0000\u0000\b\u01f0"+ - "\u0001\u0000\u0000\u0000\n\u01f5\u0001\u0000\u0000\u0000\f\u01f9\u0001"+ - "\u0000\u0000\u0000\u000e\u0218\u0001\u0000\u0000\u0000\u0010\u021a\u0001"+ - "\u0000\u0000\u0000\u0012\u0228\u0001\u0000\u0000\u0000\u0014\u022f\u0001"+ - "\u0000\u0000\u0000\u0016\u0231\u0001\u0000\u0000\u0000\u0018\u0233\u0001"+ - "\u0000\u0000\u0000\u001a\u0238\u0001\u0000\u0000\u0000\u001c\u0246\u0001"+ - "\u0000\u0000\u0000\u001e\u024b\u0001\u0000\u0000\u0000 \u0260\u0001\u0000"+ - "\u0000\u0000\"\u0267\u0001\u0000\u0000\u0000$\u0273\u0001\u0000\u0000"+ - "\u0000&\u0275\u0001\u0000\u0000\u0000(\u0278\u0001\u0000\u0000\u0000*"+ - "\u027c\u0001\u0000\u0000\u0000,\u0286\u0001\u0000\u0000\u0000.\u028b\u0001"+ - "\u0000\u0000\u00000\u0296\u0001\u0000\u0000\u00002\u0298\u0001\u0000\u0000"+ - "\u00004\u02a8\u0001\u0000\u0000\u00006\u02aa\u0001\u0000\u0000\u00008"+ - "\u02ba\u0001\u0000\u0000\u0000:\u02bc\u0001\u0000\u0000\u0000<\u02be\u0001"+ - "\u0000\u0000\u0000>\u02ca\u0001\u0000\u0000\u0000@\u02dd\u0001\u0000\u0000"+ - "\u0000B\u02e4\u0001\u0000\u0000\u0000D\u02ea\u0001\u0000\u0000\u0000F"+ - "\u02ec\u0001\u0000\u0000\u0000H\u02f0\u0001\u0000\u0000\u0000J\u02f6\u0001"+ - "\u0000\u0000\u0000L\u02fd\u0001\u0000\u0000\u0000N\u0307\u0001\u0000\u0000"+ - "\u0000P\u030b\u0001\u0000\u0000\u0000R\u0310\u0001\u0000\u0000\u0000T"+ - "\u0328\u0001\u0000\u0000\u0000V\u032a\u0001\u0000\u0000\u0000X\u032e\u0001"+ - "\u0000\u0000\u0000Z\u0336\u0001\u0000\u0000\u0000\\\u0339\u0001\u0000"+ - "\u0000\u0000^\u033c\u0001\u0000\u0000\u0000`\u0344\u0001\u0000\u0000\u0000"+ - "b\u0351\u0001\u0000\u0000\u0000d\u0358\u0001\u0000\u0000\u0000f\u035d"+ - "\u0001\u0000\u0000\u0000h\u036c\u0001\u0000\u0000\u0000j\u036e\u0001\u0000"+ - "\u0000\u0000l\u0376\u0001\u0000\u0000\u0000n\u037b\u0001\u0000\u0000\u0000"+ - "p\u0381\u0001\u0000\u0000\u0000r\u0385\u0001\u0000\u0000\u0000t\u0389"+ - "\u0001\u0000\u0000\u0000v\u038e\u0001\u0000\u0000\u0000x\u0392\u0001\u0000"+ - "\u0000\u0000z\u03ab\u0001\u0000\u0000\u0000|\u03ad\u0001\u0000\u0000\u0000"+ - "~\u03b8\u0001\u0000\u0000\u0000\u0080\u03bc\u0001\u0000\u0000\u0000\u0082"+ - "\u03be\u0001\u0000\u0000\u0000\u0084\u03c0\u0001\u0000\u0000\u0000\u0086"+ - "\u03c2\u0001\u0000\u0000\u0000\u0088\u03cd\u0001\u0000\u0000\u0000\u008a"+ - "\u03d2\u0001\u0000\u0000\u0000\u008c\u03e2\u0001\u0000\u0000\u0000\u008e"+ - "\u03f5\u0001\u0000\u0000\u0000\u0090\u03f9\u0001\u0000\u0000\u0000\u0092"+ - "\u03fb\u0001\u0000\u0000\u0000\u0094\u040a\u0001\u0000\u0000\u0000\u0096"+ - "\u041c\u0001\u0000\u0000\u0000\u0098\u0421\u0001\u0000\u0000\u0000\u009a"+ - "\u0429\u0001\u0000\u0000\u0000\u009c\u043c\u0001\u0000\u0000\u0000\u009e"+ - "\u0441\u0001\u0000\u0000\u0000\u00a0\u044b\u0001\u0000\u0000\u0000\u00a2"+ - "\u044e\u0001\u0000\u0000\u0000\u00a4\u0458\u0001\u0000\u0000\u0000\u00a6"+ - "\u045c\u0001\u0000\u0000\u0000\u00a8\u045e\u0001\u0000\u0000\u0000\u00aa"+ - "\u0460\u0001\u0000\u0000\u0000\u00ac\u0466\u0001\u0000\u0000\u0000\u00ae"+ - "\u0473\u0001\u0000\u0000\u0000\u00b0\u0476\u0001\u0000\u0000\u0000\u00b2"+ - "\u047f\u0001\u0000\u0000\u0000\u00b4\u0481\u0001\u0000\u0000\u0000\u00b6"+ - "\u04b8\u0001\u0000\u0000\u0000\u00b8\u04bd\u0001\u0000\u0000\u0000\u00ba"+ - "\u04c7\u0001\u0000\u0000\u0000\u00bc\u04d3\u0001\u0000\u0000\u0000\u00be"+ - "\u04de\u0001\u0000\u0000\u0000\u00c0\u04ec\u0001\u0000\u0000\u0000\u00c2"+ - "\u04ee\u0001\u0000\u0000\u0000\u00c4\u04f7\u0001\u0000\u0000\u0000\u00c6"+ - "\u04fc\u0001\u0000\u0000\u0000\u00c8\u0510\u0001\u0000\u0000\u0000\u00ca"+ - "\u0512\u0001\u0000\u0000\u0000\u00cc\u0515\u0001\u0000\u0000\u0000\u00ce"+ - "\u0523\u0001\u0000\u0000\u0000\u00d0\u0528\u0001\u0000\u0000\u0000\u00d2"+ - "\u0533\u0001\u0000\u0000\u0000\u00d4\u0538\u0001\u0000\u0000\u0000\u00d6"+ - "\u0544\u0001\u0000\u0000\u0000\u00d8\u0549\u0001\u0000\u0000\u0000\u00da"+ - "\u0551\u0001\u0000\u0000\u0000\u00dc\u055f\u0001\u0000\u0000\u0000\u00de"+ - "\u0564\u0001\u0000\u0000\u0000\u00e0\u0576\u0001\u0000\u0000\u0000\u00e2"+ - "\u0578\u0001\u0000\u0000\u0000\u00e4\u057e\u0001\u0000\u0000\u0000\u00e6"+ - "\u0580\u0001\u0000\u0000\u0000\u00e8\u0588\u0001\u0000\u0000\u0000\u00ea"+ - "\u0590\u0001\u0000\u0000\u0000\u00ec\u0597\u0001\u0000\u0000\u0000\u00ee"+ - "\u0599\u0001\u0000\u0000\u0000\u00f0\u05a2\u0001\u0000\u0000\u0000\u00f2"+ - "\u05aa\u0001\u0000\u0000\u0000\u00f4\u05ad\u0001\u0000\u0000\u0000\u00f6"+ - "\u05b3\u0001\u0000\u0000\u0000\u00f8\u05bc\u0001\u0000\u0000\u0000\u00fa"+ - "\u05c4\u0001\u0000\u0000\u0000\u00fc\u05cb\u0001\u0000\u0000\u0000\u00fe"+ - "\u05d2\u0001\u0000\u0000\u0000\u0100\u05d4\u0001\u0000\u0000\u0000\u0102"+ - "\u05da\u0001\u0000\u0000\u0000\u0104\u05e6\u0001\u0000\u0000\u0000\u0106"+ - "\u05ed\u0001\u0000\u0000\u0000\u0108\u05fb\u0001\u0000\u0000\u0000\u010a"+ - "\u05fd\u0001\u0000\u0000\u0000\u010c\u05ff\u0001\u0000\u0000\u0000\u010e"+ - "\u0603\u0001\u0000\u0000\u0000\u0110\u0607\u0001\u0000\u0000\u0000\u0112"+ - "\u0611\u0001\u0000\u0000\u0000\u0114\u0613\u0001\u0000\u0000\u0000\u0116"+ - "\u0619\u0001\u0000\u0000\u0000\u0118\u0621\u0001\u0000\u0000\u0000\u011a"+ - "\u0633\u0001\u0000\u0000\u0000\u011c\u0635\u0001\u0000\u0000\u0000\u011e"+ - "\u063b\u0001\u0000\u0000\u0000\u0120\u064a\u0001\u0000\u0000\u0000\u0122"+ - "\u064d\u0001\u0000\u0000\u0000\u0124\u065e\u0001\u0000\u0000\u0000\u0126"+ - "\u0660\u0001\u0000\u0000\u0000\u0128\u0662\u0001\u0000\u0000\u0000\u012a"+ - "\u0668\u0001\u0000\u0000\u0000\u012c\u066e\u0001\u0000\u0000\u0000\u012e"+ - "\u0678\u0001\u0000\u0000\u0000\u0130\u067c\u0001\u0000\u0000\u0000\u0132"+ - "\u067e\u0001\u0000\u0000\u0000\u0134\u068e\u0001\u0000\u0000\u0000\u0136"+ - "\u06a0\u0001\u0000\u0000\u0000\u0138\u06a2\u0001\u0000\u0000\u0000\u013a"+ - "\u06a4\u0001\u0000\u0000\u0000\u013c\u06ac\u0001\u0000\u0000\u0000\u013e"+ - "\u06bb\u0001\u0000\u0000\u0000\u0140\u06ca\u0001\u0000\u0000\u0000\u0142"+ - "\u06d0\u0001\u0000\u0000\u0000\u0144\u06d6\u0001\u0000\u0000\u0000\u0146"+ - "\u06dc\u0001\u0000\u0000\u0000\u0148\u06e0\u0001\u0000\u0000\u0000\u014a"+ - "\u06f2\u0001\u0000\u0000\u0000\u014c\u06f4\u0001\u0000\u0000\u0000\u014e"+ - "\u06fb\u0001\u0000\u0000\u0000\u0150\u0704\u0001\u0000\u0000\u0000\u0152"+ - "\u070a\u0001\u0000\u0000\u0000\u0154\u0712\u0001\u0000\u0000\u0000\u0156"+ - "\u0715\u0001\u0000\u0000\u0000\u0158\u071e\u0001\u0000\u0000\u0000\u015a"+ - "\u0725\u0001\u0000\u0000\u0000\u015c\u0730\u0001\u0000\u0000\u0000\u015e"+ - "\u073a\u0001\u0000\u0000\u0000\u0160\u075f\u0001\u0000\u0000\u0000\u0162"+ - "\u0761\u0001\u0000\u0000\u0000\u0164\u077f\u0001\u0000\u0000\u0000\u0166"+ - "\u0786\u0001\u0000\u0000\u0000\u0168\u0788\u0001\u0000\u0000\u0000\u016a"+ - "\u078e\u0001\u0000\u0000\u0000\u016c\u07b8\u0001\u0000\u0000\u0000\u016e"+ - "\u07ba\u0001\u0000\u0000\u0000\u0170\u07e3\u0001\u0000\u0000\u0000\u0172"+ - "\u0838\u0001\u0000\u0000\u0000\u0174\u083a\u0001\u0000\u0000\u0000\u0176"+ - "\u088c\u0001\u0000\u0000\u0000\u0178\u0891\u0001\u0000\u0000\u0000\u017a"+ - "\u08a0\u0001\u0000\u0000\u0000\u017c\u08a2\u0001\u0000\u0000\u0000\u017e"+ - "\u08ae\u0001\u0000\u0000\u0000\u0180\u08ba\u0001\u0000\u0000\u0000\u0182"+ - "\u08c6\u0001\u0000\u0000\u0000\u0184\u08de\u0001\u0000\u0000\u0000\u0186"+ - "\u092e\u0001\u0000\u0000\u0000\u0188\u0930\u0001\u0000\u0000\u0000\u018a"+ - "\u0973\u0001\u0000\u0000\u0000\u018c\u0975\u0001\u0000\u0000\u0000\u018e"+ - "\u09ac\u0001\u0000\u0000\u0000\u0190\u09ae\u0001\u0000\u0000\u0000\u0192"+ - "\u09dc\u0001\u0000\u0000\u0000\u0194\u09f4\u0001\u0000\u0000\u0000\u0196"+ - "\u09f6\u0001\u0000\u0000\u0000\u0198\u0a00\u0001\u0000\u0000\u0000\u019a"+ - "\u0a07\u0001\u0000\u0000\u0000\u019c\u0a0b\u0001\u0000\u0000\u0000\u019e"+ - "\u0a0d\u0001\u0000\u0000\u0000\u01a0\u0a1b\u0001\u0000\u0000\u0000\u01a2"+ - "\u0a1d\u0001\u0000\u0000\u0000\u01a4\u0a27\u0001\u0000\u0000\u0000\u01a6"+ - "\u0a2b\u0001\u0000\u0000\u0000\u01a8\u0a2d\u0001\u0000\u0000\u0000\u01aa"+ - "\u0a34\u0001\u0000\u0000\u0000\u01ac\u0a36\u0001\u0000\u0000\u0000\u01ae"+ - "\u0a3f\u0001\u0000\u0000\u0000\u01b0\u0a41\u0001\u0000\u0000\u0000\u01b2"+ - "\u0a4c\u0001\u0000\u0000\u0000\u01b4\u0a57\u0001\u0000\u0000\u0000\u01b6"+ - "\u0a62\u0001\u0000\u0000\u0000\u01b8\u0a6d\u0001\u0000\u0000\u0000\u01ba"+ - "\u0a78\u0001\u0000\u0000\u0000\u01bc\u0a86\u0001\u0000\u0000\u0000\u01be"+ - "\u0a9d\u0001\u0000\u0000\u0000\u01c0\u0ab2\u0001\u0000\u0000\u0000\u01c2"+ - "\u0ac0\u0001\u0000\u0000\u0000\u01c4\u0ad8\u0001\u0000\u0000\u0000\u01c6"+ - "\u0ada\u0001\u0000\u0000\u0000\u01c8\u0add\u0001\u0000\u0000\u0000\u01ca"+ - "\u0ae6\u0001\u0000\u0000\u0000\u01cc\u0aea\u0001\u0000\u0000\u0000\u01ce"+ - "\u0af3\u0001\u0000\u0000\u0000\u01d0\u0af6\u0001\u0000\u0000\u0000\u01d2"+ - "\u0af8\u0001\u0000\u0000\u0000\u01d4\u0afb\u0001\u0000\u0000\u0000\u01d6"+ - "\u0b18\u0001\u0000\u0000\u0000\u01d8\u01d9\u0007\u0000\u0000\u0000\u01d9"+ - "\u0001\u0001\u0000\u0000\u0000\u01da\u01dc\u0003\u00e4r\u0000\u01db\u01da"+ - "\u0001\u0000\u0000\u0000\u01dc\u01df\u0001\u0000\u0000\u0000\u01dd\u01db"+ - "\u0001\u0000\u0000\u0000\u01dd\u01de\u0001\u0000\u0000\u0000\u01de\u01e0"+ - "\u0001\u0000\u0000\u0000\u01df\u01dd\u0001\u0000\u0000\u0000\u01e0\u01e9"+ - "\u0003\u0004\u0002\u0000\u01e1\u01e3\u0003\u00e4r\u0000\u01e2\u01e1\u0001"+ - "\u0000\u0000\u0000\u01e3\u01e6\u0001\u0000\u0000\u0000\u01e4\u01e2\u0001"+ - "\u0000\u0000\u0000\u01e4\u01e5\u0001\u0000\u0000\u0000\u01e5\u01e7\u0001"+ - "\u0000\u0000\u0000\u01e6\u01e4\u0001\u0000\u0000\u0000\u01e7\u01e9\u0005"+ - "\u0003\u0000\u0000\u01e8\u01dd\u0001\u0000\u0000\u0000\u01e8\u01e4\u0001"+ - "\u0000\u0000\u0000\u01e9\u0003\u0001\u0000\u0000\u0000\u01ea\u01ed\u0003"+ - "\u0006\u0003\u0000\u01eb\u01ed\u0003\b\u0004\u0000\u01ec\u01ea\u0001\u0000"+ - "\u0000\u0000\u01ec\u01eb\u0001\u0000\u0000\u0000\u01ed\u0005\u0001\u0000"+ - "\u0000\u0000\u01ee\u01ef\u0007\u0001\u0000\u0000\u01ef\u0007\u0001\u0000"+ - "\u0000\u0000\u01f0\u01f1\u0007\u0002\u0000\u0000\u01f1\t\u0001\u0000\u0000"+ - "\u0000\u01f2\u01f6\u0003\f\u0006\u0000\u01f3\u01f6\u0003\u001a\r\u0000"+ - "\u01f4\u01f6\u0003\u001c\u000e\u0000\u01f5\u01f2\u0001\u0000\u0000\u0000"+ - "\u01f5\u01f3\u0001\u0000\u0000\u0000\u01f5\u01f4\u0001\u0000\u0000\u0000"+ - "\u01f6\u000b\u0001\u0000\u0000\u0000\u01f7\u01fa\u0003\u0012\t\u0000\u01f8"+ - "\u01fa\u0003\u0018\f\u0000\u01f9\u01f7\u0001\u0000\u0000\u0000\u01f9\u01f8"+ - "\u0001\u0000\u0000\u0000\u01fa\u01ff\u0001\u0000\u0000\u0000\u01fb\u01fe"+ - "\u0003\u0010\b\u0000\u01fc\u01fe\u0003\u0016\u000b\u0000\u01fd\u01fb\u0001"+ - "\u0000\u0000\u0000\u01fd\u01fc\u0001\u0000\u0000\u0000\u01fe\u0201\u0001"+ - "\u0000\u0000\u0000\u01ff\u01fd\u0001\u0000\u0000\u0000\u01ff\u0200\u0001"+ - "\u0000\u0000\u0000\u0200\r\u0001\u0000\u0000\u0000\u0201\u01ff\u0001\u0000"+ - "\u0000\u0000\u0202\u0204\u0003\u00e4r\u0000\u0203\u0202\u0001\u0000\u0000"+ - "\u0000\u0204\u0207\u0001\u0000\u0000\u0000\u0205\u0203\u0001\u0000\u0000"+ - "\u0000\u0205\u0206\u0001\u0000\u0000\u0000\u0206\u0208\u0001\u0000\u0000"+ - "\u0000\u0207\u0205\u0001\u0000\u0000\u0000\u0208\u020a\u0005f\u0000\u0000"+ - "\u0209\u020b\u0003(\u0014\u0000\u020a\u0209\u0001\u0000\u0000\u0000\u020a"+ - "\u020b\u0001\u0000\u0000\u0000\u020b\u0219\u0001\u0000\u0000\u0000\u020c"+ - "\u020d\u0003\f\u0006\u0000\u020d\u0211\u0005A\u0000\u0000\u020e\u0210"+ - "\u0003\u00e4r\u0000\u020f\u020e\u0001\u0000\u0000\u0000\u0210\u0213\u0001"+ - "\u0000\u0000\u0000\u0211\u020f\u0001\u0000\u0000\u0000\u0211\u0212\u0001"+ - "\u0000\u0000\u0000\u0212\u0214\u0001\u0000\u0000\u0000\u0213\u0211\u0001"+ - "\u0000\u0000\u0000\u0214\u0216\u0005f\u0000\u0000\u0215\u0217\u0003(\u0014"+ - "\u0000\u0216\u0215\u0001\u0000\u0000\u0000\u0216\u0217\u0001\u0000\u0000"+ - "\u0000\u0217\u0219\u0001\u0000\u0000\u0000\u0218\u0205\u0001\u0000\u0000"+ - "\u0000\u0218\u020c\u0001\u0000\u0000\u0000\u0219\u000f\u0001\u0000\u0000"+ - "\u0000\u021a\u021e\u0005A\u0000\u0000\u021b\u021d\u0003\u00e4r\u0000\u021c"+ - "\u021b\u0001\u0000\u0000\u0000\u021d\u0220\u0001\u0000\u0000\u0000\u021e"+ - "\u021c\u0001\u0000\u0000\u0000\u021e\u021f\u0001\u0000\u0000\u0000\u021f"+ - "\u0221\u0001\u0000\u0000\u0000\u0220\u021e\u0001\u0000\u0000\u0000\u0221"+ - "\u0223\u0005f\u0000\u0000\u0222\u0224\u0003(\u0014\u0000\u0223\u0222\u0001"+ - "\u0000\u0000\u0000\u0223\u0224\u0001\u0000\u0000\u0000\u0224\u0011\u0001"+ - "\u0000\u0000\u0000\u0225\u0227\u0003\u00e4r\u0000\u0226\u0225\u0001\u0000"+ - "\u0000\u0000\u0227\u022a\u0001\u0000\u0000\u0000\u0228\u0226\u0001\u0000"+ - "\u0000\u0000\u0228\u0229\u0001\u0000\u0000\u0000\u0229\u022b\u0001\u0000"+ - "\u0000\u0000\u022a\u0228\u0001\u0000\u0000\u0000\u022b\u022d\u0005f\u0000"+ - "\u0000\u022c\u022e\u0003(\u0014\u0000\u022d\u022c\u0001\u0000\u0000\u0000"+ - "\u022d\u022e\u0001\u0000\u0000\u0000\u022e\u0013\u0001\u0000\u0000\u0000"+ - "\u022f\u0230\u0003\u000e\u0007\u0000\u0230\u0015\u0001\u0000\u0000\u0000"+ - "\u0231\u0232\u0003\u0010\b\u0000\u0232\u0017\u0001\u0000\u0000\u0000\u0233"+ - "\u0234\u0003\u0012\t\u0000\u0234\u0019\u0001\u0000\u0000\u0000\u0235\u0237"+ - "\u0003\u00e4r\u0000\u0236\u0235\u0001\u0000\u0000\u0000\u0237\u023a\u0001"+ - "\u0000\u0000\u0000\u0238\u0236\u0001\u0000\u0000\u0000\u0238\u0239\u0001"+ - "\u0000\u0000\u0000\u0239\u023b\u0001\u0000\u0000\u0000\u023a\u0238\u0001"+ - "\u0000\u0000\u0000\u023b\u023c\u0005f\u0000\u0000\u023c\u001b\u0001\u0000"+ - "\u0000\u0000\u023d\u023e\u0003\u0002\u0001\u0000\u023e\u023f\u0003\u001e"+ - "\u000f\u0000\u023f\u0247\u0001\u0000\u0000\u0000\u0240\u0241\u0003\f\u0006"+ - "\u0000\u0241\u0242\u0003\u001e\u000f\u0000\u0242\u0247\u0001\u0000\u0000"+ - "\u0000\u0243\u0244\u0003\u001a\r\u0000\u0244\u0245\u0003\u001e\u000f\u0000"+ - "\u0245\u0247\u0001\u0000\u0000\u0000\u0246\u023d\u0001\u0000\u0000\u0000"+ - "\u0246\u0240\u0001\u0000\u0000\u0000\u0246\u0243\u0001\u0000\u0000\u0000"+ - "\u0247\u001d\u0001\u0000\u0000\u0000\u0248\u024a\u0003\u00e4r\u0000\u0249"+ - "\u0248\u0001\u0000\u0000\u0000\u024a\u024d\u0001\u0000\u0000\u0000\u024b"+ - "\u0249\u0001\u0000\u0000\u0000\u024b\u024c\u0001\u0000\u0000\u0000\u024c"+ - "\u024e\u0001\u0000\u0000\u0000\u024d\u024b\u0001\u0000\u0000\u0000\u024e"+ - "\u024f\u0005=\u0000\u0000\u024f\u025a\u0005>\u0000\u0000\u0250\u0252\u0003"+ - "\u00e4r\u0000\u0251\u0250\u0001\u0000\u0000\u0000\u0252\u0255\u0001\u0000"+ - "\u0000\u0000\u0253\u0251\u0001\u0000\u0000\u0000\u0253\u0254\u0001\u0000"+ - "\u0000\u0000\u0254\u0256\u0001\u0000\u0000\u0000\u0255\u0253\u0001\u0000"+ - "\u0000\u0000\u0256\u0257\u0005=\u0000\u0000\u0257\u0259\u0005>\u0000\u0000"+ - "\u0258\u0253\u0001\u0000\u0000\u0000\u0259\u025c\u0001\u0000\u0000\u0000"+ - "\u025a\u0258\u0001\u0000\u0000\u0000\u025a\u025b\u0001\u0000\u0000\u0000"+ - "\u025b\u001f\u0001\u0000\u0000\u0000\u025c\u025a\u0001\u0000\u0000\u0000"+ - "\u025d\u025f\u0003\"\u0011\u0000\u025e\u025d\u0001\u0000\u0000\u0000\u025f"+ - "\u0262\u0001\u0000\u0000\u0000\u0260\u025e\u0001\u0000\u0000\u0000\u0260"+ - "\u0261\u0001\u0000\u0000\u0000\u0261\u0263\u0001\u0000\u0000\u0000\u0262"+ - "\u0260\u0001\u0000\u0000\u0000\u0263\u0265\u0005f\u0000\u0000\u0264\u0266"+ - "\u0003$\u0012\u0000\u0265\u0264\u0001\u0000\u0000\u0000\u0265\u0266\u0001"+ - "\u0000\u0000\u0000\u0266!\u0001\u0000\u0000\u0000\u0267\u0268\u0003\u00e4"+ - "r\u0000\u0268#\u0001\u0000\u0000\u0000\u0269\u026a\u0005\u0011\u0000\u0000"+ - "\u026a\u0274\u0003\u001a\r\u0000\u026b\u026c\u0005\u0011\u0000\u0000\u026c"+ - "\u0270\u0003\f\u0006\u0000\u026d\u026f\u0003&\u0013\u0000\u026e\u026d"+ - "\u0001\u0000\u0000\u0000\u026f\u0272\u0001\u0000\u0000\u0000\u0270\u026e"+ - "\u0001\u0000\u0000\u0000\u0270\u0271\u0001\u0000\u0000\u0000\u0271\u0274"+ - "\u0001\u0000\u0000\u0000\u0272\u0270\u0001\u0000\u0000\u0000\u0273\u0269"+ - "\u0001\u0000\u0000\u0000\u0273\u026b\u0001\u0000\u0000\u0000\u0274%\u0001"+ - "\u0000\u0000\u0000\u0275\u0276\u0005U\u0000\u0000\u0276\u0277\u0003\u0014"+ - "\n\u0000\u0277\'\u0001\u0000\u0000\u0000\u0278\u0279\u0005D\u0000\u0000"+ - "\u0279\u027a\u0003*\u0015\u0000\u027a\u027b\u0005C\u0000\u0000\u027b)"+ - "\u0001\u0000\u0000\u0000\u027c\u0281\u0003,\u0016\u0000\u027d\u027e\u0005"+ - "@\u0000\u0000\u027e\u0280\u0003,\u0016\u0000\u027f\u027d\u0001\u0000\u0000"+ - "\u0000\u0280\u0283\u0001\u0000\u0000\u0000\u0281\u027f\u0001\u0000\u0000"+ - "\u0000\u0281\u0282\u0001\u0000\u0000\u0000\u0282+\u0001\u0000\u0000\u0000"+ - "\u0283\u0281\u0001\u0000\u0000\u0000\u0284\u0287\u0003\n\u0005\u0000\u0285"+ - "\u0287\u0003.\u0017\u0000\u0286\u0284\u0001\u0000\u0000\u0000\u0286\u0285"+ - "\u0001\u0000\u0000\u0000\u0287-\u0001\u0000\u0000\u0000\u0288\u028a\u0003"+ - "\u00e4r\u0000\u0289\u0288\u0001\u0000\u0000\u0000\u028a\u028d\u0001\u0000"+ - "\u0000\u0000\u028b\u0289\u0001\u0000\u0000\u0000\u028b\u028c\u0001\u0000"+ - "\u0000\u0000\u028c\u028e\u0001\u0000\u0000\u0000\u028d\u028b\u0001\u0000"+ - "\u0000\u0000\u028e\u0290\u0005G\u0000\u0000\u028f\u0291\u00030\u0018\u0000"+ - "\u0290\u028f\u0001\u0000\u0000\u0000\u0290\u0291\u0001\u0000\u0000\u0000"+ - "\u0291/\u0001\u0000\u0000\u0000\u0292\u0293\u0005\u0011\u0000\u0000\u0293"+ - "\u0297\u0003\n\u0005\u0000\u0294\u0295\u0005(\u0000\u0000\u0295\u0297"+ - "\u0003\n\u0005\u0000\u0296\u0292\u0001\u0000\u0000\u0000\u0296\u0294\u0001"+ - "\u0000\u0000\u0000\u02971\u0001\u0000\u0000\u0000\u0298\u0299\u0006\u0019"+ - "\uffff\uffff\u0000\u0299\u029a\u0005f\u0000\u0000\u029a\u02a0\u0001\u0000"+ - "\u0000\u0000\u029b\u029c\n\u0001\u0000\u0000\u029c\u029d\u0005A\u0000"+ - "\u0000\u029d\u029f\u0005f\u0000\u0000\u029e\u029b\u0001\u0000\u0000\u0000"+ - "\u029f\u02a2\u0001\u0000\u0000\u0000\u02a0\u029e\u0001\u0000\u0000\u0000"+ - "\u02a0\u02a1\u0001\u0000\u0000\u0000\u02a13\u0001\u0000\u0000\u0000\u02a2"+ - "\u02a0\u0001\u0000\u0000\u0000\u02a3\u02a9\u0005f\u0000\u0000\u02a4\u02a5"+ - "\u00036\u001b\u0000\u02a5\u02a6\u0005A\u0000\u0000\u02a6\u02a7\u0005f"+ - "\u0000\u0000\u02a7\u02a9\u0001\u0000\u0000\u0000\u02a8\u02a3\u0001\u0000"+ - "\u0000\u0000\u02a8\u02a4\u0001\u0000\u0000\u0000\u02a95\u0001\u0000\u0000"+ - "\u0000\u02aa\u02ab\u0006\u001b\uffff\uffff\u0000\u02ab\u02ac\u0005f\u0000"+ - "\u0000\u02ac\u02b2\u0001\u0000\u0000\u0000\u02ad\u02ae\n\u0001\u0000\u0000"+ - "\u02ae\u02af\u0005A\u0000\u0000\u02af\u02b1\u0005f\u0000\u0000\u02b0\u02ad"+ - "\u0001\u0000\u0000\u0000\u02b1\u02b4\u0001\u0000\u0000\u0000\u02b2\u02b0"+ - "\u0001\u0000\u0000\u0000\u02b2\u02b3\u0001\u0000\u0000\u0000\u02b37\u0001"+ - "\u0000\u0000\u0000\u02b4\u02b2\u0001\u0000\u0000\u0000\u02b5\u02bb\u0005"+ - "f\u0000\u0000\u02b6\u02b7\u0003<\u001e\u0000\u02b7\u02b8\u0005A\u0000"+ - "\u0000\u02b8\u02b9\u0005f\u0000\u0000\u02b9\u02bb\u0001\u0000\u0000\u0000"+ - "\u02ba\u02b5\u0001\u0000\u0000\u0000\u02ba\u02b6\u0001\u0000\u0000\u0000"+ - "\u02bb9\u0001\u0000\u0000\u0000\u02bc\u02bd\u0005f\u0000\u0000\u02bd;"+ - "\u0001\u0000\u0000\u0000\u02be\u02bf\u0006\u001e\uffff\uffff\u0000\u02bf"+ - "\u02c0\u0005f\u0000\u0000\u02c0\u02c6\u0001\u0000\u0000\u0000\u02c1\u02c2"+ - "\n\u0001\u0000\u0000\u02c2\u02c3\u0005A\u0000\u0000\u02c3\u02c5\u0005"+ - "f\u0000\u0000\u02c4\u02c1\u0001\u0000\u0000\u0000\u02c5\u02c8\u0001\u0000"+ - "\u0000\u0000\u02c6\u02c4\u0001\u0000\u0000\u0000\u02c6\u02c7\u0001\u0000"+ - "\u0000\u0000\u02c7=\u0001\u0000\u0000\u0000\u02c8\u02c6\u0001\u0000\u0000"+ - "\u0000\u02c9\u02cb\u0003@ \u0000\u02ca\u02c9\u0001\u0000\u0000\u0000\u02ca"+ - "\u02cb\u0001\u0000\u0000\u0000\u02cb\u02cf\u0001\u0000\u0000\u0000\u02cc"+ - "\u02ce\u0003D\"\u0000\u02cd\u02cc\u0001\u0000\u0000\u0000\u02ce\u02d1"+ - "\u0001\u0000\u0000\u0000\u02cf\u02cd\u0001\u0000\u0000\u0000\u02cf\u02d0"+ - "\u0001\u0000\u0000\u0000\u02d0\u02d5\u0001\u0000\u0000\u0000\u02d1\u02cf"+ - "\u0001\u0000\u0000\u0000\u02d2\u02d4\u0003N\'\u0000\u02d3\u02d2\u0001"+ - "\u0000\u0000\u0000\u02d4\u02d7\u0001\u0000\u0000\u0000\u02d5\u02d3\u0001"+ - "\u0000\u0000\u0000\u02d5\u02d6\u0001\u0000\u0000\u0000\u02d6\u02d8\u0001"+ - "\u0000\u0000\u0000\u02d7\u02d5\u0001\u0000\u0000\u0000\u02d8\u02d9\u0005"+ - "\u0000\u0000\u0001\u02d9?\u0001\u0000\u0000\u0000\u02da\u02dc\u0003B!"+ - "\u0000\u02db\u02da\u0001\u0000\u0000\u0000\u02dc\u02df\u0001\u0000\u0000"+ - "\u0000\u02dd\u02db\u0001\u0000\u0000\u0000\u02dd\u02de\u0001\u0000\u0000"+ - "\u0000\u02de\u02e0\u0001\u0000\u0000\u0000\u02df\u02dd\u0001\u0000\u0000"+ - "\u0000\u02e0\u02e1\u0005 \u0000\u0000\u02e1\u02e2\u00032\u0019\u0000\u02e2"+ - "\u02e3\u0005?\u0000\u0000\u02e3A\u0001\u0000\u0000\u0000\u02e4\u02e5\u0003"+ - "\u00e4r\u0000\u02e5C\u0001\u0000\u0000\u0000\u02e6\u02eb\u0003F#\u0000"+ - "\u02e7\u02eb\u0003H$\u0000\u02e8\u02eb\u0003J%\u0000\u02e9\u02eb\u0003"+ - "L&\u0000\u02ea\u02e6\u0001\u0000\u0000\u0000\u02ea\u02e7\u0001\u0000\u0000"+ - "\u0000\u02ea\u02e8\u0001\u0000\u0000\u0000\u02ea\u02e9\u0001\u0000\u0000"+ - "\u0000\u02ebE\u0001\u0000\u0000\u0000\u02ec\u02ed\u0005\u0019\u0000\u0000"+ - "\u02ed\u02ee\u00034\u001a\u0000\u02ee\u02ef\u0005?\u0000\u0000\u02efG"+ - "\u0001\u0000\u0000\u0000\u02f0\u02f1\u0005\u0019\u0000\u0000\u02f1\u02f2"+ - "\u00036\u001b\u0000\u02f2\u02f3\u0005A\u0000\u0000\u02f3\u02f4\u0005S"+ - "\u0000\u0000\u02f4\u02f5\u0005?\u0000\u0000\u02f5I\u0001\u0000\u0000\u0000"+ - "\u02f6\u02f7\u0005\u0019\u0000\u0000\u02f7\u02f8\u0005&\u0000\u0000\u02f8"+ - "\u02f9\u00034\u001a\u0000\u02f9\u02fa\u0005A\u0000\u0000\u02fa\u02fb\u0005"+ - "f\u0000\u0000\u02fb\u02fc\u0005?\u0000\u0000\u02fcK\u0001\u0000\u0000"+ - "\u0000\u02fd\u02fe\u0005\u0019\u0000\u0000\u02fe\u02ff\u0005&\u0000\u0000"+ - "\u02ff\u0300\u00034\u001a\u0000\u0300\u0301\u0005A\u0000\u0000\u0301\u0302"+ - "\u0005S\u0000\u0000\u0302\u0303\u0005?\u0000\u0000\u0303M\u0001\u0000"+ - "\u0000\u0000\u0304\u0308\u0003P(\u0000\u0305\u0308\u0003\u00c4b\u0000"+ - "\u0306\u0308\u0005?\u0000\u0000\u0307\u0304\u0001\u0000\u0000\u0000\u0307"+ - "\u0305\u0001\u0000\u0000\u0000\u0307\u0306\u0001\u0000\u0000\u0000\u0308"+ - "O\u0001\u0000\u0000\u0000\u0309\u030c\u0003R)\u0000\u030a\u030c\u0003"+ - "\u00b8\\\u0000\u030b\u0309\u0001\u0000\u0000\u0000\u030b\u030a\u0001\u0000"+ - "\u0000\u0000\u030cQ\u0001\u0000\u0000\u0000\u030d\u030f\u0003T*\u0000"+ - "\u030e\u030d\u0001\u0000\u0000\u0000\u030f\u0312\u0001\u0000\u0000\u0000"+ - "\u0310\u030e\u0001\u0000\u0000\u0000\u0310\u0311\u0001\u0000\u0000\u0000"+ - "\u0311\u0313\u0001\u0000\u0000\u0000\u0312\u0310\u0001\u0000\u0000\u0000"+ - "\u0313\u0314\u0005\t\u0000\u0000\u0314\u0316\u0005f\u0000\u0000\u0315"+ - "\u0317\u0003V+\u0000\u0316\u0315\u0001\u0000\u0000\u0000\u0316\u0317\u0001"+ - "\u0000\u0000\u0000\u0317\u0319\u0001\u0000\u0000\u0000\u0318\u031a\u0003"+ - "Z-\u0000\u0319\u0318\u0001\u0000\u0000\u0000\u0319\u031a\u0001\u0000\u0000"+ - "\u0000\u031a\u031c\u0001\u0000\u0000\u0000\u031b\u031d\u0003\\.\u0000"+ - "\u031c\u031b\u0001\u0000\u0000\u0000\u031c\u031d\u0001\u0000\u0000\u0000"+ - "\u031d\u031e\u0001\u0000\u0000\u0000\u031e\u031f\u0003`0\u0000\u031fS"+ - "\u0001\u0000\u0000\u0000\u0320\u0329\u0003\u00e4r\u0000\u0321\u0329\u0005"+ - "#\u0000\u0000\u0322\u0329\u0005\"\u0000\u0000\u0323\u0329\u0005!\u0000"+ - "\u0000\u0324\u0329\u0005\u0001\u0000\u0000\u0325\u0329\u0005&\u0000\u0000"+ - "\u0326\u0329\u0005\u0012\u0000\u0000\u0327\u0329\u0005\'\u0000\u0000\u0328"+ - "\u0320\u0001\u0000\u0000\u0000\u0328\u0321\u0001\u0000\u0000\u0000\u0328"+ - "\u0322\u0001\u0000\u0000\u0000\u0328\u0323\u0001\u0000\u0000\u0000\u0328"+ - "\u0324\u0001\u0000\u0000\u0000\u0328\u0325\u0001\u0000\u0000\u0000\u0328"+ - "\u0326\u0001\u0000\u0000\u0000\u0328\u0327\u0001\u0000\u0000\u0000\u0329"+ - "U\u0001\u0000\u0000\u0000\u032a\u032b\u0005D\u0000\u0000\u032b\u032c\u0003"+ - "X,\u0000\u032c\u032d\u0005C\u0000\u0000\u032dW\u0001\u0000\u0000\u0000"+ - "\u032e\u0333\u0003 \u0010\u0000\u032f\u0330\u0005@\u0000\u0000\u0330\u0332"+ - "\u0003 \u0010\u0000\u0331\u032f\u0001\u0000\u0000\u0000\u0332\u0335\u0001"+ - "\u0000\u0000\u0000\u0333\u0331\u0001\u0000\u0000\u0000\u0333\u0334\u0001"+ - "\u0000\u0000\u0000\u0334Y\u0001\u0000\u0000\u0000\u0335\u0333\u0001\u0000"+ - "\u0000\u0000\u0336\u0337\u0005\u0011\u0000\u0000\u0337\u0338\u0003\u000e"+ - "\u0007\u0000\u0338[\u0001\u0000\u0000\u0000\u0339\u033a\u0005\u0018\u0000"+ - "\u0000\u033a\u033b\u0003^/\u0000\u033b]\u0001\u0000\u0000\u0000\u033c"+ - "\u0341\u0003\u0014\n\u0000\u033d\u033e\u0005@\u0000\u0000\u033e\u0340"+ - "\u0003\u0014\n\u0000\u033f\u033d\u0001\u0000\u0000\u0000\u0340\u0343\u0001"+ - "\u0000\u0000\u0000\u0341\u033f\u0001\u0000\u0000\u0000\u0341\u0342\u0001"+ - "\u0000\u0000\u0000\u0342_\u0001\u0000\u0000\u0000\u0343\u0341\u0001\u0000"+ - "\u0000\u0000\u0344\u0348\u0005;\u0000\u0000\u0345\u0347\u0003b1\u0000"+ - "\u0346\u0345\u0001\u0000\u0000\u0000\u0347\u034a\u0001\u0000\u0000\u0000"+ - "\u0348\u0346\u0001\u0000\u0000\u0000\u0348\u0349\u0001\u0000\u0000\u0000"+ - "\u0349\u034b\u0001\u0000\u0000\u0000\u034a\u0348\u0001\u0000\u0000\u0000"+ - "\u034b\u034c\u0005<\u0000\u0000\u034ca\u0001\u0000\u0000\u0000\u034d\u0352"+ - "\u0003d2\u0000\u034e\u0352\u0003\u00a8T\u0000\u034f\u0352\u0003\u00aa"+ - "U\u0000\u0350\u0352\u0003\u00acV\u0000\u0351\u034d\u0001\u0000\u0000\u0000"+ - "\u0351\u034e\u0001\u0000\u0000\u0000\u0351\u034f\u0001\u0000\u0000\u0000"+ - "\u0351\u0350\u0001\u0000\u0000\u0000\u0352c\u0001\u0000\u0000\u0000\u0353"+ - "\u0359\u0003f3\u0000\u0354\u0359\u0003\u008aE\u0000\u0355\u0359\u0003"+ - "P(\u0000\u0356\u0359\u0003\u00c4b\u0000\u0357\u0359\u0005?\u0000\u0000"+ - "\u0358\u0353\u0001\u0000\u0000\u0000\u0358\u0354\u0001\u0000\u0000\u0000"+ - "\u0358\u0355\u0001\u0000\u0000\u0000\u0358\u0356\u0001\u0000\u0000\u0000"+ - "\u0358\u0357\u0001\u0000\u0000\u0000\u0359e\u0001\u0000\u0000\u0000\u035a"+ - "\u035c\u0003h4\u0000\u035b\u035a\u0001\u0000\u0000\u0000\u035c\u035f\u0001"+ - "\u0000\u0000\u0000\u035d\u035b\u0001\u0000\u0000\u0000\u035d\u035e\u0001"+ - "\u0000\u0000\u0000\u035e\u0360\u0001\u0000\u0000\u0000\u035f\u035d\u0001"+ - "\u0000\u0000\u0000\u0360\u0361\u0003r9\u0000\u0361\u0362\u0003j5\u0000"+ - "\u0362\u0363\u0005?\u0000\u0000\u0363g\u0001\u0000\u0000\u0000\u0364\u036d"+ - "\u0003\u00e4r\u0000\u0365\u036d\u0005#\u0000\u0000\u0366\u036d\u0005\""+ - "\u0000\u0000\u0367\u036d\u0005!\u0000\u0000\u0368\u036d\u0005&\u0000\u0000"+ - "\u0369\u036d\u0005\u0012\u0000\u0000\u036a\u036d\u0005.\u0000\u0000\u036b"+ - "\u036d\u00051\u0000\u0000\u036c\u0364\u0001\u0000\u0000\u0000\u036c\u0365"+ - "\u0001\u0000\u0000\u0000\u036c\u0366\u0001\u0000\u0000\u0000\u036c\u0367"+ - "\u0001\u0000\u0000\u0000\u036c\u0368\u0001\u0000\u0000\u0000\u036c\u0369"+ - "\u0001\u0000\u0000\u0000\u036c\u036a\u0001\u0000\u0000\u0000\u036c\u036b"+ - "\u0001\u0000\u0000\u0000\u036di\u0001\u0000\u0000\u0000\u036e\u0373\u0003"+ - "l6\u0000\u036f\u0370\u0005@\u0000\u0000\u0370\u0372\u0003l6\u0000\u0371"+ - "\u036f\u0001\u0000\u0000\u0000\u0372\u0375\u0001\u0000\u0000\u0000\u0373"+ - "\u0371\u0001\u0000\u0000\u0000\u0373\u0374\u0001\u0000\u0000\u0000\u0374"+ - "k\u0001\u0000\u0000\u0000\u0375\u0373\u0001\u0000\u0000\u0000\u0376\u0379"+ - "\u0003n7\u0000\u0377\u0378\u0005B\u0000\u0000\u0378\u037a\u0003p8\u0000"+ - "\u0379\u0377\u0001\u0000\u0000\u0000\u0379\u037a\u0001\u0000\u0000\u0000"+ - "\u037am\u0001\u0000\u0000\u0000\u037b\u037d\u0005f\u0000\u0000\u037c\u037e"+ - "\u0003\u001e\u000f\u0000\u037d\u037c\u0001\u0000\u0000\u0000\u037d\u037e"+ - "\u0001\u0000\u0000\u0000\u037eo\u0001\u0000\u0000\u0000\u037f\u0382\u0003"+ - "\u019c\u00ce\u0000\u0380\u0382\u0003\u00f6{\u0000\u0381\u037f\u0001\u0000"+ - "\u0000\u0000\u0381\u0380\u0001\u0000\u0000\u0000\u0382q\u0001\u0000\u0000"+ - "\u0000\u0383\u0386\u0003t:\u0000\u0384\u0386\u0003v;\u0000\u0385\u0383"+ - "\u0001\u0000\u0000\u0000\u0385\u0384\u0001\u0000\u0000\u0000\u0386s\u0001"+ - "\u0000\u0000\u0000\u0387\u038a\u0003\u0004\u0002\u0000\u0388\u038a\u0005"+ - "\u0003\u0000\u0000\u0389\u0387\u0001\u0000\u0000\u0000\u0389\u0388\u0001"+ - "\u0000\u0000\u0000\u038au\u0001\u0000\u0000\u0000\u038b\u038f\u0003x<"+ - "\u0000\u038c\u038f\u0003\u0086C\u0000\u038d\u038f\u0003\u0088D\u0000\u038e"+ - "\u038b\u0001\u0000\u0000\u0000\u038e\u038c\u0001\u0000\u0000\u0000\u038e"+ - "\u038d\u0001\u0000\u0000\u0000\u038fw\u0001\u0000\u0000\u0000\u0390\u0393"+ - "\u0003~?\u0000\u0391\u0393\u0003\u0084B\u0000\u0392\u0390\u0001\u0000"+ - "\u0000\u0000\u0392\u0391\u0001\u0000\u0000\u0000\u0393\u0398\u0001\u0000"+ - "\u0000\u0000\u0394\u0397\u0003|>\u0000\u0395\u0397\u0003\u0082A\u0000"+ - "\u0396\u0394\u0001\u0000\u0000\u0000\u0396\u0395\u0001\u0000\u0000\u0000"+ - "\u0397\u039a\u0001\u0000\u0000\u0000\u0398\u0396\u0001\u0000\u0000\u0000"+ - "\u0398\u0399\u0001\u0000\u0000\u0000\u0399y\u0001\u0000\u0000\u0000\u039a"+ - "\u0398\u0001\u0000\u0000\u0000\u039b\u039d\u0005f\u0000\u0000\u039c\u039e"+ - "\u0003(\u0014\u0000\u039d\u039c\u0001\u0000\u0000\u0000\u039d\u039e\u0001"+ - "\u0000\u0000\u0000\u039e\u03ac\u0001\u0000\u0000\u0000\u039f\u03a0\u0003"+ - "x<\u0000\u03a0\u03a4\u0005A\u0000\u0000\u03a1\u03a3\u0003\u00e4r\u0000"+ - "\u03a2\u03a1\u0001\u0000\u0000\u0000\u03a3\u03a6\u0001\u0000\u0000\u0000"+ - "\u03a4\u03a2\u0001\u0000\u0000\u0000\u03a4\u03a5\u0001\u0000\u0000\u0000"+ - "\u03a5\u03a7\u0001\u0000\u0000\u0000\u03a6\u03a4\u0001\u0000\u0000\u0000"+ - "\u03a7\u03a9\u0005f\u0000\u0000\u03a8\u03aa\u0003(\u0014\u0000\u03a9\u03a8"+ - "\u0001\u0000\u0000\u0000\u03a9\u03aa\u0001\u0000\u0000\u0000\u03aa\u03ac"+ - "\u0001\u0000\u0000\u0000\u03ab\u039b\u0001\u0000\u0000\u0000\u03ab\u039f"+ - "\u0001\u0000\u0000\u0000\u03ac{\u0001\u0000\u0000\u0000\u03ad\u03b1\u0005"+ - "A\u0000\u0000\u03ae\u03b0\u0003\u00e4r\u0000\u03af\u03ae\u0001\u0000\u0000"+ - "\u0000\u03b0\u03b3\u0001\u0000\u0000\u0000\u03b1\u03af\u0001\u0000\u0000"+ - "\u0000\u03b1\u03b2\u0001\u0000\u0000\u0000\u03b2\u03b4\u0001\u0000\u0000"+ - "\u0000\u03b3\u03b1\u0001\u0000\u0000\u0000\u03b4\u03b6\u0005f\u0000\u0000"+ - "\u03b5\u03b7\u0003(\u0014\u0000\u03b6\u03b5\u0001\u0000\u0000\u0000\u03b6"+ - "\u03b7\u0001\u0000\u0000\u0000\u03b7}\u0001\u0000\u0000\u0000\u03b8\u03ba"+ - "\u0005f\u0000\u0000\u03b9\u03bb\u0003(\u0014\u0000\u03ba\u03b9\u0001\u0000"+ - "\u0000\u0000\u03ba\u03bb\u0001\u0000\u0000\u0000\u03bb\u007f\u0001\u0000"+ - "\u0000\u0000\u03bc\u03bd\u0003z=\u0000\u03bd\u0081\u0001\u0000\u0000\u0000"+ - "\u03be\u03bf\u0003|>\u0000\u03bf\u0083\u0001\u0000\u0000\u0000\u03c0\u03c1"+ - "\u0003~?\u0000\u03c1\u0085\u0001\u0000\u0000\u0000\u03c2\u03c3\u0005f"+ - "\u0000\u0000\u03c3\u0087\u0001\u0000\u0000\u0000\u03c4\u03c5\u0003t:\u0000"+ - "\u03c5\u03c6\u0003\u001e\u000f\u0000\u03c6\u03ce\u0001\u0000\u0000\u0000"+ - "\u03c7\u03c8\u0003x<\u0000\u03c8\u03c9\u0003\u001e\u000f\u0000\u03c9\u03ce"+ - "\u0001\u0000\u0000\u0000\u03ca\u03cb\u0003\u0086C\u0000\u03cb\u03cc\u0003"+ - "\u001e\u000f\u0000\u03cc\u03ce\u0001\u0000\u0000\u0000\u03cd\u03c4\u0001"+ - "\u0000\u0000\u0000\u03cd\u03c7\u0001\u0000\u0000\u0000\u03cd\u03ca\u0001"+ - "\u0000\u0000\u0000\u03ce\u0089\u0001\u0000\u0000\u0000\u03cf\u03d1\u0003"+ - "\u008cF\u0000\u03d0\u03cf\u0001\u0000\u0000\u0000\u03d1\u03d4\u0001\u0000"+ - "\u0000\u0000\u03d2\u03d0\u0001\u0000\u0000\u0000\u03d2\u03d3\u0001\u0000"+ - "\u0000\u0000\u03d3\u03d5\u0001\u0000\u0000\u0000\u03d4\u03d2\u0001\u0000"+ - "\u0000\u0000\u03d5\u03d6\u0003\u008eG\u0000\u03d6\u03d7\u0003\u00a6S\u0000"+ - "\u03d7\u008b\u0001\u0000\u0000\u0000\u03d8\u03e3\u0003\u00e4r\u0000\u03d9"+ - "\u03e3\u0005#\u0000\u0000\u03da\u03e3\u0005\"\u0000\u0000\u03db\u03e3"+ - "\u0005!\u0000\u0000\u03dc\u03e3\u0005\u0001\u0000\u0000\u03dd\u03e3\u0005"+ - "&\u0000\u0000\u03de\u03e3\u0005\u0012\u0000\u0000\u03df\u03e3\u0005*\u0000"+ - "\u0000\u03e0\u03e3\u0005\u001e\u0000\u0000\u03e1\u03e3\u0005\'\u0000\u0000"+ - "\u03e2\u03d8\u0001\u0000\u0000\u0000\u03e2\u03d9\u0001\u0000\u0000\u0000"+ - "\u03e2\u03da\u0001\u0000\u0000\u0000\u03e2\u03db\u0001\u0000\u0000\u0000"+ - "\u03e2\u03dc\u0001\u0000\u0000\u0000\u03e2\u03dd\u0001\u0000\u0000\u0000"+ - "\u03e2\u03de\u0001\u0000\u0000\u0000\u03e2\u03df\u0001\u0000\u0000\u0000"+ - "\u03e2\u03e0\u0001\u0000\u0000\u0000\u03e2\u03e1\u0001\u0000\u0000\u0000"+ - "\u03e3\u008d\u0001\u0000\u0000\u0000\u03e4\u03e5\u0003\u0090H\u0000\u03e5"+ - "\u03e7\u0003\u0092I\u0000\u03e6\u03e8\u0003\u00a0P\u0000\u03e7\u03e6\u0001"+ - "\u0000\u0000\u0000\u03e7\u03e8\u0001\u0000\u0000\u0000\u03e8\u03f6\u0001"+ - "\u0000\u0000\u0000\u03e9\u03ed\u0003V+\u0000\u03ea\u03ec\u0003\u00e4r"+ - "\u0000\u03eb\u03ea\u0001\u0000\u0000\u0000\u03ec\u03ef\u0001\u0000\u0000"+ - "\u0000\u03ed\u03eb\u0001\u0000\u0000\u0000\u03ed\u03ee\u0001\u0000\u0000"+ - "\u0000\u03ee\u03f0\u0001\u0000\u0000\u0000\u03ef\u03ed\u0001\u0000\u0000"+ - "\u0000\u03f0\u03f1\u0003\u0090H\u0000\u03f1\u03f3\u0003\u0092I\u0000\u03f2"+ - "\u03f4\u0003\u00a0P\u0000\u03f3\u03f2\u0001\u0000\u0000\u0000\u03f3\u03f4"+ - "\u0001\u0000\u0000\u0000\u03f4\u03f6\u0001\u0000\u0000\u0000\u03f5\u03e4"+ - "\u0001\u0000\u0000\u0000\u03f5\u03e9\u0001\u0000\u0000\u0000\u03f6\u008f"+ - "\u0001\u0000\u0000\u0000\u03f7\u03fa\u0003r9\u0000\u03f8\u03fa\u00050"+ - "\u0000\u0000\u03f9\u03f7\u0001\u0000\u0000\u0000\u03f9\u03f8\u0001\u0000"+ - "\u0000\u0000\u03fa\u0091\u0001\u0000\u0000\u0000\u03fb\u03fc\u0005f\u0000"+ - "\u0000\u03fc\u03fe\u00059\u0000\u0000\u03fd\u03ff\u0003\u0094J\u0000\u03fe"+ - "\u03fd\u0001\u0000\u0000\u0000\u03fe\u03ff\u0001\u0000\u0000\u0000\u03ff"+ - "\u0400\u0001\u0000\u0000\u0000\u0400\u0402\u0005:\u0000\u0000\u0401\u0403"+ - "\u0003\u001e\u000f\u0000\u0402\u0401\u0001\u0000\u0000\u0000\u0402\u0403"+ - "\u0001\u0000\u0000\u0000\u0403\u0093\u0001\u0000\u0000\u0000\u0404\u040b"+ - "\u0003\u009eO\u0000\u0405\u0406\u0003\u0096K\u0000\u0406\u0407\u0005@"+ - "\u0000\u0000\u0407\u0408\u0003\u009cN\u0000\u0408\u040b\u0001\u0000\u0000"+ - "\u0000\u0409\u040b\u0003\u009cN\u0000\u040a\u0404\u0001\u0000\u0000\u0000"+ - "\u040a\u0405\u0001\u0000\u0000\u0000\u040a\u0409\u0001\u0000\u0000\u0000"+ - "\u040b\u0095\u0001\u0000\u0000\u0000\u040c\u0411\u0003\u0098L\u0000\u040d"+ - "\u040e\u0005@\u0000\u0000\u040e\u0410\u0003\u0098L\u0000\u040f\u040d\u0001"+ - "\u0000\u0000\u0000\u0410\u0413\u0001\u0000\u0000\u0000\u0411\u040f\u0001"+ - "\u0000\u0000\u0000\u0411\u0412\u0001\u0000\u0000\u0000\u0412\u041d\u0001"+ - "\u0000\u0000\u0000\u0413\u0411\u0001\u0000\u0000\u0000\u0414\u0419\u0003"+ - "\u009eO\u0000\u0415\u0416\u0005@\u0000\u0000\u0416\u0418\u0003\u0098L"+ - "\u0000\u0417\u0415\u0001\u0000\u0000\u0000\u0418\u041b\u0001\u0000\u0000"+ - "\u0000\u0419\u0417\u0001\u0000\u0000\u0000\u0419\u041a\u0001\u0000\u0000"+ - "\u0000\u041a\u041d\u0001\u0000\u0000\u0000\u041b\u0419\u0001\u0000\u0000"+ - "\u0000\u041c\u040c\u0001\u0000\u0000\u0000\u041c\u0414\u0001\u0000\u0000"+ - "\u0000\u041d\u0097\u0001\u0000\u0000\u0000\u041e\u0420\u0003\u009aM\u0000"+ - "\u041f\u041e\u0001\u0000\u0000\u0000\u0420\u0423\u0001\u0000\u0000\u0000"+ - "\u0421\u041f\u0001\u0000\u0000\u0000\u0421\u0422\u0001\u0000\u0000\u0000"+ - "\u0422\u0424\u0001\u0000\u0000\u0000\u0423\u0421\u0001\u0000\u0000\u0000"+ - "\u0424\u0425\u0003r9\u0000\u0425\u0426\u0003n7\u0000\u0426\u0099\u0001"+ - "\u0000\u0000\u0000\u0427\u042a\u0003\u00e4r\u0000\u0428\u042a\u0005\u0012"+ - "\u0000\u0000\u0429\u0427\u0001\u0000\u0000\u0000\u0429\u0428\u0001\u0000"+ - "\u0000\u0000\u042a\u009b\u0001\u0000\u0000\u0000\u042b\u042d\u0003\u009a"+ - "M\u0000\u042c\u042b\u0001\u0000\u0000\u0000\u042d\u0430\u0001\u0000\u0000"+ - "\u0000\u042e\u042c\u0001\u0000\u0000\u0000\u042e\u042f\u0001\u0000\u0000"+ - "\u0000\u042f\u0431\u0001\u0000\u0000\u0000\u0430\u042e\u0001\u0000\u0000"+ - "\u0000\u0431\u0435\u0003r9\u0000\u0432\u0434\u0003\u00e4r\u0000\u0433"+ - "\u0432\u0001\u0000\u0000\u0000\u0434\u0437\u0001\u0000\u0000\u0000\u0435"+ - "\u0433\u0001\u0000\u0000\u0000\u0435\u0436\u0001\u0000\u0000\u0000\u0436"+ - "\u0438\u0001\u0000\u0000\u0000\u0437\u0435\u0001\u0000\u0000\u0000\u0438"+ - "\u0439\u0005h\u0000\u0000\u0439\u043a\u0003n7\u0000\u043a\u043d\u0001"+ - "\u0000\u0000\u0000\u043b\u043d\u0003\u0098L\u0000\u043c\u042e\u0001\u0000"+ - "\u0000\u0000\u043c\u043b\u0001\u0000\u0000\u0000\u043d\u009d\u0001\u0000"+ - "\u0000\u0000\u043e\u0440\u0003\u00e4r\u0000\u043f\u043e\u0001\u0000\u0000"+ - "\u0000\u0440\u0443\u0001\u0000\u0000\u0000\u0441\u043f\u0001\u0000\u0000"+ - "\u0000\u0441\u0442\u0001\u0000\u0000\u0000\u0442\u0444\u0001\u0000\u0000"+ - "\u0000\u0443\u0441\u0001\u0000\u0000\u0000\u0444\u0447\u0003r9\u0000\u0445"+ - "\u0446\u0005f\u0000\u0000\u0446\u0448\u0005A\u0000\u0000\u0447\u0445\u0001"+ - "\u0000\u0000\u0000\u0447\u0448\u0001\u0000\u0000\u0000\u0448\u0449\u0001"+ - "\u0000\u0000\u0000\u0449\u044a\u0005+\u0000\u0000\u044a\u009f\u0001\u0000"+ - "\u0000\u0000\u044b\u044c\u0005-\u0000\u0000\u044c\u044d\u0003\u00a2Q\u0000"+ - "\u044d\u00a1\u0001\u0000\u0000\u0000\u044e\u0453\u0003\u00a4R\u0000\u044f"+ - "\u0450\u0005@\u0000\u0000\u0450\u0452\u0003\u00a4R\u0000\u0451\u044f\u0001"+ - "\u0000\u0000\u0000\u0452\u0455\u0001\u0000\u0000\u0000\u0453\u0451\u0001"+ - "\u0000\u0000\u0000\u0453\u0454\u0001\u0000\u0000\u0000\u0454\u00a3\u0001"+ - "\u0000\u0000\u0000\u0455\u0453\u0001\u0000\u0000\u0000\u0456\u0459\u0003"+ - "\u000e\u0007\u0000\u0457\u0459\u0003\u001a\r\u0000\u0458\u0456\u0001\u0000"+ - "\u0000\u0000\u0458\u0457\u0001\u0000\u0000\u0000\u0459\u00a5\u0001\u0000"+ - "\u0000\u0000\u045a\u045d\u0003\u00fa}\u0000\u045b\u045d\u0005?\u0000\u0000"+ - "\u045c\u045a\u0001\u0000\u0000\u0000\u045c\u045b\u0001\u0000\u0000\u0000"+ - "\u045d\u00a7\u0001\u0000\u0000\u0000\u045e\u045f\u0003\u00fa}\u0000\u045f"+ - "\u00a9\u0001\u0000\u0000\u0000\u0460\u0461\u0005&\u0000\u0000\u0461\u0462"+ - "\u0003\u00fa}\u0000\u0462\u00ab\u0001\u0000\u0000\u0000\u0463\u0465\u0003"+ - "\u00aeW\u0000\u0464\u0463\u0001\u0000\u0000\u0000\u0465\u0468\u0001\u0000"+ - "\u0000\u0000\u0466\u0464\u0001\u0000\u0000\u0000\u0466\u0467\u0001\u0000"+ - "\u0000\u0000\u0467\u0469\u0001\u0000\u0000\u0000\u0468\u0466\u0001\u0000"+ - "\u0000\u0000\u0469\u046b\u0003\u00b0X\u0000\u046a\u046c\u0003\u00a0P\u0000"+ - "\u046b\u046a\u0001\u0000\u0000\u0000\u046b\u046c\u0001\u0000\u0000\u0000"+ - "\u046c\u046d\u0001\u0000\u0000\u0000\u046d\u046e\u0003\u00b4Z\u0000\u046e"+ - "\u00ad\u0001\u0000\u0000\u0000\u046f\u0474\u0003\u00e4r\u0000\u0470\u0474"+ - "\u0005#\u0000\u0000\u0471\u0474\u0005\"\u0000\u0000\u0472\u0474\u0005"+ - "!\u0000\u0000\u0473\u046f\u0001\u0000\u0000\u0000\u0473\u0470\u0001\u0000"+ - "\u0000\u0000\u0473\u0471\u0001\u0000\u0000\u0000\u0473\u0472\u0001\u0000"+ - "\u0000\u0000\u0474\u00af\u0001\u0000\u0000\u0000\u0475\u0477\u0003V+\u0000"+ - "\u0476\u0475\u0001\u0000\u0000\u0000\u0476\u0477\u0001\u0000\u0000\u0000"+ - "\u0477\u0478\u0001\u0000\u0000\u0000\u0478\u0479\u0003\u00b2Y\u0000\u0479"+ - "\u047b\u00059\u0000\u0000\u047a\u047c\u0003\u0094J\u0000\u047b\u047a\u0001"+ - "\u0000\u0000\u0000\u047b\u047c\u0001\u0000\u0000\u0000\u047c\u047d\u0001"+ - "\u0000\u0000\u0000\u047d\u047e\u0005:\u0000\u0000\u047e\u00b1\u0001\u0000"+ - "\u0000\u0000\u047f\u0480\u0005f\u0000\u0000\u0480\u00b3\u0001\u0000\u0000"+ - "\u0000\u0481\u0483\u0005;\u0000\u0000\u0482\u0484\u0003\u00b6[\u0000\u0483"+ - "\u0482\u0001\u0000\u0000\u0000\u0483\u0484\u0001\u0000\u0000\u0000\u0484"+ - "\u0486\u0001\u0000\u0000\u0000\u0485\u0487\u0003\u00fc~\u0000\u0486\u0485"+ - "\u0001\u0000\u0000\u0000\u0486\u0487\u0001\u0000\u0000\u0000\u0487\u0488"+ - "\u0001\u0000\u0000\u0000\u0488\u0489\u0005<\u0000\u0000\u0489\u00b5\u0001"+ - "\u0000\u0000\u0000\u048a\u048c\u0003(\u0014\u0000\u048b\u048a\u0001\u0000"+ - "\u0000\u0000\u048b\u048c\u0001\u0000\u0000\u0000\u048c\u048d\u0001\u0000"+ - "\u0000\u0000\u048d\u048e\u0005+\u0000\u0000\u048e\u0490\u00059\u0000\u0000"+ - "\u048f\u0491\u0003\u018c\u00c6\u0000\u0490\u048f\u0001\u0000\u0000\u0000"+ - "\u0490\u0491\u0001\u0000\u0000\u0000\u0491\u0492\u0001\u0000\u0000\u0000"+ - "\u0492\u0493\u0005:\u0000\u0000\u0493\u04b9\u0005?\u0000\u0000\u0494\u0496"+ - "\u0003(\u0014\u0000\u0495\u0494\u0001\u0000\u0000\u0000\u0495\u0496\u0001"+ - "\u0000\u0000\u0000\u0496\u0497\u0001\u0000\u0000\u0000\u0497\u0498\u0005"+ - "(\u0000\u0000\u0498\u049a\u00059\u0000\u0000\u0499\u049b\u0003\u018c\u00c6"+ - "\u0000\u049a\u0499\u0001\u0000\u0000\u0000\u049a\u049b\u0001\u0000\u0000"+ - "\u0000\u049b\u049c\u0001\u0000\u0000\u0000\u049c\u049d\u0005:\u0000\u0000"+ - "\u049d\u04b9\u0005?\u0000\u0000\u049e\u049f\u00038\u001c\u0000\u049f\u04a1"+ - "\u0005A\u0000\u0000\u04a0\u04a2\u0003(\u0014\u0000\u04a1\u04a0\u0001\u0000"+ - "\u0000\u0000\u04a1\u04a2\u0001\u0000\u0000\u0000\u04a2\u04a3\u0001\u0000"+ - "\u0000\u0000\u04a3\u04a4\u0005(\u0000\u0000\u04a4\u04a6\u00059\u0000\u0000"+ - "\u04a5\u04a7\u0003\u018c\u00c6\u0000\u04a6\u04a5\u0001\u0000\u0000\u0000"+ - "\u04a6\u04a7\u0001\u0000\u0000\u0000\u04a7\u04a8\u0001\u0000\u0000\u0000"+ - "\u04a8\u04a9\u0005:\u0000\u0000\u04a9\u04aa\u0005?\u0000\u0000\u04aa\u04b9"+ - "\u0001\u0000\u0000\u0000\u04ab\u04ac\u0003\u015e\u00af\u0000\u04ac\u04ae"+ - "\u0005A\u0000\u0000\u04ad\u04af\u0003(\u0014\u0000\u04ae\u04ad\u0001\u0000"+ - "\u0000\u0000\u04ae\u04af\u0001\u0000\u0000\u0000\u04af\u04b0\u0001\u0000"+ - "\u0000\u0000\u04b0\u04b1\u0005(\u0000\u0000\u04b1\u04b3\u00059\u0000\u0000"+ - "\u04b2\u04b4\u0003\u018c\u00c6\u0000\u04b3\u04b2\u0001\u0000\u0000\u0000"+ - "\u04b3\u04b4\u0001\u0000\u0000\u0000\u04b4\u04b5\u0001\u0000\u0000\u0000"+ - "\u04b5\u04b6\u0005:\u0000\u0000\u04b6\u04b7\u0005?\u0000\u0000\u04b7\u04b9"+ - "\u0001\u0000\u0000\u0000\u04b8\u048b\u0001\u0000\u0000\u0000\u04b8\u0495"+ - "\u0001\u0000\u0000\u0000\u04b8\u049e\u0001\u0000\u0000\u0000\u04b8\u04ab"+ - "\u0001\u0000\u0000\u0000\u04b9\u00b7\u0001\u0000\u0000\u0000\u04ba\u04bc"+ - "\u0003T*\u0000\u04bb\u04ba\u0001\u0000\u0000\u0000\u04bc\u04bf\u0001\u0000"+ - "\u0000\u0000\u04bd\u04bb\u0001\u0000\u0000\u0000\u04bd\u04be\u0001\u0000"+ - "\u0000\u0000\u04be\u04c0\u0001\u0000\u0000\u0000\u04bf\u04bd\u0001\u0000"+ - "\u0000\u0000\u04c0\u04c1\u0005\u0010\u0000\u0000\u04c1\u04c3\u0005f\u0000"+ - "\u0000\u04c2\u04c4\u0003\\.\u0000\u04c3\u04c2\u0001\u0000\u0000\u0000"+ - "\u04c3\u04c4\u0001\u0000\u0000\u0000\u04c4\u04c5\u0001\u0000\u0000\u0000"+ - "\u04c5\u04c6\u0003\u00ba]\u0000\u04c6\u00b9\u0001\u0000\u0000\u0000\u04c7"+ - "\u04c9\u0005;\u0000\u0000\u04c8\u04ca\u0003\u00bc^\u0000\u04c9\u04c8\u0001"+ - "\u0000\u0000\u0000\u04c9\u04ca\u0001\u0000\u0000\u0000\u04ca\u04cc\u0001"+ - "\u0000\u0000\u0000\u04cb\u04cd\u0005@\u0000\u0000\u04cc\u04cb\u0001\u0000"+ - "\u0000\u0000\u04cc\u04cd\u0001\u0000\u0000\u0000\u04cd\u04cf\u0001\u0000"+ - "\u0000\u0000\u04ce\u04d0\u0003\u00c2a\u0000\u04cf\u04ce\u0001\u0000\u0000"+ - "\u0000\u04cf\u04d0\u0001\u0000\u0000\u0000\u04d0\u04d1\u0001\u0000\u0000"+ - "\u0000\u04d1\u04d2\u0005<\u0000\u0000\u04d2\u00bb\u0001\u0000\u0000\u0000"+ - "\u04d3\u04d8\u0003\u00be_\u0000\u04d4\u04d5\u0005@\u0000\u0000\u04d5\u04d7"+ - "\u0003\u00be_\u0000\u04d6\u04d4\u0001\u0000\u0000\u0000\u04d7\u04da\u0001"+ - "\u0000\u0000\u0000\u04d8\u04d6\u0001\u0000\u0000\u0000\u04d8\u04d9\u0001"+ - "\u0000\u0000\u0000\u04d9\u00bd\u0001\u0000\u0000\u0000\u04da\u04d8\u0001"+ - "\u0000\u0000\u0000\u04db\u04dd\u0003\u00c0`\u0000\u04dc\u04db\u0001\u0000"+ - "\u0000\u0000\u04dd\u04e0\u0001\u0000\u0000\u0000\u04de\u04dc\u0001\u0000"+ - "\u0000\u0000\u04de\u04df\u0001\u0000\u0000\u0000\u04df\u04e1\u0001\u0000"+ - "\u0000\u0000\u04e0\u04de\u0001\u0000\u0000\u0000\u04e1\u04e7\u0005f\u0000"+ - "\u0000\u04e2\u04e4\u00059\u0000\u0000\u04e3\u04e5\u0003\u018c\u00c6\u0000"+ - "\u04e4\u04e3\u0001\u0000\u0000\u0000\u04e4\u04e5\u0001\u0000\u0000\u0000"+ - "\u04e5\u04e6\u0001\u0000\u0000\u0000\u04e6\u04e8\u0005:\u0000\u0000\u04e7"+ - "\u04e2\u0001\u0000\u0000\u0000\u04e7\u04e8\u0001\u0000\u0000\u0000\u04e8"+ - "\u04ea\u0001\u0000\u0000\u0000\u04e9\u04eb\u0003`0\u0000\u04ea\u04e9\u0001"+ - "\u0000\u0000\u0000\u04ea\u04eb\u0001\u0000\u0000\u0000\u04eb\u00bf\u0001"+ - "\u0000\u0000\u0000\u04ec\u04ed\u0003\u00e4r\u0000\u04ed\u00c1\u0001\u0000"+ - "\u0000\u0000\u04ee\u04f2\u0005?\u0000\u0000\u04ef\u04f1\u0003b1\u0000"+ - "\u04f0\u04ef\u0001\u0000\u0000\u0000\u04f1\u04f4\u0001\u0000\u0000\u0000"+ - "\u04f2\u04f0\u0001\u0000\u0000\u0000\u04f2\u04f3\u0001\u0000\u0000\u0000"+ - "\u04f3\u00c3\u0001\u0000\u0000\u0000\u04f4\u04f2\u0001\u0000\u0000\u0000"+ - "\u04f5\u04f8\u0003\u00c6c\u0000\u04f6\u04f8\u0003\u00d8l\u0000\u04f7\u04f5"+ - "\u0001\u0000\u0000\u0000\u04f7\u04f6\u0001\u0000\u0000\u0000\u04f8\u00c5"+ - "\u0001\u0000\u0000\u0000\u04f9\u04fb\u0003\u00c8d\u0000\u04fa\u04f9\u0001"+ - "\u0000\u0000\u0000\u04fb\u04fe\u0001\u0000\u0000\u0000\u04fc\u04fa\u0001"+ - "\u0000\u0000\u0000\u04fc\u04fd\u0001\u0000\u0000\u0000\u04fd\u04ff\u0001"+ - "\u0000\u0000\u0000\u04fe\u04fc\u0001\u0000\u0000\u0000\u04ff\u0500\u0005"+ - "\u001c\u0000\u0000\u0500\u0502\u0005f\u0000\u0000\u0501\u0503\u0003V+"+ - "\u0000\u0502\u0501\u0001\u0000\u0000\u0000\u0502\u0503\u0001\u0000\u0000"+ - "\u0000\u0503\u0505\u0001\u0000\u0000\u0000\u0504\u0506\u0003\u00cae\u0000"+ - "\u0505\u0504\u0001\u0000\u0000\u0000\u0505\u0506\u0001\u0000\u0000\u0000"+ - "\u0506\u0507\u0001\u0000\u0000\u0000\u0507\u0508\u0003\u00ccf\u0000\u0508"+ - "\u00c7\u0001\u0000\u0000\u0000\u0509\u0511\u0003\u00e4r\u0000\u050a\u0511"+ - "\u0005#\u0000\u0000\u050b\u0511\u0005\"\u0000\u0000\u050c\u0511\u0005"+ - "!\u0000\u0000\u050d\u0511\u0005\u0001\u0000\u0000\u050e\u0511\u0005&\u0000"+ - "\u0000\u050f\u0511\u0005\'\u0000\u0000\u0510\u0509\u0001\u0000\u0000\u0000"+ - "\u0510\u050a\u0001\u0000\u0000\u0000\u0510\u050b\u0001\u0000\u0000\u0000"+ - "\u0510\u050c\u0001\u0000\u0000\u0000\u0510\u050d\u0001\u0000\u0000\u0000"+ - "\u0510\u050e\u0001\u0000\u0000\u0000\u0510\u050f\u0001\u0000\u0000\u0000"+ - "\u0511\u00c9\u0001\u0000\u0000\u0000\u0512\u0513\u0005\u0011\u0000\u0000"+ - "\u0513\u0514\u0003^/\u0000\u0514\u00cb\u0001\u0000\u0000\u0000\u0515\u0519"+ - "\u0005;\u0000\u0000\u0516\u0518\u0003\u00ceg\u0000\u0517\u0516\u0001\u0000"+ - "\u0000\u0000\u0518\u051b\u0001\u0000\u0000\u0000\u0519\u0517\u0001\u0000"+ - "\u0000\u0000\u0519\u051a\u0001\u0000\u0000\u0000\u051a\u051c\u0001\u0000"+ - "\u0000\u0000\u051b\u0519\u0001\u0000\u0000\u0000\u051c\u051d\u0005<\u0000"+ - "\u0000\u051d\u00cd\u0001\u0000\u0000\u0000\u051e\u0524\u0003\u00d0h\u0000"+ - "\u051f\u0524\u0003\u00d4j\u0000\u0520\u0524\u0003P(\u0000\u0521\u0524"+ - "\u0003\u00c4b\u0000\u0522\u0524\u0005?\u0000\u0000\u0523\u051e\u0001\u0000"+ - "\u0000\u0000\u0523\u051f\u0001\u0000\u0000\u0000\u0523\u0520\u0001\u0000"+ - "\u0000\u0000\u0523\u0521\u0001\u0000\u0000\u0000\u0523\u0522\u0001\u0000"+ - "\u0000\u0000\u0524\u00cf\u0001\u0000\u0000\u0000\u0525\u0527\u0003\u00d2"+ - "i\u0000\u0526\u0525\u0001\u0000\u0000\u0000\u0527\u052a\u0001\u0000\u0000"+ - "\u0000\u0528\u0526\u0001\u0000\u0000\u0000\u0528\u0529\u0001\u0000\u0000"+ - "\u0000\u0529\u052b\u0001\u0000\u0000\u0000\u052a\u0528\u0001\u0000\u0000"+ - "\u0000\u052b\u052c\u0003r9\u0000\u052c\u052d\u0003j5\u0000\u052d\u052e"+ - "\u0005?\u0000\u0000\u052e\u00d1\u0001\u0000\u0000\u0000\u052f\u0534\u0003"+ - "\u00e4r\u0000\u0530\u0534\u0005#\u0000\u0000\u0531\u0534\u0005&\u0000"+ - "\u0000\u0532\u0534\u0005\u0012\u0000\u0000\u0533\u052f\u0001\u0000\u0000"+ - "\u0000\u0533\u0530\u0001\u0000\u0000\u0000\u0533\u0531\u0001\u0000\u0000"+ - "\u0000\u0533\u0532\u0001\u0000\u0000\u0000\u0534\u00d3\u0001\u0000\u0000"+ - "\u0000\u0535\u0537\u0003\u00d6k\u0000\u0536\u0535\u0001\u0000\u0000\u0000"+ - "\u0537\u053a\u0001\u0000\u0000\u0000\u0538\u0536\u0001\u0000\u0000\u0000"+ - "\u0538\u0539\u0001\u0000\u0000\u0000\u0539\u053b\u0001\u0000\u0000\u0000"+ - "\u053a\u0538\u0001\u0000\u0000\u0000\u053b\u053c\u0003\u008eG\u0000\u053c"+ - "\u053d\u0003\u00a6S\u0000\u053d\u00d5\u0001\u0000\u0000\u0000\u053e\u0545"+ - "\u0003\u00e4r\u0000\u053f\u0545\u0005#\u0000\u0000\u0540\u0545\u0005\u0001"+ - "\u0000\u0000\u0541\u0545\u0005\f\u0000\u0000\u0542\u0545\u0005&\u0000"+ - "\u0000\u0543\u0545\u0005\'\u0000\u0000\u0544\u053e\u0001\u0000\u0000\u0000"+ - "\u0544\u053f\u0001\u0000\u0000\u0000\u0544\u0540\u0001\u0000\u0000\u0000"+ - "\u0544\u0541\u0001\u0000\u0000\u0000\u0544\u0542\u0001\u0000\u0000\u0000"+ - "\u0544\u0543\u0001\u0000\u0000\u0000\u0545\u00d7\u0001\u0000\u0000\u0000"+ - "\u0546\u0548\u0003\u00c8d\u0000\u0547\u0546\u0001\u0000\u0000\u0000\u0548"+ - "\u054b\u0001\u0000\u0000\u0000\u0549\u0547\u0001\u0000\u0000\u0000\u0549"+ - "\u054a\u0001\u0000\u0000\u0000\u054a\u054c\u0001\u0000\u0000\u0000\u054b"+ - "\u0549\u0001\u0000\u0000\u0000\u054c\u054d\u0005g\u0000\u0000\u054d\u054e"+ - "\u0005\u001c\u0000\u0000\u054e\u054f\u0005f\u0000\u0000\u054f\u0550\u0003"+ - "\u00dam\u0000\u0550\u00d9\u0001\u0000\u0000\u0000\u0551\u0555\u0005;\u0000"+ - "\u0000\u0552\u0554\u0003\u00dcn\u0000\u0553\u0552\u0001\u0000\u0000\u0000"+ - "\u0554\u0557\u0001\u0000\u0000\u0000\u0555\u0553\u0001\u0000\u0000\u0000"+ - "\u0555\u0556\u0001\u0000\u0000\u0000\u0556\u0558\u0001\u0000\u0000\u0000"+ - "\u0557\u0555\u0001\u0000\u0000\u0000\u0558\u0559\u0005<\u0000\u0000\u0559"+ - "\u00db\u0001\u0000\u0000\u0000\u055a\u0560\u0003\u00deo\u0000\u055b\u0560"+ - "\u0003\u00d0h\u0000\u055c\u0560\u0003P(\u0000\u055d\u0560\u0003\u00c4"+ - "b\u0000\u055e\u0560\u0005?\u0000\u0000\u055f\u055a\u0001\u0000\u0000\u0000"+ - "\u055f\u055b\u0001\u0000\u0000\u0000\u055f\u055c\u0001\u0000\u0000\u0000"+ - "\u055f\u055d\u0001\u0000\u0000\u0000\u055f\u055e\u0001\u0000\u0000\u0000"+ - "\u0560\u00dd\u0001\u0000\u0000\u0000\u0561\u0563\u0003\u00e0p\u0000\u0562"+ - "\u0561\u0001\u0000\u0000\u0000\u0563\u0566\u0001\u0000\u0000\u0000\u0564"+ - "\u0562\u0001\u0000\u0000\u0000\u0564\u0565\u0001\u0000\u0000\u0000\u0565"+ - "\u0567\u0001\u0000\u0000\u0000\u0566\u0564\u0001\u0000\u0000\u0000\u0567"+ - "\u0568\u0003r9\u0000\u0568\u0569\u0005f\u0000\u0000\u0569\u056a\u0005"+ - "9\u0000\u0000\u056a\u056c\u0005:\u0000\u0000\u056b\u056d\u0003\u001e\u000f"+ - "\u0000\u056c\u056b\u0001\u0000\u0000\u0000\u056c\u056d\u0001\u0000\u0000"+ - "\u0000\u056d\u056f\u0001\u0000\u0000\u0000\u056e\u0570\u0003\u00e2q\u0000"+ - "\u056f\u056e\u0001\u0000\u0000\u0000\u056f\u0570\u0001\u0000\u0000\u0000"+ - "\u0570\u0571\u0001\u0000\u0000\u0000\u0571\u0572\u0005?\u0000\u0000\u0572"+ - "\u00df\u0001\u0000\u0000\u0000\u0573\u0577\u0003\u00e4r\u0000\u0574\u0577"+ - "\u0005#\u0000\u0000\u0575\u0577\u0005\u0001\u0000\u0000\u0576\u0573\u0001"+ - "\u0000\u0000\u0000\u0576\u0574\u0001\u0000\u0000\u0000\u0576\u0575\u0001"+ - "\u0000\u0000\u0000\u0577\u00e1\u0001\u0000\u0000\u0000\u0578\u0579\u0005"+ - "\f\u0000\u0000\u0579\u057a\u0003\u00ecv\u0000\u057a\u00e3\u0001\u0000"+ - "\u0000\u0000\u057b\u057f\u0003\u00e6s\u0000\u057c\u057f\u0003\u00f2y\u0000"+ - "\u057d\u057f\u0003\u00f4z\u0000\u057e\u057b\u0001\u0000\u0000\u0000\u057e"+ - "\u057c\u0001\u0000\u0000\u0000\u057e\u057d\u0001\u0000\u0000\u0000\u057f"+ - "\u00e5\u0001\u0000\u0000\u0000\u0580\u0581\u0005g\u0000\u0000\u0581\u0582"+ - "\u00034\u001a\u0000\u0582\u0584\u00059\u0000\u0000\u0583\u0585\u0003\u00e8"+ - "t\u0000\u0584\u0583\u0001\u0000\u0000\u0000\u0584\u0585\u0001\u0000\u0000"+ - "\u0000\u0585\u0586\u0001\u0000\u0000\u0000\u0586\u0587\u0005:\u0000\u0000"+ - "\u0587\u00e7\u0001\u0000\u0000\u0000\u0588\u058d\u0003\u00eau\u0000\u0589"+ - "\u058a\u0005@\u0000\u0000\u058a\u058c\u0003\u00eau\u0000\u058b\u0589\u0001"+ - "\u0000\u0000\u0000\u058c\u058f\u0001\u0000\u0000\u0000\u058d\u058b\u0001"+ - "\u0000\u0000\u0000\u058d\u058e\u0001\u0000\u0000\u0000\u058e\u00e9\u0001"+ - "\u0000\u0000\u0000\u058f\u058d\u0001\u0000\u0000\u0000\u0590\u0591\u0005"+ - "f\u0000\u0000\u0591\u0592\u0005B\u0000\u0000\u0592\u0593\u0003\u00ecv"+ - "\u0000\u0593\u00eb\u0001\u0000\u0000\u0000\u0594\u0598\u0003\u01ae\u00d7"+ - "\u0000\u0595\u0598\u0003\u00eew\u0000\u0596\u0598\u0003\u00e4r\u0000\u0597"+ - "\u0594\u0001\u0000\u0000\u0000\u0597\u0595\u0001\u0000\u0000\u0000\u0597"+ - "\u0596\u0001\u0000\u0000\u0000\u0598\u00ed\u0001\u0000\u0000\u0000\u0599"+ - "\u059b\u0005;\u0000\u0000\u059a\u059c\u0003\u00f0x\u0000\u059b\u059a\u0001"+ - "\u0000\u0000\u0000\u059b\u059c\u0001\u0000\u0000\u0000\u059c\u059e\u0001"+ - "\u0000\u0000\u0000\u059d\u059f\u0005@\u0000\u0000\u059e\u059d\u0001\u0000"+ - "\u0000\u0000\u059e\u059f\u0001\u0000\u0000\u0000\u059f\u05a0\u0001\u0000"+ - "\u0000\u0000\u05a0\u05a1\u0005<\u0000\u0000\u05a1\u00ef\u0001\u0000\u0000"+ - "\u0000\u05a2\u05a7\u0003\u00ecv\u0000\u05a3\u05a4\u0005@\u0000\u0000\u05a4"+ - "\u05a6\u0003\u00ecv\u0000\u05a5\u05a3\u0001\u0000\u0000\u0000\u05a6\u05a9"+ - "\u0001\u0000\u0000\u0000\u05a7\u05a5\u0001\u0000\u0000\u0000\u05a7\u05a8"+ - "\u0001\u0000\u0000\u0000\u05a8\u00f1\u0001\u0000\u0000\u0000\u05a9\u05a7"+ - "\u0001\u0000\u0000\u0000\u05aa\u05ab\u0005g\u0000\u0000\u05ab\u05ac\u0003"+ - "4\u001a\u0000\u05ac\u00f3\u0001\u0000\u0000\u0000\u05ad\u05ae\u0005g\u0000"+ - "\u0000\u05ae\u05af\u00034\u001a\u0000\u05af\u05b0\u00059\u0000\u0000\u05b0"+ - "\u05b1\u0003\u00ecv\u0000\u05b1\u05b2\u0005:\u0000\u0000\u05b2\u00f5\u0001"+ - "\u0000\u0000\u0000\u05b3\u05b5\u0005;\u0000\u0000\u05b4\u05b6\u0003\u00f8"+ - "|\u0000\u05b5\u05b4\u0001\u0000\u0000\u0000\u05b5\u05b6\u0001\u0000\u0000"+ - "\u0000\u05b6\u05b8\u0001\u0000\u0000\u0000\u05b7\u05b9\u0005@\u0000\u0000"+ - "\u05b8\u05b7\u0001\u0000\u0000\u0000\u05b8\u05b9\u0001\u0000\u0000\u0000"+ - "\u05b9\u05ba\u0001\u0000\u0000\u0000\u05ba\u05bb\u0005<\u0000\u0000\u05bb"+ - "\u00f7\u0001\u0000\u0000\u0000\u05bc\u05c1\u0003p8\u0000\u05bd\u05be\u0005"+ - "@\u0000\u0000\u05be\u05c0\u0003p8\u0000\u05bf\u05bd\u0001\u0000\u0000"+ - "\u0000\u05c0\u05c3\u0001\u0000\u0000\u0000\u05c1\u05bf\u0001\u0000\u0000"+ - "\u0000\u05c1\u05c2\u0001\u0000\u0000\u0000\u05c2\u00f9\u0001\u0000\u0000"+ - "\u0000\u05c3\u05c1\u0001\u0000\u0000\u0000\u05c4\u05c6\u0005;\u0000\u0000"+ - "\u05c5\u05c7\u0003\u00fc~\u0000\u05c6\u05c5\u0001\u0000\u0000\u0000\u05c6"+ - "\u05c7\u0001\u0000\u0000\u0000\u05c7\u05c8\u0001\u0000\u0000\u0000\u05c8"+ - "\u05c9\u0005<\u0000\u0000\u05c9\u00fb\u0001\u0000\u0000\u0000\u05ca\u05cc"+ - "\u0003\u00fe\u007f\u0000\u05cb\u05ca\u0001\u0000\u0000\u0000\u05cc\u05cd"+ - "\u0001\u0000\u0000\u0000\u05cd\u05cb\u0001\u0000\u0000\u0000\u05cd\u05ce"+ - "\u0001\u0000\u0000\u0000\u05ce\u00fd\u0001\u0000\u0000\u0000\u05cf\u05d3"+ - "\u0003\u0100\u0080\u0000\u05d0\u05d3\u0003P(\u0000\u05d1\u05d3\u0003\u0104"+ - "\u0082\u0000\u05d2\u05cf\u0001\u0000\u0000\u0000\u05d2\u05d0\u0001\u0000"+ - "\u0000\u0000\u05d2\u05d1\u0001\u0000\u0000\u0000\u05d3\u00ff\u0001\u0000"+ - "\u0000\u0000\u05d4\u05d5\u0003\u0102\u0081\u0000\u05d5\u05d6\u0005?\u0000"+ - "\u0000\u05d6\u0101\u0001\u0000\u0000\u0000\u05d7\u05d9\u0003\u009aM\u0000"+ - "\u05d8\u05d7\u0001\u0000\u0000\u0000\u05d9\u05dc\u0001\u0000\u0000\u0000"+ - "\u05da\u05d8\u0001\u0000\u0000\u0000\u05da\u05db\u0001\u0000\u0000\u0000"+ - "\u05db\u05dd\u0001\u0000\u0000\u0000\u05dc\u05da\u0001\u0000\u0000\u0000"+ - "\u05dd\u05de\u0003r9\u0000\u05de\u05df\u0003j5\u0000\u05df\u0103\u0001"+ - "\u0000\u0000\u0000\u05e0\u05e7\u0003\u0108\u0084\u0000\u05e1\u05e7\u0003"+ - "\u010c\u0086\u0000\u05e2\u05e7\u0003\u0114\u008a\u0000\u05e3\u05e7\u0003"+ - "\u0116\u008b\u0000\u05e4\u05e7\u0003\u0128\u0094\u0000\u05e5\u05e7\u0003"+ - "\u012e\u0097\u0000\u05e6\u05e0\u0001\u0000\u0000\u0000\u05e6\u05e1\u0001"+ - "\u0000\u0000\u0000\u05e6\u05e2\u0001\u0000\u0000\u0000\u05e6\u05e3\u0001"+ - "\u0000\u0000\u0000\u05e6\u05e4\u0001\u0000\u0000\u0000\u05e6\u05e5\u0001"+ - "\u0000\u0000\u0000\u05e7\u0105\u0001\u0000\u0000\u0000\u05e8\u05ee\u0003"+ - "\u0108\u0084\u0000\u05e9\u05ee\u0003\u010e\u0087\u0000\u05ea\u05ee\u0003"+ - "\u0118\u008c\u0000\u05eb\u05ee\u0003\u012a\u0095\u0000\u05ec\u05ee\u0003"+ - "\u0130\u0098\u0000\u05ed\u05e8\u0001\u0000\u0000\u0000\u05ed\u05e9\u0001"+ - "\u0000\u0000\u0000\u05ed\u05ea\u0001\u0000\u0000\u0000\u05ed\u05eb\u0001"+ - "\u0000\u0000\u0000\u05ed\u05ec\u0001\u0000\u0000\u0000\u05ee\u0107\u0001"+ - "\u0000\u0000\u0000\u05ef\u05fc\u0003\u00fa}\u0000\u05f0\u05fc\u0003\u010a"+ - "\u0085\u0000\u05f1\u05fc\u0003\u0110\u0088\u0000\u05f2\u05fc\u0003\u011a"+ - "\u008d\u0000\u05f3\u05fc\u0003\u011c\u008e\u0000\u05f4\u05fc\u0003\u012c"+ - "\u0096\u0000\u05f5\u05fc\u0003\u0140\u00a0\u0000\u05f6\u05fc\u0003\u0142"+ - "\u00a1\u0000\u05f7\u05fc\u0003\u0144\u00a2\u0000\u05f8\u05fc\u0003\u0148"+ - "\u00a4\u0000\u05f9\u05fc\u0003\u0146\u00a3\u0000\u05fa\u05fc\u0003\u014a"+ - "\u00a5\u0000\u05fb\u05ef\u0001\u0000\u0000\u0000\u05fb\u05f0\u0001\u0000"+ - "\u0000\u0000\u05fb\u05f1\u0001\u0000\u0000\u0000\u05fb\u05f2\u0001\u0000"+ - "\u0000\u0000\u05fb\u05f3\u0001\u0000\u0000\u0000\u05fb\u05f4\u0001\u0000"+ - "\u0000\u0000\u05fb\u05f5\u0001\u0000\u0000\u0000\u05fb\u05f6\u0001\u0000"+ - "\u0000\u0000\u05fb\u05f7\u0001\u0000\u0000\u0000\u05fb\u05f8\u0001\u0000"+ - "\u0000\u0000\u05fb\u05f9\u0001\u0000\u0000\u0000\u05fb\u05fa\u0001\u0000"+ - "\u0000\u0000\u05fc\u0109\u0001\u0000\u0000\u0000\u05fd\u05fe\u0005?\u0000"+ - "\u0000\u05fe\u010b\u0001\u0000\u0000\u0000\u05ff\u0600\u0005f\u0000\u0000"+ - "\u0600\u0601\u0005H\u0000\u0000\u0601\u0602\u0003\u0104\u0082\u0000\u0602"+ - "\u010d\u0001\u0000\u0000\u0000\u0603\u0604\u0005f\u0000\u0000\u0604\u0605"+ - "\u0005H\u0000\u0000\u0605\u0606\u0003\u0106\u0083\u0000\u0606\u010f\u0001"+ - "\u0000\u0000\u0000\u0607\u0608\u0003\u0112\u0089\u0000\u0608\u0609\u0005"+ - "?\u0000\u0000\u0609\u0111\u0001\u0000\u0000\u0000\u060a\u0612\u0003\u01a8"+ - "\u00d4\u0000\u060b\u0612\u0003\u01c6\u00e3\u0000\u060c\u0612\u0003\u01c8"+ - "\u00e4\u0000\u060d\u0612\u0003\u01ce\u00e7\u0000\u060e\u0612\u0003\u01d2"+ - "\u00e9\u0000\u060f\u0612\u0003\u0186\u00c3\u0000\u0610\u0612\u0003\u0172"+ - "\u00b9\u0000\u0611\u060a\u0001\u0000\u0000\u0000\u0611\u060b\u0001\u0000"+ - "\u0000\u0000\u0611\u060c\u0001\u0000\u0000\u0000\u0611\u060d\u0001\u0000"+ - "\u0000\u0000\u0611\u060e\u0001\u0000\u0000\u0000\u0611\u060f\u0001\u0000"+ - "\u0000\u0000\u0611\u0610\u0001\u0000\u0000\u0000\u0612\u0113\u0001\u0000"+ - "\u0000\u0000\u0613\u0614\u0005\u0016\u0000\u0000\u0614\u0615\u00059\u0000"+ - "\u0000\u0615\u0616\u0003\u019c\u00ce\u0000\u0616\u0617\u0005:\u0000\u0000"+ - "\u0617\u0618\u0003\u0104\u0082\u0000\u0618\u0115\u0001\u0000\u0000\u0000"+ - "\u0619\u061a\u0005\u0016\u0000\u0000\u061a\u061b\u00059\u0000\u0000\u061b"+ - "\u061c\u0003\u019c\u00ce\u0000\u061c\u061d\u0005:\u0000\u0000\u061d\u061e"+ - "\u0003\u0106\u0083\u0000\u061e\u061f\u0005\u000f\u0000\u0000\u061f\u0620"+ - "\u0003\u0104\u0082\u0000\u0620\u0117\u0001\u0000\u0000\u0000\u0621\u0622"+ - "\u0005\u0016\u0000\u0000\u0622\u0623\u00059\u0000\u0000\u0623\u0624\u0003"+ - "\u019c\u00ce\u0000\u0624\u0625\u0005:\u0000\u0000\u0625\u0626\u0003\u0106"+ - "\u0083\u0000\u0626\u0627\u0005\u000f\u0000\u0000\u0627\u0628\u0003\u0106"+ - "\u0083\u0000\u0628\u0119\u0001\u0000\u0000\u0000\u0629\u062a\u0005\u0002"+ - "\u0000\u0000\u062a\u062b\u0003\u019c\u00ce\u0000\u062b\u062c\u0005?\u0000"+ - "\u0000\u062c\u0634\u0001\u0000\u0000\u0000\u062d\u062e\u0005\u0002\u0000"+ - "\u0000\u062e\u062f\u0003\u019c\u00ce\u0000\u062f\u0630\u0005H\u0000\u0000"+ - "\u0630\u0631\u0003\u019c\u00ce\u0000\u0631\u0632\u0005?\u0000\u0000\u0632"+ - "\u0634\u0001\u0000\u0000\u0000\u0633\u0629\u0001\u0000\u0000\u0000\u0633"+ - "\u062d\u0001\u0000\u0000\u0000\u0634\u011b\u0001\u0000\u0000\u0000\u0635"+ - "\u0636\u0005)\u0000\u0000\u0636\u0637\u00059\u0000\u0000\u0637\u0638\u0003"+ - "\u019c\u00ce\u0000\u0638\u0639\u0005:\u0000\u0000\u0639\u063a\u0003\u011e"+ - "\u008f\u0000\u063a\u011d\u0001\u0000\u0000\u0000\u063b\u063f\u0005;\u0000"+ - "\u0000\u063c\u063e\u0003\u0120\u0090\u0000\u063d\u063c\u0001\u0000\u0000"+ - "\u0000\u063e\u0641\u0001\u0000\u0000\u0000\u063f\u063d\u0001\u0000\u0000"+ - "\u0000\u063f\u0640\u0001\u0000\u0000\u0000\u0640\u0645\u0001\u0000\u0000"+ - "\u0000\u0641\u063f\u0001\u0000\u0000\u0000\u0642\u0644\u0003\u0124\u0092"+ - "\u0000\u0643\u0642\u0001\u0000\u0000\u0000\u0644\u0647\u0001\u0000\u0000"+ - "\u0000\u0645\u0643\u0001\u0000\u0000\u0000\u0645\u0646\u0001\u0000\u0000"+ - "\u0000\u0646\u0648\u0001\u0000\u0000\u0000\u0647\u0645\u0001\u0000\u0000"+ - "\u0000\u0648\u0649\u0005<\u0000\u0000\u0649\u011f\u0001\u0000\u0000\u0000"+ - "\u064a\u064b\u0003\u0122\u0091\u0000\u064b\u064c\u0003\u00fc~\u0000\u064c"+ - "\u0121\u0001\u0000\u0000\u0000\u064d\u0651\u0003\u0124\u0092\u0000\u064e"+ - "\u0650\u0003\u0124\u0092\u0000\u064f\u064e\u0001\u0000\u0000\u0000\u0650"+ - "\u0653\u0001\u0000\u0000\u0000\u0651\u064f\u0001\u0000\u0000\u0000\u0651"+ - "\u0652\u0001\u0000\u0000\u0000\u0652\u0123\u0001\u0000\u0000\u0000\u0653"+ - "\u0651\u0001\u0000\u0000\u0000\u0654\u0655\u0005\u0006\u0000\u0000\u0655"+ - "\u0656\u0003\u019a\u00cd\u0000\u0656\u0657\u0005H\u0000\u0000\u0657\u065f"+ - "\u0001\u0000\u0000\u0000\u0658\u0659\u0005\u0006\u0000\u0000\u0659\u065a"+ - "\u0003\u0126\u0093\u0000\u065a\u065b\u0005H\u0000\u0000\u065b\u065f\u0001"+ - "\u0000\u0000\u0000\u065c\u065d\u0005\f\u0000\u0000\u065d\u065f\u0005H"+ - "\u0000\u0000\u065e\u0654\u0001\u0000\u0000\u0000\u065e\u0658\u0001\u0000"+ - "\u0000\u0000\u065e\u065c\u0001\u0000\u0000\u0000\u065f\u0125\u0001\u0000"+ - "\u0000\u0000\u0660\u0661\u0005f\u0000\u0000\u0661\u0127\u0001\u0000\u0000"+ - "\u0000\u0662\u0663\u00052\u0000\u0000\u0663\u0664\u00059\u0000\u0000\u0664"+ - "\u0665\u0003\u019c\u00ce\u0000\u0665\u0666\u0005:\u0000\u0000\u0666\u0667"+ - "\u0003\u0104\u0082\u0000\u0667\u0129\u0001\u0000\u0000\u0000\u0668\u0669"+ - "\u00052\u0000\u0000\u0669\u066a\u00059\u0000\u0000\u066a\u066b\u0003\u019c"+ - "\u00ce\u0000\u066b\u066c\u0005:\u0000\u0000\u066c\u066d\u0003\u0106\u0083"+ - "\u0000\u066d\u012b\u0001\u0000\u0000\u0000\u066e\u066f\u0005\r\u0000\u0000"+ - "\u066f\u0670\u0003\u0104\u0082\u0000\u0670\u0671\u00052\u0000\u0000\u0671"+ - "\u0672\u00059\u0000\u0000\u0672\u0673\u0003\u019c\u00ce\u0000\u0673\u0674"+ - "\u0005:\u0000\u0000\u0674\u0675\u0005?\u0000\u0000\u0675\u012d\u0001\u0000"+ - "\u0000\u0000\u0676\u0679\u0003\u0132\u0099\u0000\u0677\u0679\u0003\u013c"+ - "\u009e\u0000\u0678\u0676\u0001\u0000\u0000\u0000\u0678\u0677\u0001\u0000"+ - "\u0000\u0000\u0679\u012f\u0001\u0000\u0000\u0000\u067a\u067d\u0003\u0134"+ - "\u009a\u0000\u067b\u067d\u0003\u013e\u009f\u0000\u067c\u067a\u0001\u0000"+ - "\u0000\u0000\u067c\u067b\u0001\u0000\u0000\u0000\u067d\u0131\u0001\u0000"+ - "\u0000\u0000\u067e\u067f\u0005\u0015\u0000\u0000\u067f\u0681\u00059\u0000"+ - "\u0000\u0680\u0682\u0003\u0136\u009b\u0000\u0681\u0680\u0001\u0000\u0000"+ - "\u0000\u0681\u0682\u0001\u0000\u0000\u0000\u0682\u0683\u0001\u0000\u0000"+ - "\u0000\u0683\u0685\u0005?\u0000\u0000\u0684\u0686\u0003\u019c\u00ce\u0000"+ - "\u0685\u0684\u0001\u0000\u0000\u0000\u0685\u0686\u0001\u0000\u0000\u0000"+ - "\u0686\u0687\u0001\u0000\u0000\u0000\u0687\u0689\u0005?\u0000\u0000\u0688"+ - "\u068a\u0003\u0138\u009c\u0000\u0689\u0688\u0001\u0000\u0000\u0000\u0689"+ - "\u068a\u0001\u0000\u0000\u0000\u068a\u068b\u0001\u0000\u0000\u0000\u068b"+ - "\u068c\u0005:\u0000\u0000\u068c\u068d\u0003\u0104\u0082\u0000\u068d\u0133"+ - "\u0001\u0000\u0000\u0000\u068e\u068f\u0005\u0015\u0000\u0000\u068f\u0691"+ - "\u00059\u0000\u0000\u0690\u0692\u0003\u0136\u009b\u0000\u0691\u0690\u0001"+ - "\u0000\u0000\u0000\u0691\u0692\u0001\u0000\u0000\u0000\u0692\u0693\u0001"+ - "\u0000\u0000\u0000\u0693\u0695\u0005?\u0000\u0000\u0694\u0696\u0003\u019c"+ - "\u00ce\u0000\u0695\u0694\u0001\u0000\u0000\u0000\u0695\u0696\u0001\u0000"+ - "\u0000\u0000\u0696\u0697\u0001\u0000\u0000\u0000\u0697\u0699\u0005?\u0000"+ - "\u0000\u0698\u069a\u0003\u0138\u009c\u0000\u0699\u0698\u0001\u0000\u0000"+ - "\u0000\u0699\u069a\u0001\u0000\u0000\u0000\u069a\u069b\u0001\u0000\u0000"+ - "\u0000\u069b\u069c\u0005:\u0000\u0000\u069c\u069d\u0003\u0106\u0083\u0000"+ - "\u069d\u0135\u0001\u0000\u0000\u0000\u069e\u06a1\u0003\u013a\u009d\u0000"+ - "\u069f\u06a1\u0003\u0102\u0081\u0000\u06a0\u069e\u0001\u0000\u0000\u0000"+ - "\u06a0\u069f\u0001\u0000\u0000\u0000\u06a1\u0137\u0001\u0000\u0000\u0000"+ - "\u06a2\u06a3\u0003\u013a\u009d\u0000\u06a3\u0139\u0001\u0000\u0000\u0000"+ - "\u06a4\u06a9\u0003\u0112\u0089\u0000\u06a5\u06a6\u0005@\u0000\u0000\u06a6"+ - "\u06a8\u0003\u0112\u0089\u0000\u06a7\u06a5\u0001\u0000\u0000\u0000\u06a8"+ - "\u06ab\u0001\u0000\u0000\u0000\u06a9\u06a7\u0001\u0000\u0000\u0000\u06a9"+ - "\u06aa\u0001\u0000\u0000\u0000\u06aa\u013b\u0001\u0000\u0000\u0000\u06ab"+ - "\u06a9\u0001\u0000\u0000\u0000\u06ac\u06ad\u0005\u0015\u0000\u0000\u06ad"+ - "\u06b1\u00059\u0000\u0000\u06ae\u06b0\u0003\u009aM\u0000\u06af\u06ae\u0001"+ - "\u0000\u0000\u0000\u06b0\u06b3\u0001\u0000\u0000\u0000\u06b1\u06af\u0001"+ - "\u0000\u0000\u0000\u06b1\u06b2\u0001\u0000\u0000\u0000\u06b2\u06b4\u0001"+ - "\u0000\u0000\u0000\u06b3\u06b1\u0001\u0000\u0000\u0000\u06b4\u06b5\u0003"+ - "r9\u0000\u06b5\u06b6\u0003n7\u0000\u06b6\u06b7\u0005H\u0000\u0000\u06b7"+ - "\u06b8\u0003\u019c\u00ce\u0000\u06b8\u06b9\u0005:\u0000\u0000\u06b9\u06ba"+ - "\u0003\u0104\u0082\u0000\u06ba\u013d\u0001\u0000\u0000\u0000\u06bb\u06bc"+ - "\u0005\u0015\u0000\u0000\u06bc\u06c0\u00059\u0000\u0000\u06bd\u06bf\u0003"+ - "\u009aM\u0000\u06be\u06bd\u0001\u0000\u0000\u0000\u06bf\u06c2\u0001\u0000"+ - "\u0000\u0000\u06c0\u06be\u0001\u0000\u0000\u0000\u06c0\u06c1\u0001\u0000"+ - "\u0000\u0000\u06c1\u06c3\u0001\u0000\u0000\u0000\u06c2\u06c0\u0001\u0000"+ - "\u0000\u0000\u06c3\u06c4\u0003r9\u0000\u06c4\u06c5\u0003n7\u0000\u06c5"+ - "\u06c6\u0005H\u0000\u0000\u06c6\u06c7\u0003\u019c\u00ce\u0000\u06c7\u06c8"+ - "\u0005:\u0000\u0000\u06c8\u06c9\u0003\u0106\u0083\u0000\u06c9\u013f\u0001"+ - "\u0000\u0000\u0000\u06ca\u06cc\u0005\u0004\u0000\u0000\u06cb\u06cd\u0005"+ - "f\u0000\u0000\u06cc\u06cb\u0001\u0000\u0000\u0000\u06cc\u06cd\u0001\u0000"+ - "\u0000\u0000\u06cd\u06ce\u0001\u0000\u0000\u0000\u06ce\u06cf\u0005?\u0000"+ - "\u0000\u06cf\u0141\u0001\u0000\u0000\u0000\u06d0\u06d2\u0005\u000b\u0000"+ - "\u0000\u06d1\u06d3\u0005f\u0000\u0000\u06d2\u06d1\u0001\u0000\u0000\u0000"+ - "\u06d2\u06d3\u0001\u0000\u0000\u0000\u06d3\u06d4\u0001\u0000\u0000\u0000"+ - "\u06d4\u06d5\u0005?\u0000\u0000\u06d5\u0143\u0001\u0000\u0000\u0000\u06d6"+ - "\u06d8\u0005$\u0000\u0000\u06d7\u06d9\u0003\u019c\u00ce\u0000\u06d8\u06d7"+ - "\u0001\u0000\u0000\u0000\u06d8\u06d9\u0001\u0000\u0000\u0000\u06d9\u06da"+ - "\u0001\u0000\u0000\u0000\u06da\u06db\u0005?\u0000\u0000\u06db\u0145\u0001"+ - "\u0000\u0000\u0000\u06dc\u06dd\u0005,\u0000\u0000\u06dd\u06de\u0003\u019c"+ - "\u00ce\u0000\u06de\u06df\u0005?\u0000\u0000\u06df\u0147\u0001\u0000\u0000"+ - "\u0000\u06e0\u06e1\u0005*\u0000\u0000\u06e1\u06e2\u00059\u0000\u0000\u06e2"+ - "\u06e3\u0003\u019c\u00ce\u0000\u06e3\u06e4\u0005:\u0000\u0000\u06e4\u06e5"+ - "\u0003\u00fa}\u0000\u06e5\u0149\u0001\u0000\u0000\u0000\u06e6\u06e7\u0005"+ - "/\u0000\u0000\u06e7\u06e8\u0003\u00fa}\u0000\u06e8\u06e9\u0003\u014c\u00a6"+ - "\u0000\u06e9\u06f3\u0001\u0000\u0000\u0000\u06ea\u06eb\u0005/\u0000\u0000"+ - "\u06eb\u06ed\u0003\u00fa}\u0000\u06ec\u06ee\u0003\u014c\u00a6\u0000\u06ed"+ - "\u06ec\u0001\u0000\u0000\u0000\u06ed\u06ee\u0001\u0000\u0000\u0000\u06ee"+ - "\u06ef\u0001\u0000\u0000\u0000\u06ef\u06f0\u0003\u0154\u00aa\u0000\u06f0"+ - "\u06f3\u0001\u0000\u0000\u0000\u06f1\u06f3\u0003\u0156\u00ab\u0000\u06f2"+ - "\u06e6\u0001\u0000\u0000\u0000\u06f2\u06ea\u0001\u0000\u0000\u0000\u06f2"+ - "\u06f1\u0001\u0000\u0000\u0000\u06f3\u014b\u0001\u0000\u0000\u0000\u06f4"+ - "\u06f8\u0003\u014e\u00a7\u0000\u06f5\u06f7\u0003\u014e\u00a7\u0000\u06f6"+ - "\u06f5\u0001\u0000\u0000\u0000\u06f7\u06fa\u0001\u0000\u0000\u0000\u06f8"+ - "\u06f6\u0001\u0000\u0000\u0000\u06f8\u06f9\u0001\u0000\u0000\u0000\u06f9"+ - "\u014d\u0001\u0000\u0000\u0000\u06fa\u06f8\u0001\u0000\u0000\u0000\u06fb"+ - "\u06fc\u0005\u0007\u0000\u0000\u06fc\u06fd\u00059\u0000\u0000\u06fd\u06fe"+ - "\u0003\u0150\u00a8\u0000\u06fe\u06ff\u0005:\u0000\u0000\u06ff\u0700\u0003"+ - "\u00fa}\u0000\u0700\u014f\u0001\u0000\u0000\u0000\u0701\u0703\u0003\u009a"+ - "M\u0000\u0702\u0701\u0001\u0000\u0000\u0000\u0703\u0706\u0001\u0000\u0000"+ - "\u0000\u0704\u0702\u0001\u0000\u0000\u0000\u0704\u0705\u0001\u0000\u0000"+ - "\u0000\u0705\u0707\u0001\u0000\u0000\u0000\u0706\u0704\u0001\u0000\u0000"+ - "\u0000\u0707\u0708\u0003\u0152\u00a9\u0000\u0708\u0709\u0003n7\u0000\u0709"+ - "\u0151\u0001\u0000\u0000\u0000\u070a\u070f\u0003z=\u0000\u070b\u070c\u0005"+ - "V\u0000\u0000\u070c\u070e\u0003\u000e\u0007\u0000\u070d\u070b\u0001\u0000"+ - "\u0000\u0000\u070e\u0711\u0001\u0000\u0000\u0000\u070f\u070d\u0001\u0000"+ - "\u0000\u0000\u070f\u0710\u0001\u0000\u0000\u0000\u0710\u0153\u0001\u0000"+ - "\u0000\u0000\u0711\u070f\u0001\u0000\u0000\u0000\u0712\u0713\u0005\u0013"+ - "\u0000\u0000\u0713\u0714\u0003\u00fa}\u0000\u0714\u0155\u0001\u0000\u0000"+ - "\u0000\u0715\u0716\u0005/\u0000\u0000\u0716\u0717\u0003\u0158\u00ac\u0000"+ - "\u0717\u0719\u0003\u00fa}\u0000\u0718\u071a\u0003\u014c\u00a6\u0000\u0719"+ - "\u0718\u0001\u0000\u0000\u0000\u0719\u071a\u0001\u0000\u0000\u0000\u071a"+ - "\u071c\u0001\u0000\u0000\u0000\u071b\u071d\u0003\u0154\u00aa\u0000\u071c"+ - "\u071b\u0001\u0000\u0000\u0000\u071c\u071d\u0001\u0000\u0000\u0000\u071d"+ - "\u0157\u0001\u0000\u0000\u0000\u071e\u071f\u00059\u0000\u0000\u071f\u0721"+ - "\u0003\u015a\u00ad\u0000\u0720\u0722\u0005?\u0000\u0000\u0721\u0720\u0001"+ - "\u0000\u0000\u0000\u0721\u0722\u0001\u0000\u0000\u0000\u0722\u0723\u0001"+ - "\u0000\u0000\u0000\u0723\u0724\u0005:\u0000\u0000\u0724\u0159\u0001\u0000"+ - "\u0000\u0000\u0725\u072a\u0003\u015c\u00ae\u0000\u0726\u0727\u0005?\u0000"+ - "\u0000\u0727\u0729\u0003\u015c\u00ae\u0000\u0728\u0726\u0001\u0000\u0000"+ - "\u0000\u0729\u072c\u0001\u0000\u0000\u0000\u072a\u0728\u0001\u0000\u0000"+ - "\u0000\u072a\u072b\u0001\u0000\u0000\u0000\u072b\u015b\u0001\u0000\u0000"+ - "\u0000\u072c\u072a\u0001\u0000\u0000\u0000\u072d\u072f\u0003\u009aM\u0000"+ - "\u072e\u072d\u0001\u0000\u0000\u0000\u072f\u0732\u0001\u0000\u0000\u0000"+ - "\u0730\u072e\u0001\u0000\u0000\u0000\u0730\u0731\u0001\u0000\u0000\u0000"+ - "\u0731\u0733\u0001\u0000\u0000\u0000\u0732\u0730\u0001\u0000\u0000\u0000"+ - "\u0733\u0734\u0003r9\u0000\u0734\u0735\u0003n7\u0000\u0735\u0736\u0005"+ - "B\u0000\u0000\u0736\u0737\u0003\u019c\u00ce\u0000\u0737\u015d\u0001\u0000"+ - "\u0000\u0000\u0738\u073b\u0003\u016c\u00b6\u0000\u0739\u073b\u0003\u0194"+ - "\u00ca\u0000\u073a\u0738\u0001\u0000\u0000\u0000\u073a\u0739\u0001\u0000"+ - "\u0000\u0000\u073b\u073f\u0001\u0000\u0000\u0000\u073c\u073e\u0003\u0166"+ - "\u00b3\u0000\u073d\u073c\u0001\u0000\u0000\u0000\u073e\u0741\u0001\u0000"+ - "\u0000\u0000\u073f\u073d\u0001\u0000\u0000\u0000\u073f\u0740\u0001\u0000"+ - "\u0000\u0000\u0740\u015f\u0001\u0000\u0000\u0000\u0741\u073f\u0001\u0000"+ - "\u0000\u0000\u0742\u0760\u0003\u0000\u0000\u0000\u0743\u0748\u00034\u001a"+ - "\u0000\u0744\u0745\u0005=\u0000\u0000\u0745\u0747\u0005>\u0000\u0000\u0746"+ - "\u0744\u0001\u0000\u0000\u0000\u0747\u074a\u0001\u0000\u0000\u0000\u0748"+ - "\u0746\u0001\u0000\u0000\u0000\u0748\u0749\u0001\u0000\u0000\u0000\u0749"+ - "\u074b\u0001\u0000\u0000\u0000\u074a\u0748\u0001\u0000\u0000\u0000\u074b"+ - "\u074c\u0005A\u0000\u0000\u074c\u074d\u0005\t\u0000\u0000\u074d\u0760"+ - "\u0001\u0000\u0000\u0000\u074e\u074f\u00050\u0000\u0000\u074f\u0750\u0005"+ - "A\u0000\u0000\u0750\u0760\u0005\t\u0000\u0000\u0751\u0760\u0005+\u0000"+ - "\u0000\u0752\u0753\u00034\u001a\u0000\u0753\u0754\u0005A\u0000\u0000\u0754"+ - "\u0755\u0005+\u0000\u0000\u0755\u0760\u0001\u0000\u0000\u0000\u0756\u0757"+ - "\u00059\u0000\u0000\u0757\u0758\u0003\u019c\u00ce\u0000\u0758\u0759\u0005"+ - ":\u0000\u0000\u0759\u0760\u0001\u0000\u0000\u0000\u075a\u0760\u0003\u0172"+ - "\u00b9\u0000\u075b\u0760\u0003\u017a\u00bd\u0000\u075c\u0760\u0003\u0180"+ - "\u00c0\u0000\u075d\u0760\u0003\u0186\u00c3\u0000\u075e\u0760\u0003\u018e"+ - "\u00c7\u0000\u075f\u0742\u0001\u0000\u0000\u0000\u075f\u0743\u0001\u0000"+ - "\u0000\u0000\u075f\u074e\u0001\u0000\u0000\u0000\u075f\u0751\u0001\u0000"+ - "\u0000\u0000\u075f\u0752\u0001\u0000\u0000\u0000\u075f\u0756\u0001\u0000"+ - "\u0000\u0000\u075f\u075a\u0001\u0000\u0000\u0000\u075f\u075b\u0001\u0000"+ - "\u0000\u0000\u075f\u075c\u0001\u0000\u0000\u0000\u075f\u075d\u0001\u0000"+ - "\u0000\u0000\u075f\u075e\u0001\u0000\u0000\u0000\u0760\u0161\u0001\u0000"+ - "\u0000\u0000\u0761\u0762\u0001\u0000\u0000\u0000\u0762\u0163\u0001\u0000"+ - "\u0000\u0000\u0763\u0780\u0003\u0000\u0000\u0000\u0764\u0769\u00034\u001a"+ - "\u0000\u0765\u0766\u0005=\u0000\u0000\u0766\u0768\u0005>\u0000\u0000\u0767"+ - "\u0765\u0001\u0000\u0000\u0000\u0768\u076b\u0001\u0000\u0000\u0000\u0769"+ - "\u0767\u0001\u0000\u0000\u0000\u0769\u076a\u0001\u0000\u0000\u0000\u076a"+ - "\u076c\u0001\u0000\u0000\u0000\u076b\u0769\u0001\u0000\u0000\u0000\u076c"+ - "\u076d\u0005A\u0000\u0000\u076d\u076e\u0005\t\u0000\u0000\u076e\u0780"+ - "\u0001\u0000\u0000\u0000\u076f\u0770\u00050\u0000\u0000\u0770\u0771\u0005"+ - "A\u0000\u0000\u0771\u0780\u0005\t\u0000\u0000\u0772\u0780\u0005+\u0000"+ - "\u0000\u0773\u0774\u00034\u001a\u0000\u0774\u0775\u0005A\u0000\u0000\u0775"+ - "\u0776\u0005+\u0000\u0000\u0776\u0780\u0001\u0000\u0000\u0000\u0777\u0778"+ - "\u00059\u0000\u0000\u0778\u0779\u0003\u019c\u00ce\u0000\u0779\u077a\u0005"+ - ":\u0000\u0000\u077a\u0780\u0001\u0000\u0000\u0000\u077b\u0780\u0003\u0172"+ - "\u00b9\u0000\u077c\u0780\u0003\u017a\u00bd\u0000\u077d\u0780\u0003\u0186"+ - "\u00c3\u0000\u077e\u0780\u0003\u018e\u00c7\u0000\u077f\u0763\u0001\u0000"+ - "\u0000\u0000\u077f\u0764\u0001\u0000\u0000\u0000\u077f\u076f\u0001\u0000"+ - "\u0000\u0000\u077f\u0772\u0001\u0000\u0000\u0000\u077f\u0773\u0001\u0000"+ - "\u0000\u0000\u077f\u0777\u0001\u0000\u0000\u0000\u077f\u077b\u0001\u0000"+ - "\u0000\u0000\u077f\u077c\u0001\u0000\u0000\u0000\u077f\u077d\u0001\u0000"+ - "\u0000\u0000\u077f\u077e\u0001\u0000\u0000\u0000\u0780\u0165\u0001\u0000"+ - "\u0000\u0000\u0781\u0787\u0003\u0174\u00ba\u0000\u0782\u0787\u0003\u017c"+ - "\u00be\u0000\u0783\u0787\u0003\u0182\u00c1\u0000\u0784\u0787\u0003\u0188"+ - "\u00c4\u0000\u0785\u0787\u0003\u0190\u00c8\u0000\u0786\u0781\u0001\u0000"+ - "\u0000\u0000\u0786\u0782\u0001\u0000\u0000\u0000\u0786\u0783\u0001\u0000"+ - "\u0000\u0000\u0786\u0784\u0001\u0000\u0000\u0000\u0786\u0785\u0001\u0000"+ - "\u0000\u0000\u0787\u0167\u0001\u0000\u0000\u0000\u0788\u0789\u0001\u0000"+ - "\u0000\u0000\u0789\u0169\u0001\u0000\u0000\u0000\u078a\u078f\u0003\u0174"+ - "\u00ba\u0000\u078b\u078f\u0003\u017c\u00be\u0000\u078c\u078f\u0003\u0188"+ - "\u00c4\u0000\u078d\u078f\u0003\u0190\u00c8\u0000\u078e\u078a\u0001\u0000"+ - "\u0000\u0000\u078e\u078b\u0001\u0000\u0000\u0000\u078e\u078c\u0001\u0000"+ - "\u0000\u0000\u078e\u078d\u0001\u0000\u0000\u0000\u078f\u016b\u0001\u0000"+ - "\u0000\u0000\u0790\u07b9\u0003\u0000\u0000\u0000\u0791\u0796\u00034\u001a"+ - "\u0000\u0792\u0793\u0005=\u0000\u0000\u0793\u0795\u0005>\u0000\u0000\u0794"+ - "\u0792\u0001\u0000\u0000\u0000\u0795\u0798\u0001\u0000\u0000\u0000\u0796"+ - "\u0794\u0001\u0000\u0000\u0000\u0796\u0797\u0001\u0000\u0000\u0000\u0797"+ - "\u0799\u0001\u0000\u0000\u0000\u0798\u0796\u0001\u0000\u0000\u0000\u0799"+ - "\u079a\u0005A\u0000\u0000\u079a\u079b\u0005\t\u0000\u0000\u079b\u07b9"+ - "\u0001\u0000\u0000\u0000\u079c\u07a1\u0003t:\u0000\u079d\u079e\u0005="+ - "\u0000\u0000\u079e\u07a0\u0005>\u0000\u0000\u079f\u079d\u0001\u0000\u0000"+ - "\u0000\u07a0\u07a3\u0001\u0000\u0000\u0000\u07a1\u079f\u0001\u0000\u0000"+ - "\u0000\u07a1\u07a2\u0001\u0000\u0000\u0000\u07a2\u07a4\u0001\u0000\u0000"+ - "\u0000\u07a3\u07a1\u0001\u0000\u0000\u0000\u07a4\u07a5\u0005A\u0000\u0000"+ - "\u07a5\u07a6\u0005\t\u0000\u0000\u07a6\u07b9\u0001\u0000\u0000\u0000\u07a7"+ - "\u07a8\u00050\u0000\u0000\u07a8\u07a9\u0005A\u0000\u0000\u07a9\u07b9\u0005"+ - "\t\u0000\u0000\u07aa\u07b9\u0005+\u0000\u0000\u07ab\u07ac\u00034\u001a"+ - "\u0000\u07ac\u07ad\u0005A\u0000\u0000\u07ad\u07ae\u0005+\u0000\u0000\u07ae"+ - "\u07b9\u0001\u0000\u0000\u0000\u07af\u07b0\u00059\u0000\u0000\u07b0\u07b1"+ - "\u0003\u019c\u00ce\u0000\u07b1\u07b2\u0005:\u0000\u0000\u07b2\u07b9\u0001"+ - "\u0000\u0000\u0000\u07b3\u07b9\u0003\u0176\u00bb\u0000\u07b4\u07b9\u0003"+ - "\u017e\u00bf\u0000\u07b5\u07b9\u0003\u0184\u00c2\u0000\u07b6\u07b9\u0003"+ - "\u018a\u00c5\u0000\u07b7\u07b9\u0003\u0192\u00c9\u0000\u07b8\u0790\u0001"+ - "\u0000\u0000\u0000\u07b8\u0791\u0001\u0000\u0000\u0000\u07b8\u079c\u0001"+ - "\u0000\u0000\u0000\u07b8\u07a7\u0001\u0000\u0000\u0000\u07b8\u07aa\u0001"+ - "\u0000\u0000\u0000\u07b8\u07ab\u0001\u0000\u0000\u0000\u07b8\u07af\u0001"+ - "\u0000\u0000\u0000\u07b8\u07b3\u0001\u0000\u0000\u0000\u07b8\u07b4\u0001"+ - "\u0000\u0000\u0000\u07b8\u07b5\u0001\u0000\u0000\u0000\u07b8\u07b6\u0001"+ - "\u0000\u0000\u0000\u07b8\u07b7\u0001\u0000\u0000\u0000\u07b9\u016d\u0001"+ - "\u0000\u0000\u0000\u07ba\u07bb\u0001\u0000\u0000\u0000\u07bb\u016f\u0001"+ - "\u0000\u0000\u0000\u07bc\u07e4\u0003\u0000\u0000\u0000\u07bd\u07c2\u0003"+ - "4\u001a\u0000\u07be\u07bf\u0005=\u0000\u0000\u07bf\u07c1\u0005>\u0000"+ - "\u0000\u07c0\u07be\u0001\u0000\u0000\u0000\u07c1\u07c4\u0001\u0000\u0000"+ - "\u0000\u07c2\u07c0\u0001\u0000\u0000\u0000\u07c2\u07c3\u0001\u0000\u0000"+ - "\u0000\u07c3\u07c5\u0001\u0000\u0000\u0000\u07c4\u07c2\u0001\u0000\u0000"+ - "\u0000\u07c5\u07c6\u0005A\u0000\u0000\u07c6\u07c7\u0005\t\u0000\u0000"+ - "\u07c7\u07e4\u0001\u0000\u0000\u0000\u07c8\u07cd\u0003t:\u0000\u07c9\u07ca"+ - "\u0005=\u0000\u0000\u07ca\u07cc\u0005>\u0000\u0000\u07cb\u07c9\u0001\u0000"+ - "\u0000\u0000\u07cc\u07cf\u0001\u0000\u0000\u0000\u07cd\u07cb\u0001\u0000"+ - "\u0000\u0000\u07cd\u07ce\u0001\u0000\u0000\u0000\u07ce\u07d0\u0001\u0000"+ - "\u0000\u0000\u07cf\u07cd\u0001\u0000\u0000\u0000\u07d0\u07d1\u0005A\u0000"+ - "\u0000\u07d1\u07d2\u0005\t\u0000\u0000\u07d2\u07e4\u0001\u0000\u0000\u0000"+ - "\u07d3\u07d4\u00050\u0000\u0000\u07d4\u07d5\u0005A\u0000\u0000\u07d5\u07e4"+ - "\u0005\t\u0000\u0000\u07d6\u07e4\u0005+\u0000\u0000\u07d7\u07d8\u0003"+ - "4\u001a\u0000\u07d8\u07d9\u0005A\u0000\u0000\u07d9\u07da\u0005+\u0000"+ - "\u0000\u07da\u07e4\u0001\u0000\u0000\u0000\u07db\u07dc\u00059\u0000\u0000"+ - "\u07dc\u07dd\u0003\u019c\u00ce\u0000\u07dd\u07de\u0005:\u0000\u0000\u07de"+ - "\u07e4\u0001\u0000\u0000\u0000\u07df\u07e4\u0003\u0176\u00bb\u0000\u07e0"+ - "\u07e4\u0003\u017e\u00bf\u0000\u07e1\u07e4\u0003\u018a\u00c5\u0000\u07e2"+ - "\u07e4\u0003\u0192\u00c9\u0000\u07e3\u07bc\u0001\u0000\u0000\u0000\u07e3"+ - "\u07bd\u0001\u0000\u0000\u0000\u07e3\u07c8\u0001\u0000\u0000\u0000\u07e3"+ - "\u07d3\u0001\u0000\u0000\u0000\u07e3\u07d6\u0001\u0000\u0000\u0000\u07e3"+ - "\u07d7\u0001\u0000\u0000\u0000\u07e3\u07db\u0001\u0000\u0000\u0000\u07e3"+ - "\u07df\u0001\u0000\u0000\u0000\u07e3\u07e0\u0001\u0000\u0000\u0000\u07e3"+ - "\u07e1\u0001\u0000\u0000\u0000\u07e3\u07e2\u0001\u0000\u0000\u0000\u07e4"+ - "\u0171\u0001\u0000\u0000\u0000\u07e5\u07e7\u0005\u001f\u0000\u0000\u07e6"+ - "\u07e8\u0003(\u0014\u0000\u07e7\u07e6\u0001\u0000\u0000\u0000\u07e7\u07e8"+ - "\u0001\u0000\u0000\u0000\u07e8\u07ec\u0001\u0000\u0000\u0000\u07e9\u07eb"+ - "\u0003\u00e4r\u0000\u07ea\u07e9\u0001\u0000\u0000\u0000\u07eb\u07ee\u0001"+ - "\u0000\u0000\u0000\u07ec\u07ea\u0001\u0000\u0000\u0000\u07ec\u07ed\u0001"+ - "\u0000\u0000\u0000\u07ed\u07ef\u0001\u0000\u0000\u0000\u07ee\u07ec\u0001"+ - "\u0000\u0000\u0000\u07ef\u07fa\u0005f\u0000\u0000\u07f0\u07f4\u0005A\u0000"+ - "\u0000\u07f1\u07f3\u0003\u00e4r\u0000\u07f2\u07f1\u0001\u0000\u0000\u0000"+ - "\u07f3\u07f6\u0001\u0000\u0000\u0000\u07f4\u07f2\u0001\u0000\u0000\u0000"+ - "\u07f4\u07f5\u0001\u0000\u0000\u0000\u07f5\u07f7\u0001\u0000\u0000\u0000"+ - "\u07f6\u07f4\u0001\u0000\u0000\u0000\u07f7\u07f9\u0005f\u0000\u0000\u07f8"+ - "\u07f0\u0001\u0000\u0000\u0000\u07f9\u07fc\u0001\u0000\u0000\u0000\u07fa"+ - "\u07f8\u0001\u0000\u0000\u0000\u07fa\u07fb\u0001\u0000\u0000\u0000\u07fb"+ - "\u07fe\u0001\u0000\u0000\u0000\u07fc\u07fa\u0001\u0000\u0000\u0000\u07fd"+ - "\u07ff\u0003\u0178\u00bc\u0000\u07fe\u07fd\u0001\u0000\u0000\u0000\u07fe"+ - "\u07ff\u0001\u0000\u0000\u0000\u07ff\u0800\u0001\u0000\u0000\u0000\u0800"+ - "\u0802\u00059\u0000\u0000\u0801\u0803\u0003\u018c\u00c6\u0000\u0802\u0801"+ - "\u0001\u0000\u0000\u0000\u0802\u0803\u0001\u0000\u0000\u0000\u0803\u0804"+ - "\u0001\u0000\u0000\u0000\u0804\u0806\u0005:\u0000\u0000\u0805\u0807\u0003"+ - "`0\u0000\u0806\u0805\u0001\u0000\u0000\u0000\u0806\u0807\u0001\u0000\u0000"+ - "\u0000\u0807\u0839\u0001\u0000\u0000\u0000\u0808\u0809\u00038\u001c\u0000"+ - "\u0809\u080a\u0005A\u0000\u0000\u080a\u080c\u0005\u001f\u0000\u0000\u080b"+ - "\u080d\u0003(\u0014\u0000\u080c\u080b\u0001\u0000\u0000\u0000\u080c\u080d"+ - "\u0001\u0000\u0000\u0000\u080d\u0811\u0001\u0000\u0000\u0000\u080e\u0810"+ - "\u0003\u00e4r\u0000\u080f\u080e\u0001\u0000\u0000\u0000\u0810\u0813\u0001"+ - "\u0000\u0000\u0000\u0811\u080f\u0001\u0000\u0000\u0000\u0811\u0812\u0001"+ - "\u0000\u0000\u0000\u0812\u0814\u0001\u0000\u0000\u0000\u0813\u0811\u0001"+ - "\u0000\u0000\u0000\u0814\u0816\u0005f\u0000\u0000\u0815\u0817\u0003\u0178"+ - "\u00bc\u0000\u0816\u0815\u0001\u0000\u0000\u0000\u0816\u0817\u0001\u0000"+ - "\u0000\u0000\u0817\u0818\u0001\u0000\u0000\u0000\u0818\u081a\u00059\u0000"+ - "\u0000\u0819\u081b\u0003\u018c\u00c6\u0000\u081a\u0819\u0001\u0000\u0000"+ - "\u0000\u081a\u081b\u0001\u0000\u0000\u0000\u081b\u081c\u0001\u0000\u0000"+ - "\u0000\u081c\u081e\u0005:\u0000\u0000\u081d\u081f\u0003`0\u0000\u081e"+ - "\u081d\u0001\u0000\u0000\u0000\u081e\u081f\u0001\u0000\u0000\u0000\u081f"+ - "\u0839\u0001\u0000\u0000\u0000\u0820\u0821\u0003\u015e\u00af\u0000\u0821"+ - "\u0822\u0005A\u0000\u0000\u0822\u0824\u0005\u001f\u0000\u0000\u0823\u0825"+ - "\u0003(\u0014\u0000\u0824\u0823\u0001\u0000\u0000\u0000\u0824\u0825\u0001"+ - "\u0000\u0000\u0000\u0825\u0829\u0001\u0000\u0000\u0000\u0826\u0828\u0003"+ - "\u00e4r\u0000\u0827\u0826\u0001\u0000\u0000\u0000\u0828\u082b\u0001\u0000"+ - "\u0000\u0000\u0829\u0827\u0001\u0000\u0000\u0000\u0829\u082a\u0001\u0000"+ - "\u0000\u0000\u082a\u082c\u0001\u0000\u0000\u0000\u082b\u0829\u0001\u0000"+ - "\u0000\u0000\u082c\u082e\u0005f\u0000\u0000\u082d\u082f\u0003\u0178\u00bc"+ - "\u0000\u082e\u082d\u0001\u0000\u0000\u0000\u082e\u082f\u0001\u0000\u0000"+ - "\u0000\u082f\u0830\u0001\u0000\u0000\u0000\u0830\u0832\u00059\u0000\u0000"+ - "\u0831\u0833\u0003\u018c\u00c6\u0000\u0832\u0831\u0001\u0000\u0000\u0000"+ - "\u0832\u0833\u0001\u0000\u0000\u0000\u0833\u0834\u0001\u0000\u0000\u0000"+ - "\u0834\u0836\u0005:\u0000\u0000\u0835\u0837\u0003`0\u0000\u0836\u0835"+ - "\u0001\u0000\u0000\u0000\u0836\u0837\u0001\u0000\u0000\u0000\u0837\u0839"+ - "\u0001\u0000\u0000\u0000\u0838\u07e5\u0001\u0000\u0000\u0000\u0838\u0808"+ - "\u0001\u0000\u0000\u0000\u0838\u0820\u0001\u0000\u0000\u0000\u0839\u0173"+ - "\u0001\u0000\u0000\u0000\u083a\u083b\u0005A\u0000\u0000\u083b\u083d\u0005"+ - "\u001f\u0000\u0000\u083c\u083e\u0003(\u0014\u0000\u083d\u083c\u0001\u0000"+ - "\u0000\u0000\u083d\u083e\u0001\u0000\u0000\u0000\u083e\u0842\u0001\u0000"+ - "\u0000\u0000\u083f\u0841\u0003\u00e4r\u0000\u0840\u083f\u0001\u0000\u0000"+ - "\u0000\u0841\u0844\u0001\u0000\u0000\u0000\u0842\u0840\u0001\u0000\u0000"+ - "\u0000\u0842\u0843\u0001\u0000\u0000\u0000\u0843\u0845\u0001\u0000\u0000"+ - "\u0000\u0844\u0842\u0001\u0000\u0000\u0000\u0845\u0847\u0005f\u0000\u0000"+ - "\u0846\u0848\u0003\u0178\u00bc\u0000\u0847\u0846\u0001\u0000\u0000\u0000"+ - "\u0847\u0848\u0001\u0000\u0000\u0000\u0848\u0849\u0001\u0000\u0000\u0000"+ - "\u0849\u084b\u00059\u0000\u0000\u084a\u084c\u0003\u018c\u00c6\u0000\u084b"+ - "\u084a\u0001\u0000\u0000\u0000\u084b\u084c\u0001\u0000\u0000\u0000\u084c"+ - "\u084d\u0001\u0000\u0000\u0000\u084d\u084f\u0005:\u0000\u0000\u084e\u0850"+ - "\u0003`0\u0000\u084f\u084e\u0001\u0000\u0000\u0000\u084f\u0850\u0001\u0000"+ - "\u0000\u0000\u0850\u0175\u0001\u0000\u0000\u0000\u0851\u0853\u0005\u001f"+ - "\u0000\u0000\u0852\u0854\u0003(\u0014\u0000\u0853\u0852\u0001\u0000\u0000"+ - "\u0000\u0853\u0854\u0001\u0000\u0000\u0000\u0854\u0858\u0001\u0000\u0000"+ - "\u0000\u0855\u0857\u0003\u00e4r\u0000\u0856\u0855\u0001\u0000\u0000\u0000"+ - "\u0857\u085a\u0001\u0000\u0000\u0000\u0858\u0856\u0001\u0000\u0000\u0000"+ - "\u0858\u0859\u0001\u0000\u0000\u0000\u0859\u085b\u0001\u0000\u0000\u0000"+ - "\u085a\u0858\u0001\u0000\u0000\u0000\u085b\u0866\u0005f\u0000\u0000\u085c"+ - "\u0860\u0005A\u0000\u0000\u085d\u085f\u0003\u00e4r\u0000\u085e\u085d\u0001"+ - "\u0000\u0000\u0000\u085f\u0862\u0001\u0000\u0000\u0000\u0860\u085e\u0001"+ - "\u0000\u0000\u0000\u0860\u0861\u0001\u0000\u0000\u0000\u0861\u0863\u0001"+ - "\u0000\u0000\u0000\u0862\u0860\u0001\u0000\u0000\u0000\u0863\u0865\u0005"+ - "f\u0000\u0000\u0864\u085c\u0001\u0000\u0000\u0000\u0865\u0868\u0001\u0000"+ - "\u0000\u0000\u0866\u0864\u0001\u0000\u0000\u0000\u0866\u0867\u0001\u0000"+ - "\u0000\u0000\u0867\u086a\u0001\u0000\u0000\u0000\u0868\u0866\u0001\u0000"+ - "\u0000\u0000\u0869\u086b\u0003\u0178\u00bc\u0000\u086a\u0869\u0001\u0000"+ - "\u0000\u0000\u086a\u086b\u0001\u0000\u0000\u0000\u086b\u086c\u0001\u0000"+ - "\u0000\u0000\u086c\u086e\u00059\u0000\u0000\u086d\u086f\u0003\u018c\u00c6"+ - "\u0000\u086e\u086d\u0001\u0000\u0000\u0000\u086e\u086f\u0001\u0000\u0000"+ - "\u0000\u086f\u0870\u0001\u0000\u0000\u0000\u0870\u0872\u0005:\u0000\u0000"+ - "\u0871\u0873\u0003`0\u0000\u0872\u0871\u0001\u0000\u0000\u0000\u0872\u0873"+ - "\u0001\u0000\u0000\u0000\u0873\u088d\u0001\u0000\u0000\u0000\u0874\u0875"+ - "\u00038\u001c\u0000\u0875\u0876\u0005A\u0000\u0000\u0876\u0878\u0005\u001f"+ - "\u0000\u0000\u0877\u0879\u0003(\u0014\u0000\u0878\u0877\u0001\u0000\u0000"+ - "\u0000\u0878\u0879\u0001\u0000\u0000\u0000\u0879\u087d\u0001\u0000\u0000"+ - "\u0000\u087a\u087c\u0003\u00e4r\u0000\u087b\u087a\u0001\u0000\u0000\u0000"+ - "\u087c\u087f\u0001\u0000\u0000\u0000\u087d\u087b\u0001\u0000\u0000\u0000"+ - "\u087d\u087e\u0001\u0000\u0000\u0000\u087e\u0880\u0001\u0000\u0000\u0000"+ - "\u087f\u087d\u0001\u0000\u0000\u0000\u0880\u0882\u0005f\u0000\u0000\u0881"+ - "\u0883\u0003\u0178\u00bc\u0000\u0882\u0881\u0001\u0000\u0000\u0000\u0882"+ - "\u0883\u0001\u0000\u0000\u0000\u0883\u0884\u0001\u0000\u0000\u0000\u0884"+ - "\u0886\u00059\u0000\u0000\u0885\u0887\u0003\u018c\u00c6\u0000\u0886\u0885"+ - "\u0001\u0000\u0000\u0000\u0886\u0887\u0001\u0000\u0000\u0000\u0887\u0888"+ - "\u0001\u0000\u0000\u0000\u0888\u088a\u0005:\u0000\u0000\u0889\u088b\u0003"+ - "`0\u0000\u088a\u0889\u0001\u0000\u0000\u0000\u088a\u088b\u0001\u0000\u0000"+ - "\u0000\u088b\u088d\u0001\u0000\u0000\u0000\u088c\u0851\u0001\u0000\u0000"+ - "\u0000\u088c\u0874\u0001\u0000\u0000\u0000\u088d\u0177\u0001\u0000\u0000"+ - "\u0000\u088e\u0892\u0003(\u0014\u0000\u088f\u0890\u0005D\u0000\u0000\u0890"+ - "\u0892\u0005C\u0000\u0000\u0891\u088e\u0001\u0000\u0000\u0000\u0891\u088f"+ - "\u0001\u0000\u0000\u0000\u0892\u0179\u0001\u0000\u0000\u0000\u0893\u0894"+ - "\u0003\u015e\u00af\u0000\u0894\u0895\u0005A\u0000\u0000\u0895\u0896\u0005"+ - "f\u0000\u0000\u0896\u08a1\u0001\u0000\u0000\u0000\u0897\u0898\u0005(\u0000"+ - "\u0000\u0898\u0899\u0005A\u0000\u0000\u0899\u08a1\u0005f\u0000\u0000\u089a"+ - "\u089b\u00034\u001a\u0000\u089b\u089c\u0005A\u0000\u0000\u089c\u089d\u0005"+ - "(\u0000\u0000\u089d\u089e\u0005A\u0000\u0000\u089e\u089f\u0005f\u0000"+ - "\u0000\u089f\u08a1\u0001\u0000\u0000\u0000\u08a0\u0893\u0001\u0000\u0000"+ - "\u0000\u08a0\u0897\u0001\u0000\u0000\u0000\u08a0\u089a\u0001\u0000\u0000"+ - "\u0000\u08a1\u017b\u0001\u0000\u0000\u0000\u08a2\u08a3\u0005A\u0000\u0000"+ - "\u08a3\u08a4\u0005f\u0000\u0000\u08a4\u017d\u0001\u0000\u0000\u0000\u08a5"+ - "\u08a6\u0005(\u0000\u0000\u08a6\u08a7\u0005A\u0000\u0000\u08a7\u08af\u0005"+ - "f\u0000\u0000\u08a8\u08a9\u00034\u001a\u0000\u08a9\u08aa\u0005A\u0000"+ - "\u0000\u08aa\u08ab\u0005(\u0000\u0000\u08ab\u08ac\u0005A\u0000\u0000\u08ac"+ - "\u08ad\u0005f\u0000\u0000\u08ad\u08af\u0001\u0000\u0000\u0000\u08ae\u08a5"+ - "\u0001\u0000\u0000\u0000\u08ae\u08a8\u0001\u0000\u0000\u0000\u08af\u017f"+ - "\u0001\u0000\u0000\u0000\u08b0\u08b1\u00038\u001c\u0000\u08b1\u08b2\u0005"+ - "=\u0000\u0000\u08b2\u08b3\u0003\u019c\u00ce\u0000\u08b3\u08b4\u0005>\u0000"+ - "\u0000\u08b4\u08bb\u0001\u0000\u0000\u0000\u08b5\u08b6\u0003\u0164\u00b2"+ - "\u0000\u08b6\u08b7\u0005=\u0000\u0000\u08b7\u08b8\u0003\u019c\u00ce\u0000"+ - "\u08b8\u08b9\u0005>\u0000\u0000\u08b9\u08bb\u0001\u0000\u0000\u0000\u08ba"+ - "\u08b0\u0001\u0000\u0000\u0000\u08ba\u08b5\u0001\u0000\u0000\u0000\u08bb"+ - "\u08c3\u0001\u0000\u0000\u0000\u08bc\u08bd\u0003\u0162\u00b1\u0000\u08bd"+ - "\u08be\u0005=\u0000\u0000\u08be\u08bf\u0003\u019c\u00ce\u0000\u08bf\u08c0"+ - "\u0005>\u0000\u0000\u08c0\u08c2\u0001\u0000\u0000\u0000\u08c1\u08bc\u0001"+ - "\u0000\u0000\u0000\u08c2\u08c5\u0001\u0000\u0000\u0000\u08c3\u08c1\u0001"+ - "\u0000\u0000\u0000\u08c3\u08c4\u0001\u0000\u0000\u0000\u08c4\u0181\u0001"+ - "\u0000\u0000\u0000\u08c5\u08c3\u0001\u0000\u0000\u0000\u08c6\u08c7\u0003"+ - "\u016a\u00b5\u0000\u08c7\u08c8\u0005=\u0000\u0000\u08c8\u08c9\u0003\u019c"+ - "\u00ce\u0000\u08c9\u08d1\u0005>\u0000\u0000\u08ca\u08cb\u0003\u0168\u00b4"+ - "\u0000\u08cb\u08cc\u0005=\u0000\u0000\u08cc\u08cd\u0003\u019c\u00ce\u0000"+ - "\u08cd\u08ce\u0005>\u0000\u0000\u08ce\u08d0\u0001\u0000\u0000\u0000\u08cf"+ - "\u08ca\u0001\u0000\u0000\u0000\u08d0\u08d3\u0001\u0000\u0000\u0000\u08d1"+ - "\u08cf\u0001\u0000\u0000\u0000\u08d1\u08d2\u0001\u0000\u0000\u0000\u08d2"+ - "\u0183\u0001\u0000\u0000\u0000\u08d3\u08d1\u0001\u0000\u0000\u0000\u08d4"+ - "\u08d5\u00038\u001c\u0000\u08d5\u08d6\u0005=\u0000\u0000\u08d6\u08d7\u0003"+ - "\u019c\u00ce\u0000\u08d7\u08d8\u0005>\u0000\u0000\u08d8\u08df\u0001\u0000"+ - "\u0000\u0000\u08d9\u08da\u0003\u0170\u00b8\u0000\u08da\u08db\u0005=\u0000"+ - "\u0000\u08db\u08dc\u0003\u019c\u00ce\u0000\u08dc\u08dd\u0005>\u0000\u0000"+ - "\u08dd\u08df\u0001\u0000\u0000\u0000\u08de\u08d4\u0001\u0000\u0000\u0000"+ - "\u08de\u08d9\u0001\u0000\u0000\u0000\u08df\u08e7\u0001\u0000\u0000\u0000"+ - "\u08e0\u08e1\u0003\u016e\u00b7\u0000\u08e1\u08e2\u0005=\u0000\u0000\u08e2"+ - "\u08e3\u0003\u019c\u00ce\u0000\u08e3\u08e4\u0005>\u0000\u0000\u08e4\u08e6"+ - "\u0001\u0000\u0000\u0000\u08e5\u08e0\u0001\u0000\u0000\u0000\u08e6\u08e9"+ - "\u0001\u0000\u0000\u0000\u08e7\u08e5\u0001\u0000\u0000\u0000\u08e7\u08e8"+ - "\u0001\u0000\u0000\u0000\u08e8\u0185\u0001\u0000\u0000\u0000\u08e9\u08e7"+ - "\u0001\u0000\u0000\u0000\u08ea\u08eb\u0003:\u001d\u0000\u08eb\u08ed\u0005"+ - "9\u0000\u0000\u08ec\u08ee\u0003\u018c\u00c6\u0000\u08ed\u08ec\u0001\u0000"+ - "\u0000\u0000\u08ed\u08ee\u0001\u0000\u0000\u0000\u08ee\u08ef\u0001\u0000"+ - "\u0000\u0000\u08ef\u08f0\u0005:\u0000\u0000\u08f0\u092f\u0001\u0000\u0000"+ - "\u0000\u08f1\u08f2\u00034\u001a\u0000\u08f2\u08f4\u0005A\u0000\u0000\u08f3"+ - "\u08f5\u0003(\u0014\u0000\u08f4\u08f3\u0001\u0000\u0000\u0000\u08f4\u08f5"+ - "\u0001\u0000\u0000\u0000\u08f5\u08f6\u0001\u0000\u0000\u0000\u08f6\u08f7"+ - "\u0005f\u0000\u0000\u08f7\u08f9\u00059\u0000\u0000\u08f8\u08fa\u0003\u018c"+ - "\u00c6\u0000\u08f9\u08f8\u0001\u0000\u0000\u0000\u08f9\u08fa\u0001\u0000"+ - "\u0000\u0000\u08fa\u08fb\u0001\u0000\u0000\u0000\u08fb\u08fc\u0005:\u0000"+ - "\u0000\u08fc\u092f\u0001\u0000\u0000\u0000\u08fd\u08fe\u00038\u001c\u0000"+ - "\u08fe\u0900\u0005A\u0000\u0000\u08ff\u0901\u0003(\u0014\u0000\u0900\u08ff"+ - "\u0001\u0000\u0000\u0000\u0900\u0901\u0001\u0000\u0000\u0000\u0901\u0902"+ - "\u0001\u0000\u0000\u0000\u0902\u0903\u0005f\u0000\u0000\u0903\u0905\u0005"+ - "9\u0000\u0000\u0904\u0906\u0003\u018c\u00c6\u0000\u0905\u0904\u0001\u0000"+ - "\u0000\u0000\u0905\u0906\u0001\u0000\u0000\u0000\u0906\u0907\u0001\u0000"+ - "\u0000\u0000\u0907\u0908\u0005:\u0000\u0000\u0908\u092f\u0001\u0000\u0000"+ - "\u0000\u0909\u090a\u0003\u015e\u00af\u0000\u090a\u090c\u0005A\u0000\u0000"+ - "\u090b\u090d\u0003(\u0014\u0000\u090c\u090b\u0001\u0000\u0000\u0000\u090c"+ - "\u090d\u0001\u0000\u0000\u0000\u090d\u090e\u0001\u0000\u0000\u0000\u090e"+ - "\u090f\u0005f\u0000\u0000\u090f\u0911\u00059\u0000\u0000\u0910\u0912\u0003"+ - "\u018c\u00c6\u0000\u0911\u0910\u0001\u0000\u0000\u0000\u0911\u0912\u0001"+ - "\u0000\u0000\u0000\u0912\u0913\u0001\u0000\u0000\u0000\u0913\u0914\u0005"+ - ":\u0000\u0000\u0914\u092f\u0001\u0000\u0000\u0000\u0915\u0916\u0005(\u0000"+ - "\u0000\u0916\u0918\u0005A\u0000\u0000\u0917\u0919\u0003(\u0014\u0000\u0918"+ - "\u0917\u0001\u0000\u0000\u0000\u0918\u0919\u0001\u0000\u0000\u0000\u0919"+ - "\u091a\u0001\u0000\u0000\u0000\u091a\u091b\u0005f\u0000\u0000\u091b\u091d"+ - "\u00059\u0000\u0000\u091c\u091e\u0003\u018c\u00c6\u0000\u091d\u091c\u0001"+ - "\u0000\u0000\u0000\u091d\u091e\u0001\u0000\u0000\u0000\u091e\u091f\u0001"+ - "\u0000\u0000\u0000\u091f\u092f\u0005:\u0000\u0000\u0920\u0921\u00034\u001a"+ - "\u0000\u0921\u0922\u0005A\u0000\u0000\u0922\u0923\u0005(\u0000\u0000\u0923"+ - "\u0925\u0005A\u0000\u0000\u0924\u0926\u0003(\u0014\u0000\u0925\u0924\u0001"+ - "\u0000\u0000\u0000\u0925\u0926\u0001\u0000\u0000\u0000\u0926\u0927\u0001"+ - "\u0000\u0000\u0000\u0927\u0928\u0005f\u0000\u0000\u0928\u092a\u00059\u0000"+ - "\u0000\u0929\u092b\u0003\u018c\u00c6\u0000\u092a\u0929\u0001\u0000\u0000"+ - "\u0000\u092a\u092b\u0001\u0000\u0000\u0000\u092b\u092c\u0001\u0000\u0000"+ - "\u0000\u092c\u092d\u0005:\u0000\u0000\u092d\u092f\u0001\u0000\u0000\u0000"+ - "\u092e\u08ea\u0001\u0000\u0000\u0000\u092e\u08f1\u0001\u0000\u0000\u0000"+ - "\u092e\u08fd\u0001\u0000\u0000\u0000\u092e\u0909\u0001\u0000\u0000\u0000"+ - "\u092e\u0915\u0001\u0000\u0000\u0000\u092e\u0920\u0001\u0000\u0000\u0000"+ - "\u092f\u0187\u0001\u0000\u0000\u0000\u0930\u0932\u0005A\u0000\u0000\u0931"+ - "\u0933\u0003(\u0014\u0000\u0932\u0931\u0001\u0000\u0000\u0000\u0932\u0933"+ - "\u0001\u0000\u0000\u0000\u0933\u0934\u0001\u0000\u0000\u0000\u0934\u0935"+ - "\u0005f\u0000\u0000\u0935\u0937\u00059\u0000\u0000\u0936\u0938\u0003\u018c"+ - "\u00c6\u0000\u0937\u0936\u0001\u0000\u0000\u0000\u0937\u0938\u0001\u0000"+ - "\u0000\u0000\u0938\u0939\u0001\u0000\u0000\u0000\u0939\u093a\u0005:\u0000"+ - "\u0000\u093a\u0189\u0001\u0000\u0000\u0000\u093b\u093c\u0003:\u001d\u0000"+ - "\u093c\u093e\u00059\u0000\u0000\u093d\u093f\u0003\u018c\u00c6\u0000\u093e"+ - "\u093d\u0001\u0000\u0000\u0000\u093e\u093f\u0001\u0000\u0000\u0000\u093f"+ - "\u0940\u0001\u0000\u0000\u0000\u0940\u0941\u0005:\u0000\u0000\u0941\u0974"+ - "\u0001\u0000\u0000\u0000\u0942\u0943\u00034\u001a\u0000\u0943\u0945\u0005"+ - "A\u0000\u0000\u0944\u0946\u0003(\u0014\u0000\u0945\u0944\u0001\u0000\u0000"+ - "\u0000\u0945\u0946\u0001\u0000\u0000\u0000\u0946\u0947\u0001\u0000\u0000"+ - "\u0000\u0947\u0948\u0005f\u0000\u0000\u0948\u094a\u00059\u0000\u0000\u0949"+ - "\u094b\u0003\u018c\u00c6\u0000\u094a\u0949\u0001\u0000\u0000\u0000\u094a"+ - "\u094b\u0001\u0000\u0000\u0000\u094b\u094c\u0001\u0000\u0000\u0000\u094c"+ - "\u094d\u0005:\u0000\u0000\u094d\u0974\u0001\u0000\u0000\u0000\u094e\u094f"+ - "\u00038\u001c\u0000\u094f\u0951\u0005A\u0000\u0000\u0950\u0952\u0003("+ - "\u0014\u0000\u0951\u0950\u0001\u0000\u0000\u0000\u0951\u0952\u0001\u0000"+ - "\u0000\u0000\u0952\u0953\u0001\u0000\u0000\u0000\u0953\u0954\u0005f\u0000"+ - "\u0000\u0954\u0956\u00059\u0000\u0000\u0955\u0957\u0003\u018c\u00c6\u0000"+ - "\u0956\u0955\u0001\u0000\u0000\u0000\u0956\u0957\u0001\u0000\u0000\u0000"+ - "\u0957\u0958\u0001\u0000\u0000\u0000\u0958\u0959\u0005:\u0000\u0000\u0959"+ - "\u0974\u0001\u0000\u0000\u0000\u095a\u095b\u0005(\u0000\u0000\u095b\u095d"+ - "\u0005A\u0000\u0000\u095c\u095e\u0003(\u0014\u0000\u095d\u095c\u0001\u0000"+ - "\u0000\u0000\u095d\u095e\u0001\u0000\u0000\u0000\u095e\u095f\u0001\u0000"+ - "\u0000\u0000\u095f\u0960\u0005f\u0000\u0000\u0960\u0962\u00059\u0000\u0000"+ - "\u0961\u0963\u0003\u018c\u00c6\u0000\u0962\u0961\u0001\u0000\u0000\u0000"+ - "\u0962\u0963\u0001\u0000\u0000\u0000\u0963\u0964\u0001\u0000\u0000\u0000"+ - "\u0964\u0974\u0005:\u0000\u0000\u0965\u0966\u00034\u001a\u0000\u0966\u0967"+ - "\u0005A\u0000\u0000\u0967\u0968\u0005(\u0000\u0000\u0968\u096a\u0005A"+ - "\u0000\u0000\u0969\u096b\u0003(\u0014\u0000\u096a\u0969\u0001\u0000\u0000"+ - "\u0000\u096a\u096b\u0001\u0000\u0000\u0000\u096b\u096c\u0001\u0000\u0000"+ - "\u0000\u096c\u096d\u0005f\u0000\u0000\u096d"; - private static final String _serializedATNSegment1 = - "\u096f\u00059\u0000\u0000\u096e\u0970\u0003\u018c\u00c6\u0000\u096f\u096e"+ - "\u0001\u0000\u0000\u0000\u096f\u0970\u0001\u0000\u0000\u0000\u0970\u0971"+ - "\u0001\u0000\u0000\u0000\u0971\u0972\u0005:\u0000\u0000\u0972\u0974\u0001"+ - "\u0000\u0000\u0000\u0973\u093b\u0001\u0000\u0000\u0000\u0973\u0942\u0001"+ - "\u0000\u0000\u0000\u0973\u094e\u0001\u0000\u0000\u0000\u0973\u095a\u0001"+ - "\u0000\u0000\u0000\u0973\u0965\u0001\u0000\u0000\u0000\u0974\u018b\u0001"+ - "\u0000\u0000\u0000\u0975\u097a\u0003\u019c\u00ce\u0000\u0976\u0977\u0005"+ - "@\u0000\u0000\u0977\u0979\u0003\u019c\u00ce\u0000\u0978\u0976\u0001\u0000"+ - "\u0000\u0000\u0979\u097c\u0001\u0000\u0000\u0000\u097a\u0978\u0001\u0000"+ - "\u0000\u0000\u097a\u097b\u0001\u0000\u0000\u0000\u097b\u018d\u0001\u0000"+ - "\u0000\u0000\u097c\u097a\u0001\u0000\u0000\u0000\u097d\u097e\u00038\u001c"+ - "\u0000\u097e\u0980\u0005Z\u0000\u0000\u097f\u0981\u0003(\u0014\u0000\u0980"+ - "\u097f\u0001\u0000\u0000\u0000\u0980\u0981\u0001\u0000\u0000\u0000\u0981"+ - "\u0982\u0001\u0000\u0000\u0000\u0982\u0983\u0005f\u0000\u0000\u0983\u09ad"+ - "\u0001\u0000\u0000\u0000\u0984\u0985\u0003\n\u0005\u0000\u0985\u0987\u0005"+ - "Z\u0000\u0000\u0986\u0988\u0003(\u0014\u0000\u0987\u0986\u0001\u0000\u0000"+ - "\u0000\u0987\u0988\u0001\u0000\u0000\u0000\u0988\u0989\u0001\u0000\u0000"+ - "\u0000\u0989\u098a\u0005f\u0000\u0000\u098a\u09ad\u0001\u0000\u0000\u0000"+ - "\u098b\u098c\u0003\u015e\u00af\u0000\u098c\u098e\u0005Z\u0000\u0000\u098d"+ - "\u098f\u0003(\u0014\u0000\u098e\u098d\u0001\u0000\u0000\u0000\u098e\u098f"+ - "\u0001\u0000\u0000\u0000\u098f\u0990\u0001\u0000\u0000\u0000\u0990\u0991"+ - "\u0005f\u0000\u0000\u0991\u09ad\u0001\u0000\u0000\u0000\u0992\u0993\u0005"+ - "(\u0000\u0000\u0993\u0995\u0005Z\u0000\u0000\u0994\u0996\u0003(\u0014"+ - "\u0000\u0995\u0994\u0001\u0000\u0000\u0000\u0995\u0996\u0001\u0000\u0000"+ - "\u0000\u0996\u0997\u0001\u0000\u0000\u0000\u0997\u09ad\u0005f\u0000\u0000"+ - "\u0998\u0999\u00034\u001a\u0000\u0999\u099a\u0005A\u0000\u0000\u099a\u099b"+ - "\u0005(\u0000\u0000\u099b\u099d\u0005Z\u0000\u0000\u099c\u099e\u0003("+ - "\u0014\u0000\u099d\u099c\u0001\u0000\u0000\u0000\u099d\u099e\u0001\u0000"+ - "\u0000\u0000\u099e\u099f\u0001\u0000\u0000\u0000\u099f\u09a0\u0005f\u0000"+ - "\u0000\u09a0\u09ad\u0001\u0000\u0000\u0000\u09a1\u09a2\u0003\u000e\u0007"+ - "\u0000\u09a2\u09a4\u0005Z\u0000\u0000\u09a3\u09a5\u0003(\u0014\u0000\u09a4"+ - "\u09a3\u0001\u0000\u0000\u0000\u09a4\u09a5\u0001\u0000\u0000\u0000\u09a5"+ - "\u09a6\u0001\u0000\u0000\u0000\u09a6\u09a7\u0005\u001f\u0000\u0000\u09a7"+ - "\u09ad\u0001\u0000\u0000\u0000\u09a8\u09a9\u0003\u001c\u000e\u0000\u09a9"+ - "\u09aa\u0005Z\u0000\u0000\u09aa\u09ab\u0005\u001f\u0000\u0000\u09ab\u09ad"+ - "\u0001\u0000\u0000\u0000\u09ac\u097d\u0001\u0000\u0000\u0000\u09ac\u0984"+ - "\u0001\u0000\u0000\u0000\u09ac\u098b\u0001\u0000\u0000\u0000\u09ac\u0992"+ - "\u0001\u0000\u0000\u0000\u09ac\u0998\u0001\u0000\u0000\u0000\u09ac\u09a1"+ - "\u0001\u0000\u0000\u0000\u09ac\u09a8\u0001\u0000\u0000\u0000\u09ad\u018f"+ - "\u0001\u0000\u0000\u0000\u09ae\u09b0\u0005Z\u0000\u0000\u09af\u09b1\u0003"+ - "(\u0014\u0000\u09b0\u09af\u0001\u0000\u0000\u0000\u09b0\u09b1\u0001\u0000"+ - "\u0000\u0000\u09b1\u09b2\u0001\u0000\u0000\u0000\u09b2\u09b3\u0005f\u0000"+ - "\u0000\u09b3\u0191\u0001\u0000\u0000\u0000\u09b4\u09b5\u00038\u001c\u0000"+ - "\u09b5\u09b7\u0005Z\u0000\u0000\u09b6\u09b8\u0003(\u0014\u0000\u09b7\u09b6"+ - "\u0001\u0000\u0000\u0000\u09b7\u09b8\u0001\u0000\u0000\u0000\u09b8\u09b9"+ - "\u0001\u0000\u0000\u0000\u09b9\u09ba\u0005f\u0000\u0000\u09ba\u09dd\u0001"+ - "\u0000\u0000\u0000\u09bb\u09bc\u0003\n\u0005\u0000\u09bc\u09be\u0005Z"+ - "\u0000\u0000\u09bd\u09bf\u0003(\u0014\u0000\u09be\u09bd\u0001\u0000\u0000"+ - "\u0000\u09be\u09bf\u0001\u0000\u0000\u0000\u09bf\u09c0\u0001\u0000\u0000"+ - "\u0000\u09c0\u09c1\u0005f\u0000\u0000\u09c1\u09dd\u0001\u0000\u0000\u0000"+ - "\u09c2\u09c3\u0005(\u0000\u0000\u09c3\u09c5\u0005Z\u0000\u0000\u09c4\u09c6"+ - "\u0003(\u0014\u0000\u09c5\u09c4\u0001\u0000\u0000\u0000\u09c5\u09c6\u0001"+ - "\u0000\u0000\u0000\u09c6\u09c7\u0001\u0000\u0000\u0000\u09c7\u09dd\u0005"+ - "f\u0000\u0000\u09c8\u09c9\u00034\u001a\u0000\u09c9\u09ca\u0005A\u0000"+ - "\u0000\u09ca\u09cb\u0005(\u0000\u0000\u09cb\u09cd\u0005Z\u0000\u0000\u09cc"+ - "\u09ce\u0003(\u0014\u0000\u09cd\u09cc\u0001\u0000\u0000\u0000\u09cd\u09ce"+ - "\u0001\u0000\u0000\u0000\u09ce\u09cf\u0001\u0000\u0000\u0000\u09cf\u09d0"+ - "\u0005f\u0000\u0000\u09d0\u09dd\u0001\u0000\u0000\u0000\u09d1\u09d2\u0003"+ - "\u000e\u0007\u0000\u09d2\u09d4\u0005Z\u0000\u0000\u09d3\u09d5\u0003(\u0014"+ - "\u0000\u09d4\u09d3\u0001\u0000\u0000\u0000\u09d4\u09d5\u0001\u0000\u0000"+ - "\u0000\u09d5\u09d6\u0001\u0000\u0000\u0000\u09d6\u09d7\u0005\u001f\u0000"+ - "\u0000\u09d7\u09dd\u0001\u0000\u0000\u0000\u09d8\u09d9\u0003\u001c\u000e"+ - "\u0000\u09d9\u09da\u0005Z\u0000\u0000\u09da\u09db\u0005\u001f\u0000\u0000"+ - "\u09db\u09dd\u0001\u0000\u0000\u0000\u09dc\u09b4\u0001\u0000\u0000\u0000"+ - "\u09dc\u09bb\u0001\u0000\u0000\u0000\u09dc\u09c2\u0001\u0000\u0000\u0000"+ - "\u09dc\u09c8\u0001\u0000\u0000\u0000\u09dc\u09d1\u0001\u0000\u0000\u0000"+ - "\u09dc\u09d8\u0001\u0000\u0000\u0000\u09dd\u0193\u0001\u0000\u0000\u0000"+ - "\u09de\u09df\u0005\u001f\u0000\u0000\u09df\u09e0\u0003\u0002\u0001\u0000"+ - "\u09e0\u09e2\u0003\u0196\u00cb\u0000\u09e1\u09e3\u0003\u001e\u000f\u0000"+ - "\u09e2\u09e1\u0001\u0000\u0000\u0000\u09e2\u09e3\u0001\u0000\u0000\u0000"+ - "\u09e3\u09f5\u0001\u0000\u0000\u0000\u09e4\u09e5\u0005\u001f\u0000\u0000"+ - "\u09e5\u09e6\u0003\f\u0006\u0000\u09e6\u09e8\u0003\u0196\u00cb\u0000\u09e7"+ - "\u09e9\u0003\u001e\u000f\u0000\u09e8\u09e7\u0001\u0000\u0000\u0000\u09e8"+ - "\u09e9\u0001\u0000\u0000\u0000\u09e9\u09f5\u0001\u0000\u0000\u0000\u09ea"+ - "\u09eb\u0005\u001f\u0000\u0000\u09eb\u09ec\u0003\u0002\u0001\u0000\u09ec"+ - "\u09ed\u0003\u001e\u000f\u0000\u09ed\u09ee\u0003\u00f6{\u0000\u09ee\u09f5"+ - "\u0001\u0000\u0000\u0000\u09ef\u09f0\u0005\u001f\u0000\u0000\u09f0\u09f1"+ - "\u0003\f\u0006\u0000\u09f1\u09f2\u0003\u001e\u000f\u0000\u09f2\u09f3\u0003"+ - "\u00f6{\u0000\u09f3\u09f5\u0001\u0000\u0000\u0000\u09f4\u09de\u0001\u0000"+ - "\u0000\u0000\u09f4\u09e4\u0001\u0000\u0000\u0000\u09f4\u09ea\u0001\u0000"+ - "\u0000\u0000\u09f4\u09ef\u0001\u0000\u0000\u0000\u09f5\u0195\u0001\u0000"+ - "\u0000\u0000\u09f6\u09fa\u0003\u0198\u00cc\u0000\u09f7\u09f9\u0003\u0198"+ - "\u00cc\u0000\u09f8\u09f7\u0001\u0000\u0000\u0000\u09f9\u09fc\u0001\u0000"+ - "\u0000\u0000\u09fa\u09f8\u0001\u0000\u0000\u0000\u09fa\u09fb\u0001\u0000"+ - "\u0000\u0000\u09fb\u0197\u0001\u0000\u0000\u0000\u09fc\u09fa\u0001\u0000"+ - "\u0000\u0000\u09fd\u09ff\u0003\u00e4r\u0000\u09fe\u09fd\u0001\u0000\u0000"+ - "\u0000\u09ff\u0a02\u0001\u0000\u0000\u0000\u0a00\u09fe\u0001\u0000\u0000"+ - "\u0000\u0a00\u0a01\u0001\u0000\u0000\u0000\u0a01\u0a03\u0001\u0000\u0000"+ - "\u0000\u0a02\u0a00\u0001\u0000\u0000\u0000\u0a03\u0a04\u0005=\u0000\u0000"+ - "\u0a04\u0a05\u0003\u019c\u00ce\u0000\u0a05\u0a06\u0005>\u0000\u0000\u0a06"+ - "\u0199\u0001\u0000\u0000\u0000\u0a07\u0a08\u0003\u019c\u00ce\u0000\u0a08"+ - "\u019b\u0001\u0000\u0000\u0000\u0a09\u0a0c\u0003\u019e\u00cf\u0000\u0a0a"+ - "\u0a0c\u0003\u01a6\u00d3\u0000\u0a0b\u0a09\u0001\u0000\u0000\u0000\u0a0b"+ - "\u0a0a\u0001\u0000\u0000\u0000\u0a0c\u019d\u0001\u0000\u0000\u0000\u0a0d"+ - "\u0a0e\u0003\u01a0\u00d0\u0000\u0a0e\u0a0f\u0005Y\u0000\u0000\u0a0f\u0a10"+ - "\u0003\u01a4\u00d2\u0000\u0a10\u019f\u0001\u0000\u0000\u0000\u0a11\u0a1c"+ - "\u0005f\u0000\u0000\u0a12\u0a14\u00059\u0000\u0000\u0a13\u0a15\u0003\u0094"+ - "J\u0000\u0a14\u0a13\u0001\u0000\u0000\u0000\u0a14\u0a15\u0001\u0000\u0000"+ - "\u0000\u0a15\u0a16\u0001\u0000\u0000\u0000\u0a16\u0a1c\u0005:\u0000\u0000"+ - "\u0a17\u0a18\u00059\u0000\u0000\u0a18\u0a19\u0003\u01a2\u00d1\u0000\u0a19"+ - "\u0a1a\u0005:\u0000\u0000\u0a1a\u0a1c\u0001\u0000\u0000\u0000\u0a1b\u0a11"+ - "\u0001\u0000\u0000\u0000\u0a1b\u0a12\u0001\u0000\u0000\u0000\u0a1b\u0a17"+ - "\u0001\u0000\u0000\u0000\u0a1c\u01a1\u0001\u0000\u0000\u0000\u0a1d\u0a22"+ - "\u0005f\u0000\u0000\u0a1e\u0a1f\u0005@\u0000\u0000\u0a1f\u0a21\u0005f"+ - "\u0000\u0000\u0a20\u0a1e\u0001\u0000\u0000\u0000\u0a21\u0a24\u0001\u0000"+ - "\u0000\u0000\u0a22\u0a20\u0001\u0000\u0000\u0000\u0a22\u0a23\u0001\u0000"+ - "\u0000\u0000\u0a23\u01a3\u0001\u0000\u0000\u0000\u0a24\u0a22\u0001\u0000"+ - "\u0000\u0000\u0a25\u0a28\u0003\u019c\u00ce\u0000\u0a26\u0a28\u0003\u00fa"+ - "}\u0000\u0a27\u0a25\u0001\u0000\u0000\u0000\u0a27\u0a26\u0001\u0000\u0000"+ - "\u0000\u0a28\u01a5\u0001\u0000\u0000\u0000\u0a29\u0a2c\u0003\u01ae\u00d7"+ - "\u0000\u0a2a\u0a2c\u0003\u01a8\u00d4\u0000\u0a2b\u0a29\u0001\u0000\u0000"+ - "\u0000\u0a2b\u0a2a\u0001\u0000\u0000\u0000\u0a2c\u01a7\u0001\u0000\u0000"+ - "\u0000\u0a2d\u0a2e\u0003\u01aa\u00d5\u0000\u0a2e\u0a2f\u0003\u01ac\u00d6"+ - "\u0000\u0a2f\u0a30\u0003\u019c\u00ce\u0000\u0a30\u01a9\u0001\u0000\u0000"+ - "\u0000\u0a31\u0a35\u00038\u001c\u0000\u0a32\u0a35\u0003\u017a\u00bd\u0000"+ - "\u0a33\u0a35\u0003\u0180\u00c0\u0000\u0a34\u0a31\u0001\u0000\u0000\u0000"+ - "\u0a34\u0a32\u0001\u0000\u0000\u0000\u0a34\u0a33\u0001\u0000\u0000\u0000"+ - "\u0a35\u01ab\u0001\u0000\u0000\u0000\u0a36\u0a37\u0007\u0003\u0000\u0000"+ - "\u0a37\u01ad\u0001\u0000\u0000\u0000\u0a38\u0a40\u0003\u01b0\u00d8\u0000"+ - "\u0a39\u0a3a\u0003\u01b0\u00d8\u0000\u0a3a\u0a3b\u0005G\u0000\u0000\u0a3b"+ - "\u0a3c\u0003\u019c\u00ce\u0000\u0a3c\u0a3d\u0005H\u0000\u0000\u0a3d\u0a3e"+ - "\u0003\u01ae\u00d7\u0000\u0a3e\u0a40\u0001\u0000\u0000\u0000\u0a3f\u0a38"+ - "\u0001\u0000\u0000\u0000\u0a3f\u0a39\u0001\u0000\u0000\u0000\u0a40\u01af"+ - "\u0001\u0000\u0000\u0000\u0a41\u0a42\u0006\u00d8\uffff\uffff\u0000\u0a42"+ - "\u0a43\u0003\u01b2\u00d9\u0000\u0a43\u0a49\u0001\u0000\u0000\u0000\u0a44"+ - "\u0a45\n\u0001\u0000\u0000\u0a45\u0a46\u0005N\u0000\u0000\u0a46\u0a48"+ - "\u0003\u01b2\u00d9\u0000\u0a47\u0a44\u0001\u0000\u0000\u0000\u0a48\u0a4b"+ - "\u0001\u0000\u0000\u0000\u0a49\u0a47\u0001\u0000\u0000\u0000\u0a49\u0a4a"+ - "\u0001\u0000\u0000\u0000\u0a4a\u01b1\u0001\u0000\u0000\u0000\u0a4b\u0a49"+ - "\u0001\u0000\u0000\u0000\u0a4c\u0a4d\u0006\u00d9\uffff\uffff\u0000\u0a4d"+ - "\u0a4e\u0003\u01b4\u00da\u0000\u0a4e\u0a54\u0001\u0000\u0000\u0000\u0a4f"+ - "\u0a50\n\u0001\u0000\u0000\u0a50\u0a51\u0005M\u0000\u0000\u0a51\u0a53"+ - "\u0003\u01b4\u00da\u0000\u0a52\u0a4f\u0001\u0000\u0000\u0000\u0a53\u0a56"+ - "\u0001\u0000\u0000\u0000\u0a54\u0a52\u0001\u0000\u0000\u0000\u0a54\u0a55"+ - "\u0001\u0000\u0000\u0000\u0a55\u01b3\u0001\u0000\u0000\u0000\u0a56\u0a54"+ - "\u0001\u0000\u0000\u0000\u0a57\u0a58\u0006\u00da\uffff\uffff\u0000\u0a58"+ - "\u0a59\u0003\u01b6\u00db\u0000\u0a59\u0a5f\u0001\u0000\u0000\u0000\u0a5a"+ - "\u0a5b\n\u0001\u0000\u0000\u0a5b\u0a5c\u0005V\u0000\u0000\u0a5c\u0a5e"+ - "\u0003\u01b6\u00db\u0000\u0a5d\u0a5a\u0001\u0000\u0000\u0000\u0a5e\u0a61"+ - "\u0001\u0000\u0000\u0000\u0a5f\u0a5d\u0001\u0000\u0000\u0000\u0a5f\u0a60"+ - "\u0001\u0000\u0000\u0000\u0a60\u01b5\u0001\u0000\u0000\u0000\u0a61\u0a5f"+ - "\u0001\u0000\u0000\u0000\u0a62\u0a63\u0006\u00db\uffff\uffff\u0000\u0a63"+ - "\u0a64\u0003\u01b8\u00dc\u0000\u0a64\u0a6a\u0001\u0000\u0000\u0000\u0a65"+ - "\u0a66\n\u0001\u0000\u0000\u0a66\u0a67\u0005W\u0000\u0000\u0a67\u0a69"+ - "\u0003\u01b8\u00dc\u0000\u0a68\u0a65\u0001\u0000\u0000\u0000\u0a69\u0a6c"+ - "\u0001\u0000\u0000\u0000\u0a6a\u0a68\u0001\u0000\u0000\u0000\u0a6a\u0a6b"+ - "\u0001\u0000\u0000\u0000\u0a6b\u01b7\u0001\u0000\u0000\u0000\u0a6c\u0a6a"+ - "\u0001\u0000\u0000\u0000\u0a6d\u0a6e\u0006\u00dc\uffff\uffff\u0000\u0a6e"+ - "\u0a6f\u0003\u01ba\u00dd\u0000\u0a6f\u0a75\u0001\u0000\u0000\u0000\u0a70"+ - "\u0a71\n\u0001\u0000\u0000\u0a71\u0a72\u0005U\u0000\u0000\u0a72\u0a74"+ - "\u0003\u01ba\u00dd\u0000\u0a73\u0a70\u0001\u0000\u0000\u0000\u0a74\u0a77"+ - "\u0001\u0000\u0000\u0000\u0a75\u0a73\u0001\u0000\u0000\u0000\u0a75\u0a76"+ - "\u0001\u0000\u0000\u0000\u0a76\u01b9\u0001\u0000\u0000\u0000\u0a77\u0a75"+ - "\u0001\u0000\u0000\u0000\u0a78\u0a79\u0006\u00dd\uffff\uffff\u0000\u0a79"+ - "\u0a7a\u0003\u01bc\u00de\u0000\u0a7a\u0a83\u0001\u0000\u0000\u0000\u0a7b"+ - "\u0a7c\n\u0002\u0000\u0000\u0a7c\u0a7d\u0005I\u0000\u0000\u0a7d\u0a82"+ - "\u0003\u01bc\u00de\u0000\u0a7e\u0a7f\n\u0001\u0000\u0000\u0a7f\u0a80\u0005"+ - "L\u0000\u0000\u0a80\u0a82\u0003\u01bc\u00de\u0000\u0a81\u0a7b\u0001\u0000"+ - "\u0000\u0000\u0a81\u0a7e\u0001\u0000\u0000\u0000\u0a82\u0a85\u0001\u0000"+ - "\u0000\u0000\u0a83\u0a81\u0001\u0000\u0000\u0000\u0a83\u0a84\u0001\u0000"+ - "\u0000\u0000\u0a84\u01bb\u0001\u0000\u0000\u0000\u0a85\u0a83\u0001\u0000"+ - "\u0000\u0000\u0a86\u0a87\u0006\u00de\uffff\uffff\u0000\u0a87\u0a88\u0003"+ - "\u01be\u00df\u0000\u0a88\u0a9a\u0001\u0000\u0000\u0000\u0a89\u0a8a\n\u0005"+ - "\u0000\u0000\u0a8a\u0a8b\u0005D\u0000\u0000\u0a8b\u0a99\u0003\u01be\u00df"+ - "\u0000\u0a8c\u0a8d\n\u0004\u0000\u0000\u0a8d\u0a8e\u0005C\u0000\u0000"+ - "\u0a8e\u0a99\u0003\u01be\u00df\u0000\u0a8f\u0a90\n\u0003\u0000\u0000\u0a90"+ - "\u0a91\u0005J\u0000\u0000\u0a91\u0a99\u0003\u01be\u00df\u0000\u0a92\u0a93"+ - "\n\u0002\u0000\u0000\u0a93\u0a94\u0005K\u0000\u0000\u0a94\u0a99\u0003"+ - "\u01be\u00df\u0000\u0a95\u0a96\n\u0001\u0000\u0000\u0a96\u0a97\u0005\u001a"+ - "\u0000\u0000\u0a97\u0a99\u0003\n\u0005\u0000\u0a98\u0a89\u0001\u0000\u0000"+ - "\u0000\u0a98\u0a8c\u0001\u0000\u0000\u0000\u0a98\u0a8f\u0001\u0000\u0000"+ - "\u0000\u0a98\u0a92\u0001\u0000\u0000\u0000\u0a98\u0a95\u0001\u0000\u0000"+ - "\u0000\u0a99\u0a9c\u0001\u0000\u0000\u0000\u0a9a\u0a98\u0001\u0000\u0000"+ - "\u0000\u0a9a\u0a9b\u0001\u0000\u0000\u0000\u0a9b\u01bd\u0001\u0000\u0000"+ - "\u0000\u0a9c\u0a9a\u0001\u0000\u0000\u0000\u0a9d\u0a9e\u0006\u00df\uffff"+ - "\uffff\u0000\u0a9e\u0a9f\u0003\u01c0\u00e0\u0000\u0a9f\u0aaf\u0001\u0000"+ - "\u0000\u0000\u0aa0\u0aa1\n\u0003\u0000\u0000\u0aa1\u0aa2\u0005D\u0000"+ - "\u0000\u0aa2\u0aa3\u0005D\u0000\u0000\u0aa3\u0aae\u0003\u01c0\u00e0\u0000"+ - "\u0aa4\u0aa5\n\u0002\u0000\u0000\u0aa5\u0aa6\u0005C\u0000\u0000\u0aa6"+ - "\u0aa7\u0005C\u0000\u0000\u0aa7\u0aae\u0003\u01c0\u00e0\u0000\u0aa8\u0aa9"+ - "\n\u0001\u0000\u0000\u0aa9\u0aaa\u0005C\u0000\u0000\u0aaa\u0aab\u0005"+ - "C\u0000\u0000\u0aab\u0aac\u0005C\u0000\u0000\u0aac\u0aae\u0003\u01c0\u00e0"+ - "\u0000\u0aad\u0aa0\u0001\u0000\u0000\u0000\u0aad\u0aa4\u0001\u0000\u0000"+ - "\u0000\u0aad\u0aa8\u0001\u0000\u0000\u0000\u0aae\u0ab1\u0001\u0000\u0000"+ - "\u0000\u0aaf\u0aad\u0001\u0000\u0000\u0000\u0aaf\u0ab0\u0001\u0000\u0000"+ - "\u0000\u0ab0\u01bf\u0001\u0000\u0000\u0000\u0ab1\u0aaf\u0001\u0000\u0000"+ - "\u0000\u0ab2\u0ab3\u0006\u00e0\uffff\uffff\u0000\u0ab3\u0ab4\u0003\u01c2"+ - "\u00e1\u0000\u0ab4\u0abd\u0001\u0000\u0000\u0000\u0ab5\u0ab6\n\u0002\u0000"+ - "\u0000\u0ab6\u0ab7\u0005Q\u0000\u0000\u0ab7\u0abc\u0003\u01c2\u00e1\u0000"+ - "\u0ab8\u0ab9\n\u0001\u0000\u0000\u0ab9\u0aba\u0005R\u0000\u0000\u0aba"+ - "\u0abc\u0003\u01c2\u00e1\u0000\u0abb\u0ab5\u0001\u0000\u0000\u0000\u0abb"+ - "\u0ab8\u0001\u0000\u0000\u0000\u0abc\u0abf\u0001\u0000\u0000\u0000\u0abd"+ - "\u0abb\u0001\u0000\u0000\u0000\u0abd\u0abe\u0001\u0000\u0000\u0000\u0abe"+ - "\u01c1\u0001\u0000\u0000\u0000\u0abf\u0abd\u0001\u0000\u0000\u0000\u0ac0"+ - "\u0ac1\u0006\u00e1\uffff\uffff\u0000\u0ac1\u0ac2\u0003\u01c4\u00e2\u0000"+ - "\u0ac2\u0ace\u0001\u0000\u0000\u0000\u0ac3\u0ac4\n\u0003\u0000\u0000\u0ac4"+ - "\u0ac5\u0005S\u0000\u0000\u0ac5\u0acd\u0003\u01c4\u00e2\u0000\u0ac6\u0ac7"+ - "\n\u0002\u0000\u0000\u0ac7\u0ac8\u0005T\u0000\u0000\u0ac8\u0acd\u0003"+ - "\u01c4\u00e2\u0000\u0ac9\u0aca\n\u0001\u0000\u0000\u0aca\u0acb\u0005X"+ - "\u0000\u0000\u0acb\u0acd\u0003\u01c4\u00e2\u0000\u0acc\u0ac3\u0001\u0000"+ - "\u0000\u0000\u0acc\u0ac6\u0001\u0000\u0000\u0000\u0acc\u0ac9\u0001\u0000"+ - "\u0000\u0000\u0acd\u0ad0\u0001\u0000\u0000\u0000\u0ace\u0acc\u0001\u0000"+ - "\u0000\u0000\u0ace\u0acf\u0001\u0000\u0000\u0000\u0acf\u01c3\u0001\u0000"+ - "\u0000\u0000\u0ad0\u0ace\u0001\u0000\u0000\u0000\u0ad1\u0ad9\u0003\u01c6"+ - "\u00e3\u0000\u0ad2\u0ad9\u0003\u01c8\u00e4\u0000\u0ad3\u0ad4\u0005Q\u0000"+ - "\u0000\u0ad4\u0ad9\u0003\u01c4\u00e2\u0000\u0ad5\u0ad6\u0005R\u0000\u0000"+ - "\u0ad6\u0ad9\u0003\u01c4\u00e2\u0000\u0ad7\u0ad9\u0003\u01ca\u00e5\u0000"+ - "\u0ad8\u0ad1\u0001\u0000\u0000\u0000\u0ad8\u0ad2\u0001\u0000\u0000\u0000"+ - "\u0ad8\u0ad3\u0001\u0000\u0000\u0000\u0ad8\u0ad5\u0001\u0000\u0000\u0000"+ - "\u0ad8\u0ad7\u0001\u0000\u0000\u0000\u0ad9\u01c5\u0001\u0000\u0000\u0000"+ - "\u0ada\u0adb\u0005O\u0000\u0000\u0adb\u0adc\u0003\u01c4\u00e2\u0000\u0adc"+ - "\u01c7\u0001\u0000\u0000\u0000\u0add\u0ade\u0005P\u0000\u0000\u0ade\u0adf"+ - "\u0003\u01c4\u00e2\u0000\u0adf\u01c9\u0001\u0000\u0000\u0000\u0ae0\u0ae7"+ - "\u0003\u01cc\u00e6\u0000\u0ae1\u0ae2\u0005F\u0000\u0000\u0ae2\u0ae7\u0003"+ - "\u01c4\u00e2\u0000\u0ae3\u0ae4\u0005E\u0000\u0000\u0ae4\u0ae7\u0003\u01c4"+ - "\u00e2\u0000\u0ae5\u0ae7\u0003\u01d6\u00eb\u0000\u0ae6\u0ae0\u0001\u0000"+ - "\u0000\u0000\u0ae6\u0ae1\u0001\u0000\u0000\u0000\u0ae6\u0ae3\u0001\u0000"+ - "\u0000\u0000\u0ae6\u0ae5\u0001\u0000\u0000\u0000\u0ae7\u01cb\u0001\u0000"+ - "\u0000\u0000\u0ae8\u0aeb\u0003\u015e\u00af\u0000\u0ae9\u0aeb\u00038\u001c"+ - "\u0000\u0aea\u0ae8\u0001\u0000\u0000\u0000\u0aea\u0ae9\u0001\u0000\u0000"+ - "\u0000\u0aeb\u0af0\u0001\u0000\u0000\u0000\u0aec\u0aef\u0003\u01d0\u00e8"+ - "\u0000\u0aed\u0aef\u0003\u01d4\u00ea\u0000\u0aee\u0aec\u0001\u0000\u0000"+ - "\u0000\u0aee\u0aed\u0001\u0000\u0000\u0000\u0aef\u0af2\u0001\u0000\u0000"+ - "\u0000\u0af0\u0aee\u0001\u0000\u0000\u0000\u0af0\u0af1\u0001\u0000\u0000"+ - "\u0000\u0af1\u01cd\u0001\u0000\u0000\u0000\u0af2\u0af0\u0001\u0000\u0000"+ - "\u0000\u0af3\u0af4\u0003\u01cc\u00e6\u0000\u0af4\u0af5\u0005O\u0000\u0000"+ - "\u0af5\u01cf\u0001\u0000\u0000\u0000\u0af6\u0af7\u0005O\u0000\u0000\u0af7"+ - "\u01d1\u0001\u0000\u0000\u0000\u0af8\u0af9\u0003\u01cc\u00e6\u0000\u0af9"+ - "\u0afa\u0005P\u0000\u0000\u0afa\u01d3\u0001\u0000\u0000\u0000\u0afb\u0afc"+ - "\u0005P\u0000\u0000\u0afc\u01d5\u0001\u0000\u0000\u0000\u0afd\u0afe\u0005"+ - "9\u0000\u0000\u0afe\u0aff\u0003\u0002\u0001\u0000\u0aff\u0b00\u0005:\u0000"+ - "\u0000\u0b00\u0b01\u0003\u01c4\u00e2\u0000\u0b01\u0b19\u0001\u0000\u0000"+ - "\u0000\u0b02\u0b03\u00059\u0000\u0000\u0b03\u0b07\u0003\n\u0005\u0000"+ - "\u0b04\u0b06\u0003&\u0013\u0000\u0b05\u0b04\u0001\u0000\u0000\u0000\u0b06"+ - "\u0b09\u0001\u0000\u0000\u0000\u0b07\u0b05\u0001\u0000\u0000\u0000\u0b07"+ - "\u0b08\u0001\u0000\u0000\u0000\u0b08\u0b0a\u0001\u0000\u0000\u0000\u0b09"+ - "\u0b07\u0001\u0000\u0000\u0000\u0b0a\u0b0b\u0005:\u0000\u0000\u0b0b\u0b0c"+ - "\u0003\u01ca\u00e5\u0000\u0b0c\u0b19\u0001\u0000\u0000\u0000\u0b0d\u0b0e"+ - "\u00059\u0000\u0000\u0b0e\u0b12\u0003\n\u0005\u0000\u0b0f\u0b11\u0003"+ - "&\u0013\u0000\u0b10\u0b0f\u0001\u0000\u0000\u0000\u0b11\u0b14\u0001\u0000"+ - "\u0000\u0000\u0b12\u0b10\u0001\u0000\u0000\u0000\u0b12\u0b13\u0001\u0000"+ - "\u0000\u0000\u0b13\u0b15\u0001\u0000\u0000\u0000\u0b14\u0b12\u0001\u0000"+ - "\u0000\u0000\u0b15\u0b16\u0005:\u0000\u0000\u0b16\u0b17\u0003\u019e\u00cf"+ - "\u0000\u0b17\u0b19\u0001\u0000\u0000\u0000\u0b18\u0afd\u0001\u0000\u0000"+ - "\u0000\u0b18\u0b02\u0001\u0000\u0000\u0000\u0b18\u0b0d\u0001\u0000\u0000"+ - "\u0000\u0b19\u01d7\u0001\u0000\u0000\u0000\u0142\u01dd\u01e4\u01e8\u01ec"+ - "\u01f5\u01f9\u01fd\u01ff\u0205\u020a\u0211\u0216\u0218\u021e\u0223\u0228"+ - "\u022d\u0238\u0246\u024b\u0253\u025a\u0260\u0265\u0270\u0273\u0281\u0286"+ - "\u028b\u0290\u0296\u02a0\u02a8\u02b2\u02ba\u02c6\u02ca\u02cf\u02d5\u02dd"+ - "\u02ea\u0307\u030b\u0310\u0316\u0319\u031c\u0328\u0333\u0341\u0348\u0351"+ - "\u0358\u035d\u036c\u0373\u0379\u037d\u0381\u0385\u0389\u038e\u0392\u0396"+ - "\u0398\u039d\u03a4\u03a9\u03ab\u03b1\u03b6\u03ba\u03cd\u03d2\u03e2\u03e7"+ - "\u03ed\u03f3\u03f5\u03f9\u03fe\u0402\u040a\u0411\u0419\u041c\u0421\u0429"+ - "\u042e\u0435\u043c\u0441\u0447\u0453\u0458\u045c\u0466\u046b\u0473\u0476"+ - "\u047b\u0483\u0486\u048b\u0490\u0495\u049a\u04a1\u04a6\u04ae\u04b3\u04b8"+ - "\u04bd\u04c3\u04c9\u04cc\u04cf\u04d8\u04de\u04e4\u04e7\u04ea\u04f2\u04f7"+ - "\u04fc\u0502\u0505\u0510\u0519\u0523\u0528\u0533\u0538\u0544\u0549\u0555"+ - "\u055f\u0564\u056c\u056f\u0576\u057e\u0584\u058d\u0597\u059b\u059e\u05a7"+ - "\u05b5\u05b8\u05c1\u05c6\u05cd\u05d2\u05da\u05e6\u05ed\u05fb\u0611\u0633"+ - "\u063f\u0645\u0651\u065e\u0678\u067c\u0681\u0685\u0689\u0691\u0695\u0699"+ - "\u06a0\u06a9\u06b1\u06c0\u06cc\u06d2\u06d8\u06ed\u06f2\u06f8\u0704\u070f"+ - "\u0719\u071c\u0721\u072a\u0730\u073a\u073f\u0748\u075f\u0769\u077f\u0786"+ - "\u078e\u0796\u07a1\u07b8\u07c2\u07cd\u07e3\u07e7\u07ec\u07f4\u07fa\u07fe"+ - "\u0802\u0806\u080c\u0811\u0816\u081a\u081e\u0824\u0829\u082e\u0832\u0836"+ - "\u0838\u083d\u0842\u0847\u084b\u084f\u0853\u0858\u0860\u0866\u086a\u086e"+ - "\u0872\u0878\u087d\u0882\u0886\u088a\u088c\u0891\u08a0\u08ae\u08ba\u08c3"+ - "\u08d1\u08de\u08e7\u08ed\u08f4\u08f9\u0900\u0905\u090c\u0911\u0918\u091d"+ - "\u0925\u092a\u092e\u0932\u0937\u093e\u0945\u094a\u0951\u0956\u095d\u0962"+ - "\u096a\u096f\u0973\u097a\u0980\u0987\u098e\u0995\u099d\u09a4\u09ac\u09b0"+ - "\u09b7\u09be\u09c5\u09cd\u09d4\u09dc\u09e2\u09e8\u09f4\u09fa\u0a00\u0a0b"+ - "\u0a14\u0a1b\u0a22\u0a27\u0a2b\u0a34\u0a3f\u0a49\u0a54\u0a5f\u0a6a\u0a75"+ - "\u0a81\u0a83\u0a98\u0a9a\u0aad\u0aaf\u0abb\u0abd\u0acc\u0ace\u0ad8\u0ae6"+ - "\u0aea\u0aee\u0af0\u0b07\u0b12\u0b18"; - public static final String _serializedATN = Utils.join( - new String[] { - _serializedATNSegment0, - _serializedATNSegment1 - }, - "" - ); - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file diff --git a/Assignment-2/Java-8/Java8Parser.tokens b/Assignment-2/Java-8/Java8Parser.tokens deleted file mode 100644 index 52ef1ee..0000000 --- a/Assignment-2/Java-8/Java8Parser.tokens +++ /dev/null @@ -1,205 +0,0 @@ -ABSTRACT=1 -ASSERT=2 -BOOLEAN=3 -BREAK=4 -BYTE=5 -CASE=6 -CATCH=7 -CHAR=8 -CLASS=9 -CONST=10 -CONTINUE=11 -DEFAULT=12 -DO=13 -DOUBLE=14 -ELSE=15 -ENUM=16 -EXTENDS=17 -FINAL=18 -FINALLY=19 -FLOAT=20 -FOR=21 -IF=22 -GOTO=23 -IMPLEMENTS=24 -IMPORT=25 -INSTANCEOF=26 -INT=27 -INTERFACE=28 -LONG=29 -NATIVE=30 -NEW=31 -PACKAGE=32 -PRIVATE=33 -PROTECTED=34 -PUBLIC=35 -RETURN=36 -SHORT=37 -STATIC=38 -STRICTFP=39 -SUPER=40 -SWITCH=41 -SYNCHRONIZED=42 -THIS=43 -THROW=44 -THROWS=45 -TRANSIENT=46 -TRY=47 -VOID=48 -VOLATILE=49 -WHILE=50 -IntegerLiteral=51 -FloatingPointLiteral=52 -BooleanLiteral=53 -CharacterLiteral=54 -StringLiteral=55 -NullLiteral=56 -LPAREN=57 -RPAREN=58 -LBRACE=59 -RBRACE=60 -LBRACK=61 -RBRACK=62 -SEMI=63 -COMMA=64 -DOT=65 -ASSIGN=66 -GT=67 -LT=68 -BANG=69 -TILDE=70 -QUESTION=71 -COLON=72 -EQUAL=73 -LE=74 -GE=75 -NOTEQUAL=76 -AND=77 -OR=78 -INC=79 -DEC=80 -ADD=81 -SUB=82 -MUL=83 -DIV=84 -BITAND=85 -BITOR=86 -CARET=87 -MOD=88 -ARROW=89 -COLONCOLON=90 -ADD_ASSIGN=91 -SUB_ASSIGN=92 -MUL_ASSIGN=93 -DIV_ASSIGN=94 -AND_ASSIGN=95 -OR_ASSIGN=96 -XOR_ASSIGN=97 -MOD_ASSIGN=98 -LSHIFT_ASSIGN=99 -RSHIFT_ASSIGN=100 -URSHIFT_ASSIGN=101 -Identifier=102 -AT=103 -ELLIPSIS=104 -WS=105 -COMMENT=106 -LINE_COMMENT=107 -'abstract'=1 -'assert'=2 -'boolean'=3 -'break'=4 -'byte'=5 -'case'=6 -'catch'=7 -'char'=8 -'class'=9 -'const'=10 -'continue'=11 -'default'=12 -'do'=13 -'double'=14 -'else'=15 -'enum'=16 -'extends'=17 -'final'=18 -'finally'=19 -'float'=20 -'for'=21 -'if'=22 -'goto'=23 -'implements'=24 -'import'=25 -'instanceof'=26 -'int'=27 -'interface'=28 -'long'=29 -'native'=30 -'new'=31 -'package'=32 -'private'=33 -'protected'=34 -'public'=35 -'return'=36 -'short'=37 -'static'=38 -'strictfp'=39 -'super'=40 -'switch'=41 -'synchronized'=42 -'this'=43 -'throw'=44 -'throws'=45 -'transient'=46 -'try'=47 -'void'=48 -'volatile'=49 -'while'=50 -'null'=56 -'('=57 -')'=58 -'{'=59 -'}'=60 -'['=61 -']'=62 -';'=63 -','=64 -'.'=65 -'='=66 -'>'=67 -'<'=68 -'!'=69 -'~'=70 -'?'=71 -':'=72 -'=='=73 -'<='=74 -'>='=75 -'!='=76 -'&&'=77 -'||'=78 -'++'=79 -'--'=80 -'+'=81 -'-'=82 -'*'=83 -'/'=84 -'&'=85 -'|'=86 -'^'=87 -'%'=88 -'->'=89 -'::'=90 -'+='=91 -'-='=92 -'*='=93 -'/='=94 -'&='=95 -'|='=96 -'^='=97 -'%='=98 -'<<='=99 -'>>='=100 -'>>>='=101 -'@'=103 -'...'=104 diff --git a/Assignment-2/Java-8/Java8ParserBaseListener.class b/Assignment-2/Java-8/Java8ParserBaseListener.class deleted file mode 100644 index 3deddf9..0000000 Binary files a/Assignment-2/Java-8/Java8ParserBaseListener.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8ParserBaseListener.java b/Assignment-2/Java-8/Java8ParserBaseListener.java deleted file mode 100644 index 16db37b..0000000 --- a/Assignment-2/Java-8/Java8ParserBaseListener.java +++ /dev/null @@ -1,2871 +0,0 @@ -// Generated from Java-8/Java8Parser.g4 by ANTLR 4.13.2 - -import org.antlr.v4.runtime.ParserRuleContext; -import org.antlr.v4.runtime.tree.ErrorNode; -import org.antlr.v4.runtime.tree.TerminalNode; - -/** - * This class provides an empty implementation of {@link Java8ParserListener}, - * which can be extended to create a listener which only needs to handle a subset - * of the available methods. - */ -@SuppressWarnings("CheckReturnValue") -public class Java8ParserBaseListener implements Java8ParserListener { - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLiteral(Java8Parser.LiteralContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLiteral(Java8Parser.LiteralContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimitiveType(Java8Parser.PrimitiveTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimitiveType(Java8Parser.PrimitiveTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNumericType(Java8Parser.NumericTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNumericType(Java8Parser.NumericTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIntegralType(Java8Parser.IntegralTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIntegralType(Java8Parser.IntegralTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFloatingPointType(Java8Parser.FloatingPointTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFloatingPointType(Java8Parser.FloatingPointTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterReferenceType(Java8Parser.ReferenceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitReferenceType(Java8Parser.ReferenceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassOrInterfaceType(Java8Parser.ClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassOrInterfaceType(Java8Parser.ClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassType(Java8Parser.ClassTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassType(Java8Parser.ClassTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassType_lf_classOrInterfaceType(Java8Parser.ClassType_lf_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassType_lf_classOrInterfaceType(Java8Parser.ClassType_lf_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassType_lfno_classOrInterfaceType(Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassType_lfno_classOrInterfaceType(Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceType(Java8Parser.InterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceType(Java8Parser.InterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceType_lf_classOrInterfaceType(Java8Parser.InterfaceType_lf_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceType_lf_classOrInterfaceType(Java8Parser.InterfaceType_lf_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceType_lfno_classOrInterfaceType(Java8Parser.InterfaceType_lfno_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceType_lfno_classOrInterfaceType(Java8Parser.InterfaceType_lfno_classOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeVariable(Java8Parser.TypeVariableContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeVariable(Java8Parser.TypeVariableContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayType(Java8Parser.ArrayTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayType(Java8Parser.ArrayTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDims(Java8Parser.DimsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDims(Java8Parser.DimsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeParameter(Java8Parser.TypeParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeParameter(Java8Parser.TypeParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeParameterModifier(Java8Parser.TypeParameterModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeParameterModifier(Java8Parser.TypeParameterModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeBound(Java8Parser.TypeBoundContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeBound(Java8Parser.TypeBoundContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAdditionalBound(Java8Parser.AdditionalBoundContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAdditionalBound(Java8Parser.AdditionalBoundContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeArguments(Java8Parser.TypeArgumentsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeArguments(Java8Parser.TypeArgumentsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeArgumentList(Java8Parser.TypeArgumentListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeArgumentList(Java8Parser.TypeArgumentListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeArgument(Java8Parser.TypeArgumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeArgument(Java8Parser.TypeArgumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWildcard(Java8Parser.WildcardContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWildcard(Java8Parser.WildcardContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWildcardBounds(Java8Parser.WildcardBoundsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWildcardBounds(Java8Parser.WildcardBoundsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPackageName(Java8Parser.PackageNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPackageName(Java8Parser.PackageNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeName(Java8Parser.TypeNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeName(Java8Parser.TypeNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPackageOrTypeName(Java8Parser.PackageOrTypeNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPackageOrTypeName(Java8Parser.PackageOrTypeNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExpressionName(Java8Parser.ExpressionNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExpressionName(Java8Parser.ExpressionNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodName(Java8Parser.MethodNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodName(Java8Parser.MethodNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAmbiguousName(Java8Parser.AmbiguousNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAmbiguousName(Java8Parser.AmbiguousNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCompilationUnit(Java8Parser.CompilationUnitContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCompilationUnit(Java8Parser.CompilationUnitContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPackageDeclaration(Java8Parser.PackageDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPackageDeclaration(Java8Parser.PackageDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPackageModifier(Java8Parser.PackageModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPackageModifier(Java8Parser.PackageModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterImportDeclaration(Java8Parser.ImportDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitImportDeclaration(Java8Parser.ImportDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSingleTypeImportDeclaration(Java8Parser.SingleTypeImportDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSingleTypeImportDeclaration(Java8Parser.SingleTypeImportDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeImportOnDemandDeclaration(Java8Parser.TypeImportOnDemandDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeImportOnDemandDeclaration(Java8Parser.TypeImportOnDemandDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSingleStaticImportDeclaration(Java8Parser.SingleStaticImportDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSingleStaticImportDeclaration(Java8Parser.SingleStaticImportDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStaticImportOnDemandDeclaration(Java8Parser.StaticImportOnDemandDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStaticImportOnDemandDeclaration(Java8Parser.StaticImportOnDemandDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeDeclaration(Java8Parser.TypeDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeDeclaration(Java8Parser.TypeDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassDeclaration(Java8Parser.ClassDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassDeclaration(Java8Parser.ClassDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNormalClassDeclaration(Java8Parser.NormalClassDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNormalClassDeclaration(Java8Parser.NormalClassDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassModifier(Java8Parser.ClassModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassModifier(Java8Parser.ClassModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeParameters(Java8Parser.TypeParametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeParameters(Java8Parser.TypeParametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeParameterList(Java8Parser.TypeParameterListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeParameterList(Java8Parser.TypeParameterListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSuperclass(Java8Parser.SuperclassContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSuperclass(Java8Parser.SuperclassContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSuperinterfaces(Java8Parser.SuperinterfacesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSuperinterfaces(Java8Parser.SuperinterfacesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceTypeList(Java8Parser.InterfaceTypeListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceTypeList(Java8Parser.InterfaceTypeListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassBody(Java8Parser.ClassBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassBody(Java8Parser.ClassBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassBodyDeclaration(Java8Parser.ClassBodyDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassBodyDeclaration(Java8Parser.ClassBodyDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassMemberDeclaration(Java8Parser.ClassMemberDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassMemberDeclaration(Java8Parser.ClassMemberDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFieldDeclaration(Java8Parser.FieldDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFieldDeclaration(Java8Parser.FieldDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFieldModifier(Java8Parser.FieldModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFieldModifier(Java8Parser.FieldModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariableDeclaratorList(Java8Parser.VariableDeclaratorListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariableDeclaratorList(Java8Parser.VariableDeclaratorListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariableDeclarator(Java8Parser.VariableDeclaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariableDeclarator(Java8Parser.VariableDeclaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariableDeclaratorId(Java8Parser.VariableDeclaratorIdContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariableDeclaratorId(Java8Parser.VariableDeclaratorIdContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariableInitializer(Java8Parser.VariableInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariableInitializer(Java8Parser.VariableInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannType(Java8Parser.UnannTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannType(Java8Parser.UnannTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannPrimitiveType(Java8Parser.UnannPrimitiveTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannPrimitiveType(Java8Parser.UnannPrimitiveTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannReferenceType(Java8Parser.UnannReferenceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannReferenceType(Java8Parser.UnannReferenceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannClassOrInterfaceType(Java8Parser.UnannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannClassOrInterfaceType(Java8Parser.UnannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannClassType(Java8Parser.UnannClassTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannClassType(Java8Parser.UnannClassTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannClassType_lf_unannClassOrInterfaceType(Java8Parser.UnannClassType_lf_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannClassType_lf_unannClassOrInterfaceType(Java8Parser.UnannClassType_lf_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannClassType_lfno_unannClassOrInterfaceType(Java8Parser.UnannClassType_lfno_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannClassType_lfno_unannClassOrInterfaceType(Java8Parser.UnannClassType_lfno_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannInterfaceType(Java8Parser.UnannInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannInterfaceType(Java8Parser.UnannInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannInterfaceType_lf_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lf_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannInterfaceType_lf_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lf_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannInterfaceType_lfno_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannInterfaceType_lfno_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannTypeVariable(Java8Parser.UnannTypeVariableContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannTypeVariable(Java8Parser.UnannTypeVariableContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnannArrayType(Java8Parser.UnannArrayTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnannArrayType(Java8Parser.UnannArrayTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodDeclaration(Java8Parser.MethodDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodDeclaration(Java8Parser.MethodDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodModifier(Java8Parser.MethodModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodModifier(Java8Parser.MethodModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodHeader(Java8Parser.MethodHeaderContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodHeader(Java8Parser.MethodHeaderContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterResult(Java8Parser.ResultContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitResult(Java8Parser.ResultContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodDeclarator(Java8Parser.MethodDeclaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodDeclarator(Java8Parser.MethodDeclaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFormalParameterList(Java8Parser.FormalParameterListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFormalParameterList(Java8Parser.FormalParameterListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFormalParameters(Java8Parser.FormalParametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFormalParameters(Java8Parser.FormalParametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFormalParameter(Java8Parser.FormalParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFormalParameter(Java8Parser.FormalParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariableModifier(Java8Parser.VariableModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariableModifier(Java8Parser.VariableModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLastFormalParameter(Java8Parser.LastFormalParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLastFormalParameter(Java8Parser.LastFormalParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterReceiverParameter(Java8Parser.ReceiverParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitReceiverParameter(Java8Parser.ReceiverParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterThrows_(Java8Parser.Throws_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitThrows_(Java8Parser.Throws_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExceptionTypeList(Java8Parser.ExceptionTypeListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExceptionTypeList(Java8Parser.ExceptionTypeListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExceptionType(Java8Parser.ExceptionTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExceptionType(Java8Parser.ExceptionTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodBody(Java8Parser.MethodBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodBody(Java8Parser.MethodBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInstanceInitializer(Java8Parser.InstanceInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInstanceInitializer(Java8Parser.InstanceInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStaticInitializer(Java8Parser.StaticInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStaticInitializer(Java8Parser.StaticInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructorDeclaration(Java8Parser.ConstructorDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructorDeclaration(Java8Parser.ConstructorDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructorModifier(Java8Parser.ConstructorModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructorModifier(Java8Parser.ConstructorModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructorDeclarator(Java8Parser.ConstructorDeclaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructorDeclarator(Java8Parser.ConstructorDeclaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSimpleTypeName(Java8Parser.SimpleTypeNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSimpleTypeName(Java8Parser.SimpleTypeNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructorBody(Java8Parser.ConstructorBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructorBody(Java8Parser.ConstructorBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExplicitConstructorInvocation(Java8Parser.ExplicitConstructorInvocationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExplicitConstructorInvocation(Java8Parser.ExplicitConstructorInvocationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumDeclaration(Java8Parser.EnumDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumDeclaration(Java8Parser.EnumDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumBody(Java8Parser.EnumBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumBody(Java8Parser.EnumBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumConstantList(Java8Parser.EnumConstantListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumConstantList(Java8Parser.EnumConstantListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumConstant(Java8Parser.EnumConstantContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumConstant(Java8Parser.EnumConstantContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumConstantModifier(Java8Parser.EnumConstantModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumConstantModifier(Java8Parser.EnumConstantModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumBodyDeclarations(Java8Parser.EnumBodyDeclarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumBodyDeclarations(Java8Parser.EnumBodyDeclarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceDeclaration(Java8Parser.InterfaceDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceDeclaration(Java8Parser.InterfaceDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNormalInterfaceDeclaration(Java8Parser.NormalInterfaceDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNormalInterfaceDeclaration(Java8Parser.NormalInterfaceDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceModifier(Java8Parser.InterfaceModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceModifier(Java8Parser.InterfaceModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExtendsInterfaces(Java8Parser.ExtendsInterfacesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExtendsInterfaces(Java8Parser.ExtendsInterfacesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceBody(Java8Parser.InterfaceBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceBody(Java8Parser.InterfaceBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceMemberDeclaration(Java8Parser.InterfaceMemberDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceMemberDeclaration(Java8Parser.InterfaceMemberDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstantDeclaration(Java8Parser.ConstantDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstantDeclaration(Java8Parser.ConstantDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstantModifier(Java8Parser.ConstantModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstantModifier(Java8Parser.ConstantModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceMethodDeclaration(Java8Parser.InterfaceMethodDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceMethodDeclaration(Java8Parser.InterfaceMethodDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterfaceMethodModifier(Java8Parser.InterfaceMethodModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterfaceMethodModifier(Java8Parser.InterfaceMethodModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnnotationTypeDeclaration(Java8Parser.AnnotationTypeDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnnotationTypeDeclaration(Java8Parser.AnnotationTypeDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnnotationTypeBody(Java8Parser.AnnotationTypeBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnnotationTypeBody(Java8Parser.AnnotationTypeBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnnotationTypeMemberDeclaration(Java8Parser.AnnotationTypeMemberDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnnotationTypeMemberDeclaration(Java8Parser.AnnotationTypeMemberDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnnotationTypeElementDeclaration(Java8Parser.AnnotationTypeElementDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnnotationTypeElementDeclaration(Java8Parser.AnnotationTypeElementDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnnotationTypeElementModifier(Java8Parser.AnnotationTypeElementModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnnotationTypeElementModifier(Java8Parser.AnnotationTypeElementModifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDefaultValue(Java8Parser.DefaultValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDefaultValue(Java8Parser.DefaultValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnnotation(Java8Parser.AnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnnotation(Java8Parser.AnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNormalAnnotation(Java8Parser.NormalAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNormalAnnotation(Java8Parser.NormalAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterElementValuePairList(Java8Parser.ElementValuePairListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitElementValuePairList(Java8Parser.ElementValuePairListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterElementValuePair(Java8Parser.ElementValuePairContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitElementValuePair(Java8Parser.ElementValuePairContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterElementValue(Java8Parser.ElementValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitElementValue(Java8Parser.ElementValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterElementValueArrayInitializer(Java8Parser.ElementValueArrayInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitElementValueArrayInitializer(Java8Parser.ElementValueArrayInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterElementValueList(Java8Parser.ElementValueListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitElementValueList(Java8Parser.ElementValueListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMarkerAnnotation(Java8Parser.MarkerAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMarkerAnnotation(Java8Parser.MarkerAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSingleElementAnnotation(Java8Parser.SingleElementAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSingleElementAnnotation(Java8Parser.SingleElementAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayInitializer(Java8Parser.ArrayInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayInitializer(Java8Parser.ArrayInitializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariableInitializerList(Java8Parser.VariableInitializerListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariableInitializerList(Java8Parser.VariableInitializerListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBlock(Java8Parser.BlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBlock(Java8Parser.BlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBlockStatements(Java8Parser.BlockStatementsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBlockStatements(Java8Parser.BlockStatementsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBlockStatement(Java8Parser.BlockStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBlockStatement(Java8Parser.BlockStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocalVariableDeclarationStatement(Java8Parser.LocalVariableDeclarationStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocalVariableDeclarationStatement(Java8Parser.LocalVariableDeclarationStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocalVariableDeclaration(Java8Parser.LocalVariableDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocalVariableDeclaration(Java8Parser.LocalVariableDeclarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatement(Java8Parser.StatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatement(Java8Parser.StatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatementNoShortIf(Java8Parser.StatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatementNoShortIf(Java8Parser.StatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatementWithoutTrailingSubstatement(Java8Parser.StatementWithoutTrailingSubstatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatementWithoutTrailingSubstatement(Java8Parser.StatementWithoutTrailingSubstatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEmptyStatement_(Java8Parser.EmptyStatement_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEmptyStatement_(Java8Parser.EmptyStatement_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLabeledStatement(Java8Parser.LabeledStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLabeledStatement(Java8Parser.LabeledStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLabeledStatementNoShortIf(Java8Parser.LabeledStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLabeledStatementNoShortIf(Java8Parser.LabeledStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExpressionStatement(Java8Parser.ExpressionStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExpressionStatement(Java8Parser.ExpressionStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatementExpression(Java8Parser.StatementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatementExpression(Java8Parser.StatementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIfThenStatement(Java8Parser.IfThenStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIfThenStatement(Java8Parser.IfThenStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIfThenElseStatement(Java8Parser.IfThenElseStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIfThenElseStatement(Java8Parser.IfThenElseStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIfThenElseStatementNoShortIf(Java8Parser.IfThenElseStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIfThenElseStatementNoShortIf(Java8Parser.IfThenElseStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssertStatement(Java8Parser.AssertStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssertStatement(Java8Parser.AssertStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitchStatement(Java8Parser.SwitchStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitchStatement(Java8Parser.SwitchStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitchBlock(Java8Parser.SwitchBlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitchBlock(Java8Parser.SwitchBlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitchBlockStatementGroup(Java8Parser.SwitchBlockStatementGroupContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitchBlockStatementGroup(Java8Parser.SwitchBlockStatementGroupContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitchLabels(Java8Parser.SwitchLabelsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitchLabels(Java8Parser.SwitchLabelsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitchLabel(Java8Parser.SwitchLabelContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitchLabel(Java8Parser.SwitchLabelContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnumConstantName(Java8Parser.EnumConstantNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnumConstantName(Java8Parser.EnumConstantNameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWhileStatement(Java8Parser.WhileStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWhileStatement(Java8Parser.WhileStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWhileStatementNoShortIf(Java8Parser.WhileStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWhileStatementNoShortIf(Java8Parser.WhileStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDoStatement(Java8Parser.DoStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDoStatement(Java8Parser.DoStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterForStatement(Java8Parser.ForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitForStatement(Java8Parser.ForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterForStatementNoShortIf(Java8Parser.ForStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitForStatementNoShortIf(Java8Parser.ForStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBasicForStatement(Java8Parser.BasicForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBasicForStatement(Java8Parser.BasicForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBasicForStatementNoShortIf(Java8Parser.BasicForStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBasicForStatementNoShortIf(Java8Parser.BasicForStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterForInit(Java8Parser.ForInitContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitForInit(Java8Parser.ForInitContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterForUpdate(Java8Parser.ForUpdateContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitForUpdate(Java8Parser.ForUpdateContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatementExpressionList(Java8Parser.StatementExpressionListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatementExpressionList(Java8Parser.StatementExpressionListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnhancedForStatement(Java8Parser.EnhancedForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnhancedForStatement(Java8Parser.EnhancedForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnhancedForStatementNoShortIf(Java8Parser.EnhancedForStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnhancedForStatementNoShortIf(Java8Parser.EnhancedForStatementNoShortIfContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBreakStatement(Java8Parser.BreakStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBreakStatement(Java8Parser.BreakStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterContinueStatement(Java8Parser.ContinueStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitContinueStatement(Java8Parser.ContinueStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterReturnStatement(Java8Parser.ReturnStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitReturnStatement(Java8Parser.ReturnStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterThrowStatement(Java8Parser.ThrowStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitThrowStatement(Java8Parser.ThrowStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSynchronizedStatement(Java8Parser.SynchronizedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSynchronizedStatement(Java8Parser.SynchronizedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTryStatement(Java8Parser.TryStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTryStatement(Java8Parser.TryStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCatches(Java8Parser.CatchesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCatches(Java8Parser.CatchesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCatchClause(Java8Parser.CatchClauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCatchClause(Java8Parser.CatchClauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCatchFormalParameter(Java8Parser.CatchFormalParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCatchFormalParameter(Java8Parser.CatchFormalParameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCatchType(Java8Parser.CatchTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCatchType(Java8Parser.CatchTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFinally_(Java8Parser.Finally_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFinally_(Java8Parser.Finally_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTryWithResourcesStatement(Java8Parser.TryWithResourcesStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTryWithResourcesStatement(Java8Parser.TryWithResourcesStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterResourceSpecification(Java8Parser.ResourceSpecificationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitResourceSpecification(Java8Parser.ResourceSpecificationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterResourceList(Java8Parser.ResourceListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitResourceList(Java8Parser.ResourceListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterResource(Java8Parser.ResourceContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitResource(Java8Parser.ResourceContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimary(Java8Parser.PrimaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimary(Java8Parser.PrimaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray(Java8Parser.PrimaryNoNewArrayContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray(Java8Parser.PrimaryNoNewArrayContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lf_arrayAccess(Java8Parser.PrimaryNoNewArray_lf_arrayAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lf_arrayAccess(Java8Parser.PrimaryNoNewArray_lf_arrayAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lfno_arrayAccess(Java8Parser.PrimaryNoNewArray_lfno_arrayAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lfno_arrayAccess(Java8Parser.PrimaryNoNewArray_lfno_arrayAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassInstanceCreationExpression(Java8Parser.ClassInstanceCreationExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassInstanceCreationExpression(Java8Parser.ClassInstanceCreationExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassInstanceCreationExpression_lf_primary(Java8Parser.ClassInstanceCreationExpression_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassInstanceCreationExpression_lf_primary(Java8Parser.ClassInstanceCreationExpression_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClassInstanceCreationExpression_lfno_primary(Java8Parser.ClassInstanceCreationExpression_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClassInstanceCreationExpression_lfno_primary(Java8Parser.ClassInstanceCreationExpression_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeArgumentsOrDiamond(Java8Parser.TypeArgumentsOrDiamondContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeArgumentsOrDiamond(Java8Parser.TypeArgumentsOrDiamondContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFieldAccess(Java8Parser.FieldAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFieldAccess(Java8Parser.FieldAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFieldAccess_lf_primary(Java8Parser.FieldAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFieldAccess_lf_primary(Java8Parser.FieldAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFieldAccess_lfno_primary(Java8Parser.FieldAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFieldAccess_lfno_primary(Java8Parser.FieldAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayAccess(Java8Parser.ArrayAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayAccess(Java8Parser.ArrayAccessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayAccess_lf_primary(Java8Parser.ArrayAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayAccess_lf_primary(Java8Parser.ArrayAccess_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayAccess_lfno_primary(Java8Parser.ArrayAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayAccess_lfno_primary(Java8Parser.ArrayAccess_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodInvocation(Java8Parser.MethodInvocationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodInvocation(Java8Parser.MethodInvocationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodInvocation_lf_primary(Java8Parser.MethodInvocation_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodInvocation_lf_primary(Java8Parser.MethodInvocation_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodInvocation_lfno_primary(Java8Parser.MethodInvocation_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodInvocation_lfno_primary(Java8Parser.MethodInvocation_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArgumentList(Java8Parser.ArgumentListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArgumentList(Java8Parser.ArgumentListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodReference(Java8Parser.MethodReferenceContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodReference(Java8Parser.MethodReferenceContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodReference_lf_primary(Java8Parser.MethodReference_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodReference_lf_primary(Java8Parser.MethodReference_lf_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodReference_lfno_primary(Java8Parser.MethodReference_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodReference_lfno_primary(Java8Parser.MethodReference_lfno_primaryContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayCreationExpression(Java8Parser.ArrayCreationExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayCreationExpression(Java8Parser.ArrayCreationExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDimExprs(Java8Parser.DimExprsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDimExprs(Java8Parser.DimExprsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDimExpr(Java8Parser.DimExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDimExpr(Java8Parser.DimExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstantExpression(Java8Parser.ConstantExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstantExpression(Java8Parser.ConstantExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExpression(Java8Parser.ExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExpression(Java8Parser.ExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLambdaExpression(Java8Parser.LambdaExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLambdaExpression(Java8Parser.LambdaExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLambdaParameters(Java8Parser.LambdaParametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLambdaParameters(Java8Parser.LambdaParametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInferredFormalParameterList(Java8Parser.InferredFormalParameterListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInferredFormalParameterList(Java8Parser.InferredFormalParameterListContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLambdaBody(Java8Parser.LambdaBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLambdaBody(Java8Parser.LambdaBodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssignmentExpression(Java8Parser.AssignmentExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssignmentExpression(Java8Parser.AssignmentExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssignment(Java8Parser.AssignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssignment(Java8Parser.AssignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLeftHandSide(Java8Parser.LeftHandSideContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLeftHandSide(Java8Parser.LeftHandSideContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssignmentOperator(Java8Parser.AssignmentOperatorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssignmentOperator(Java8Parser.AssignmentOperatorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConditionalExpression(Java8Parser.ConditionalExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConditionalExpression(Java8Parser.ConditionalExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConditionalOrExpression(Java8Parser.ConditionalOrExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConditionalOrExpression(Java8Parser.ConditionalOrExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConditionalAndExpression(Java8Parser.ConditionalAndExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConditionalAndExpression(Java8Parser.ConditionalAndExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInclusiveOrExpression(Java8Parser.InclusiveOrExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInclusiveOrExpression(Java8Parser.InclusiveOrExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExclusiveOrExpression(Java8Parser.ExclusiveOrExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExclusiveOrExpression(Java8Parser.ExclusiveOrExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAndExpression(Java8Parser.AndExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAndExpression(Java8Parser.AndExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEqualityExpression(Java8Parser.EqualityExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEqualityExpression(Java8Parser.EqualityExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRelationalExpression(Java8Parser.RelationalExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRelationalExpression(Java8Parser.RelationalExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterShiftExpression(Java8Parser.ShiftExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitShiftExpression(Java8Parser.ShiftExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAdditiveExpression(Java8Parser.AdditiveExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAdditiveExpression(Java8Parser.AdditiveExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMultiplicativeExpression(Java8Parser.MultiplicativeExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMultiplicativeExpression(Java8Parser.MultiplicativeExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnaryExpression(Java8Parser.UnaryExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnaryExpression(Java8Parser.UnaryExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPreIncrementExpression(Java8Parser.PreIncrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPreIncrementExpression(Java8Parser.PreIncrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPreDecrementExpression(Java8Parser.PreDecrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPreDecrementExpression(Java8Parser.PreDecrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnaryExpressionNotPlusMinus(Java8Parser.UnaryExpressionNotPlusMinusContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnaryExpressionNotPlusMinus(Java8Parser.UnaryExpressionNotPlusMinusContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPostfixExpression(Java8Parser.PostfixExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPostfixExpression(Java8Parser.PostfixExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPostIncrementExpression(Java8Parser.PostIncrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPostIncrementExpression(Java8Parser.PostIncrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPostIncrementExpression_lf_postfixExpression(Java8Parser.PostIncrementExpression_lf_postfixExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPostIncrementExpression_lf_postfixExpression(Java8Parser.PostIncrementExpression_lf_postfixExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPostDecrementExpression(Java8Parser.PostDecrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPostDecrementExpression(Java8Parser.PostDecrementExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPostDecrementExpression_lf_postfixExpression(Java8Parser.PostDecrementExpression_lf_postfixExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPostDecrementExpression_lf_postfixExpression(Java8Parser.PostDecrementExpression_lf_postfixExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCastExpression(Java8Parser.CastExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCastExpression(Java8Parser.CastExpressionContext ctx) { } - - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitTerminal(TerminalNode node) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitErrorNode(ErrorNode node) { } -} \ No newline at end of file diff --git a/Assignment-2/Java-8/Java8ParserListener.class b/Assignment-2/Java-8/Java8ParserListener.class deleted file mode 100644 index 0a62eed..0000000 Binary files a/Assignment-2/Java-8/Java8ParserListener.class and /dev/null differ diff --git a/Assignment-2/Java-8/Java8ParserListener.java b/Assignment-2/Java-8/Java8ParserListener.java deleted file mode 100644 index 7f0dc6b..0000000 --- a/Assignment-2/Java-8/Java8ParserListener.java +++ /dev/null @@ -1,2369 +0,0 @@ -// Generated from Java-8/Java8Parser.g4 by ANTLR 4.13.2 -import org.antlr.v4.runtime.tree.ParseTreeListener; - -/** - * This interface defines a complete listener for a parse tree produced by - * {@link Java8Parser}. - */ -public interface Java8ParserListener extends ParseTreeListener { - /** - * Enter a parse tree produced by {@link Java8Parser#literal}. - * @param ctx the parse tree - */ - void enterLiteral(Java8Parser.LiteralContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#literal}. - * @param ctx the parse tree - */ - void exitLiteral(Java8Parser.LiteralContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primitiveType}. - * @param ctx the parse tree - */ - void enterPrimitiveType(Java8Parser.PrimitiveTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primitiveType}. - * @param ctx the parse tree - */ - void exitPrimitiveType(Java8Parser.PrimitiveTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#numericType}. - * @param ctx the parse tree - */ - void enterNumericType(Java8Parser.NumericTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#numericType}. - * @param ctx the parse tree - */ - void exitNumericType(Java8Parser.NumericTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#integralType}. - * @param ctx the parse tree - */ - void enterIntegralType(Java8Parser.IntegralTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#integralType}. - * @param ctx the parse tree - */ - void exitIntegralType(Java8Parser.IntegralTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#floatingPointType}. - * @param ctx the parse tree - */ - void enterFloatingPointType(Java8Parser.FloatingPointTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#floatingPointType}. - * @param ctx the parse tree - */ - void exitFloatingPointType(Java8Parser.FloatingPointTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#referenceType}. - * @param ctx the parse tree - */ - void enterReferenceType(Java8Parser.ReferenceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#referenceType}. - * @param ctx the parse tree - */ - void exitReferenceType(Java8Parser.ReferenceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classOrInterfaceType}. - * @param ctx the parse tree - */ - void enterClassOrInterfaceType(Java8Parser.ClassOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classOrInterfaceType}. - * @param ctx the parse tree - */ - void exitClassOrInterfaceType(Java8Parser.ClassOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classType}. - * @param ctx the parse tree - */ - void enterClassType(Java8Parser.ClassTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classType}. - * @param ctx the parse tree - */ - void exitClassType(Java8Parser.ClassTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classType_lf_classOrInterfaceType}. - * @param ctx the parse tree - */ - void enterClassType_lf_classOrInterfaceType(Java8Parser.ClassType_lf_classOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classType_lf_classOrInterfaceType}. - * @param ctx the parse tree - */ - void exitClassType_lf_classOrInterfaceType(Java8Parser.ClassType_lf_classOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classType_lfno_classOrInterfaceType}. - * @param ctx the parse tree - */ - void enterClassType_lfno_classOrInterfaceType(Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classType_lfno_classOrInterfaceType}. - * @param ctx the parse tree - */ - void exitClassType_lfno_classOrInterfaceType(Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceType}. - * @param ctx the parse tree - */ - void enterInterfaceType(Java8Parser.InterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceType}. - * @param ctx the parse tree - */ - void exitInterfaceType(Java8Parser.InterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceType_lf_classOrInterfaceType}. - * @param ctx the parse tree - */ - void enterInterfaceType_lf_classOrInterfaceType(Java8Parser.InterfaceType_lf_classOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceType_lf_classOrInterfaceType}. - * @param ctx the parse tree - */ - void exitInterfaceType_lf_classOrInterfaceType(Java8Parser.InterfaceType_lf_classOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceType_lfno_classOrInterfaceType}. - * @param ctx the parse tree - */ - void enterInterfaceType_lfno_classOrInterfaceType(Java8Parser.InterfaceType_lfno_classOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceType_lfno_classOrInterfaceType}. - * @param ctx the parse tree - */ - void exitInterfaceType_lfno_classOrInterfaceType(Java8Parser.InterfaceType_lfno_classOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeVariable}. - * @param ctx the parse tree - */ - void enterTypeVariable(Java8Parser.TypeVariableContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeVariable}. - * @param ctx the parse tree - */ - void exitTypeVariable(Java8Parser.TypeVariableContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#arrayType}. - * @param ctx the parse tree - */ - void enterArrayType(Java8Parser.ArrayTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#arrayType}. - * @param ctx the parse tree - */ - void exitArrayType(Java8Parser.ArrayTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#dims}. - * @param ctx the parse tree - */ - void enterDims(Java8Parser.DimsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#dims}. - * @param ctx the parse tree - */ - void exitDims(Java8Parser.DimsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeParameter}. - * @param ctx the parse tree - */ - void enterTypeParameter(Java8Parser.TypeParameterContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeParameter}. - * @param ctx the parse tree - */ - void exitTypeParameter(Java8Parser.TypeParameterContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeParameterModifier}. - * @param ctx the parse tree - */ - void enterTypeParameterModifier(Java8Parser.TypeParameterModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeParameterModifier}. - * @param ctx the parse tree - */ - void exitTypeParameterModifier(Java8Parser.TypeParameterModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeBound}. - * @param ctx the parse tree - */ - void enterTypeBound(Java8Parser.TypeBoundContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeBound}. - * @param ctx the parse tree - */ - void exitTypeBound(Java8Parser.TypeBoundContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#additionalBound}. - * @param ctx the parse tree - */ - void enterAdditionalBound(Java8Parser.AdditionalBoundContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#additionalBound}. - * @param ctx the parse tree - */ - void exitAdditionalBound(Java8Parser.AdditionalBoundContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeArguments}. - * @param ctx the parse tree - */ - void enterTypeArguments(Java8Parser.TypeArgumentsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeArguments}. - * @param ctx the parse tree - */ - void exitTypeArguments(Java8Parser.TypeArgumentsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeArgumentList}. - * @param ctx the parse tree - */ - void enterTypeArgumentList(Java8Parser.TypeArgumentListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeArgumentList}. - * @param ctx the parse tree - */ - void exitTypeArgumentList(Java8Parser.TypeArgumentListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeArgument}. - * @param ctx the parse tree - */ - void enterTypeArgument(Java8Parser.TypeArgumentContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeArgument}. - * @param ctx the parse tree - */ - void exitTypeArgument(Java8Parser.TypeArgumentContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#wildcard}. - * @param ctx the parse tree - */ - void enterWildcard(Java8Parser.WildcardContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#wildcard}. - * @param ctx the parse tree - */ - void exitWildcard(Java8Parser.WildcardContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#wildcardBounds}. - * @param ctx the parse tree - */ - void enterWildcardBounds(Java8Parser.WildcardBoundsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#wildcardBounds}. - * @param ctx the parse tree - */ - void exitWildcardBounds(Java8Parser.WildcardBoundsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#packageName}. - * @param ctx the parse tree - */ - void enterPackageName(Java8Parser.PackageNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#packageName}. - * @param ctx the parse tree - */ - void exitPackageName(Java8Parser.PackageNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeName}. - * @param ctx the parse tree - */ - void enterTypeName(Java8Parser.TypeNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeName}. - * @param ctx the parse tree - */ - void exitTypeName(Java8Parser.TypeNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#packageOrTypeName}. - * @param ctx the parse tree - */ - void enterPackageOrTypeName(Java8Parser.PackageOrTypeNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#packageOrTypeName}. - * @param ctx the parse tree - */ - void exitPackageOrTypeName(Java8Parser.PackageOrTypeNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#expressionName}. - * @param ctx the parse tree - */ - void enterExpressionName(Java8Parser.ExpressionNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#expressionName}. - * @param ctx the parse tree - */ - void exitExpressionName(Java8Parser.ExpressionNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodName}. - * @param ctx the parse tree - */ - void enterMethodName(Java8Parser.MethodNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodName}. - * @param ctx the parse tree - */ - void exitMethodName(Java8Parser.MethodNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#ambiguousName}. - * @param ctx the parse tree - */ - void enterAmbiguousName(Java8Parser.AmbiguousNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#ambiguousName}. - * @param ctx the parse tree - */ - void exitAmbiguousName(Java8Parser.AmbiguousNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#compilationUnit}. - * @param ctx the parse tree - */ - void enterCompilationUnit(Java8Parser.CompilationUnitContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#compilationUnit}. - * @param ctx the parse tree - */ - void exitCompilationUnit(Java8Parser.CompilationUnitContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#packageDeclaration}. - * @param ctx the parse tree - */ - void enterPackageDeclaration(Java8Parser.PackageDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#packageDeclaration}. - * @param ctx the parse tree - */ - void exitPackageDeclaration(Java8Parser.PackageDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#packageModifier}. - * @param ctx the parse tree - */ - void enterPackageModifier(Java8Parser.PackageModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#packageModifier}. - * @param ctx the parse tree - */ - void exitPackageModifier(Java8Parser.PackageModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#importDeclaration}. - * @param ctx the parse tree - */ - void enterImportDeclaration(Java8Parser.ImportDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#importDeclaration}. - * @param ctx the parse tree - */ - void exitImportDeclaration(Java8Parser.ImportDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#singleTypeImportDeclaration}. - * @param ctx the parse tree - */ - void enterSingleTypeImportDeclaration(Java8Parser.SingleTypeImportDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#singleTypeImportDeclaration}. - * @param ctx the parse tree - */ - void exitSingleTypeImportDeclaration(Java8Parser.SingleTypeImportDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeImportOnDemandDeclaration}. - * @param ctx the parse tree - */ - void enterTypeImportOnDemandDeclaration(Java8Parser.TypeImportOnDemandDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeImportOnDemandDeclaration}. - * @param ctx the parse tree - */ - void exitTypeImportOnDemandDeclaration(Java8Parser.TypeImportOnDemandDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#singleStaticImportDeclaration}. - * @param ctx the parse tree - */ - void enterSingleStaticImportDeclaration(Java8Parser.SingleStaticImportDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#singleStaticImportDeclaration}. - * @param ctx the parse tree - */ - void exitSingleStaticImportDeclaration(Java8Parser.SingleStaticImportDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#staticImportOnDemandDeclaration}. - * @param ctx the parse tree - */ - void enterStaticImportOnDemandDeclaration(Java8Parser.StaticImportOnDemandDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#staticImportOnDemandDeclaration}. - * @param ctx the parse tree - */ - void exitStaticImportOnDemandDeclaration(Java8Parser.StaticImportOnDemandDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeDeclaration}. - * @param ctx the parse tree - */ - void enterTypeDeclaration(Java8Parser.TypeDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeDeclaration}. - * @param ctx the parse tree - */ - void exitTypeDeclaration(Java8Parser.TypeDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classDeclaration}. - * @param ctx the parse tree - */ - void enterClassDeclaration(Java8Parser.ClassDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classDeclaration}. - * @param ctx the parse tree - */ - void exitClassDeclaration(Java8Parser.ClassDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#normalClassDeclaration}. - * @param ctx the parse tree - */ - void enterNormalClassDeclaration(Java8Parser.NormalClassDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#normalClassDeclaration}. - * @param ctx the parse tree - */ - void exitNormalClassDeclaration(Java8Parser.NormalClassDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classModifier}. - * @param ctx the parse tree - */ - void enterClassModifier(Java8Parser.ClassModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classModifier}. - * @param ctx the parse tree - */ - void exitClassModifier(Java8Parser.ClassModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeParameters}. - * @param ctx the parse tree - */ - void enterTypeParameters(Java8Parser.TypeParametersContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeParameters}. - * @param ctx the parse tree - */ - void exitTypeParameters(Java8Parser.TypeParametersContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeParameterList}. - * @param ctx the parse tree - */ - void enterTypeParameterList(Java8Parser.TypeParameterListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeParameterList}. - * @param ctx the parse tree - */ - void exitTypeParameterList(Java8Parser.TypeParameterListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#superclass}. - * @param ctx the parse tree - */ - void enterSuperclass(Java8Parser.SuperclassContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#superclass}. - * @param ctx the parse tree - */ - void exitSuperclass(Java8Parser.SuperclassContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#superinterfaces}. - * @param ctx the parse tree - */ - void enterSuperinterfaces(Java8Parser.SuperinterfacesContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#superinterfaces}. - * @param ctx the parse tree - */ - void exitSuperinterfaces(Java8Parser.SuperinterfacesContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceTypeList}. - * @param ctx the parse tree - */ - void enterInterfaceTypeList(Java8Parser.InterfaceTypeListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceTypeList}. - * @param ctx the parse tree - */ - void exitInterfaceTypeList(Java8Parser.InterfaceTypeListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classBody}. - * @param ctx the parse tree - */ - void enterClassBody(Java8Parser.ClassBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classBody}. - * @param ctx the parse tree - */ - void exitClassBody(Java8Parser.ClassBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classBodyDeclaration}. - * @param ctx the parse tree - */ - void enterClassBodyDeclaration(Java8Parser.ClassBodyDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classBodyDeclaration}. - * @param ctx the parse tree - */ - void exitClassBodyDeclaration(Java8Parser.ClassBodyDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classMemberDeclaration}. - * @param ctx the parse tree - */ - void enterClassMemberDeclaration(Java8Parser.ClassMemberDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classMemberDeclaration}. - * @param ctx the parse tree - */ - void exitClassMemberDeclaration(Java8Parser.ClassMemberDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#fieldDeclaration}. - * @param ctx the parse tree - */ - void enterFieldDeclaration(Java8Parser.FieldDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#fieldDeclaration}. - * @param ctx the parse tree - */ - void exitFieldDeclaration(Java8Parser.FieldDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#fieldModifier}. - * @param ctx the parse tree - */ - void enterFieldModifier(Java8Parser.FieldModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#fieldModifier}. - * @param ctx the parse tree - */ - void exitFieldModifier(Java8Parser.FieldModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#variableDeclaratorList}. - * @param ctx the parse tree - */ - void enterVariableDeclaratorList(Java8Parser.VariableDeclaratorListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#variableDeclaratorList}. - * @param ctx the parse tree - */ - void exitVariableDeclaratorList(Java8Parser.VariableDeclaratorListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#variableDeclarator}. - * @param ctx the parse tree - */ - void enterVariableDeclarator(Java8Parser.VariableDeclaratorContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#variableDeclarator}. - * @param ctx the parse tree - */ - void exitVariableDeclarator(Java8Parser.VariableDeclaratorContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#variableDeclaratorId}. - * @param ctx the parse tree - */ - void enterVariableDeclaratorId(Java8Parser.VariableDeclaratorIdContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#variableDeclaratorId}. - * @param ctx the parse tree - */ - void exitVariableDeclaratorId(Java8Parser.VariableDeclaratorIdContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#variableInitializer}. - * @param ctx the parse tree - */ - void enterVariableInitializer(Java8Parser.VariableInitializerContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#variableInitializer}. - * @param ctx the parse tree - */ - void exitVariableInitializer(Java8Parser.VariableInitializerContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannType}. - * @param ctx the parse tree - */ - void enterUnannType(Java8Parser.UnannTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannType}. - * @param ctx the parse tree - */ - void exitUnannType(Java8Parser.UnannTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannPrimitiveType}. - * @param ctx the parse tree - */ - void enterUnannPrimitiveType(Java8Parser.UnannPrimitiveTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannPrimitiveType}. - * @param ctx the parse tree - */ - void exitUnannPrimitiveType(Java8Parser.UnannPrimitiveTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannReferenceType}. - * @param ctx the parse tree - */ - void enterUnannReferenceType(Java8Parser.UnannReferenceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannReferenceType}. - * @param ctx the parse tree - */ - void exitUnannReferenceType(Java8Parser.UnannReferenceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void enterUnannClassOrInterfaceType(Java8Parser.UnannClassOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void exitUnannClassOrInterfaceType(Java8Parser.UnannClassOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannClassType}. - * @param ctx the parse tree - */ - void enterUnannClassType(Java8Parser.UnannClassTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannClassType}. - * @param ctx the parse tree - */ - void exitUnannClassType(Java8Parser.UnannClassTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannClassType_lf_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void enterUnannClassType_lf_unannClassOrInterfaceType(Java8Parser.UnannClassType_lf_unannClassOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannClassType_lf_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void exitUnannClassType_lf_unannClassOrInterfaceType(Java8Parser.UnannClassType_lf_unannClassOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannClassType_lfno_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void enterUnannClassType_lfno_unannClassOrInterfaceType(Java8Parser.UnannClassType_lfno_unannClassOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannClassType_lfno_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void exitUnannClassType_lfno_unannClassOrInterfaceType(Java8Parser.UnannClassType_lfno_unannClassOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannInterfaceType}. - * @param ctx the parse tree - */ - void enterUnannInterfaceType(Java8Parser.UnannInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannInterfaceType}. - * @param ctx the parse tree - */ - void exitUnannInterfaceType(Java8Parser.UnannInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannInterfaceType_lf_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void enterUnannInterfaceType_lf_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lf_unannClassOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannInterfaceType_lf_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void exitUnannInterfaceType_lf_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lf_unannClassOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannInterfaceType_lfno_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void enterUnannInterfaceType_lfno_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannInterfaceType_lfno_unannClassOrInterfaceType}. - * @param ctx the parse tree - */ - void exitUnannInterfaceType_lfno_unannClassOrInterfaceType(Java8Parser.UnannInterfaceType_lfno_unannClassOrInterfaceTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannTypeVariable}. - * @param ctx the parse tree - */ - void enterUnannTypeVariable(Java8Parser.UnannTypeVariableContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannTypeVariable}. - * @param ctx the parse tree - */ - void exitUnannTypeVariable(Java8Parser.UnannTypeVariableContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unannArrayType}. - * @param ctx the parse tree - */ - void enterUnannArrayType(Java8Parser.UnannArrayTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unannArrayType}. - * @param ctx the parse tree - */ - void exitUnannArrayType(Java8Parser.UnannArrayTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodDeclaration}. - * @param ctx the parse tree - */ - void enterMethodDeclaration(Java8Parser.MethodDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodDeclaration}. - * @param ctx the parse tree - */ - void exitMethodDeclaration(Java8Parser.MethodDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodModifier}. - * @param ctx the parse tree - */ - void enterMethodModifier(Java8Parser.MethodModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodModifier}. - * @param ctx the parse tree - */ - void exitMethodModifier(Java8Parser.MethodModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodHeader}. - * @param ctx the parse tree - */ - void enterMethodHeader(Java8Parser.MethodHeaderContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodHeader}. - * @param ctx the parse tree - */ - void exitMethodHeader(Java8Parser.MethodHeaderContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#result}. - * @param ctx the parse tree - */ - void enterResult(Java8Parser.ResultContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#result}. - * @param ctx the parse tree - */ - void exitResult(Java8Parser.ResultContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodDeclarator}. - * @param ctx the parse tree - */ - void enterMethodDeclarator(Java8Parser.MethodDeclaratorContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodDeclarator}. - * @param ctx the parse tree - */ - void exitMethodDeclarator(Java8Parser.MethodDeclaratorContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#formalParameterList}. - * @param ctx the parse tree - */ - void enterFormalParameterList(Java8Parser.FormalParameterListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#formalParameterList}. - * @param ctx the parse tree - */ - void exitFormalParameterList(Java8Parser.FormalParameterListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#formalParameters}. - * @param ctx the parse tree - */ - void enterFormalParameters(Java8Parser.FormalParametersContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#formalParameters}. - * @param ctx the parse tree - */ - void exitFormalParameters(Java8Parser.FormalParametersContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#formalParameter}. - * @param ctx the parse tree - */ - void enterFormalParameter(Java8Parser.FormalParameterContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#formalParameter}. - * @param ctx the parse tree - */ - void exitFormalParameter(Java8Parser.FormalParameterContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#variableModifier}. - * @param ctx the parse tree - */ - void enterVariableModifier(Java8Parser.VariableModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#variableModifier}. - * @param ctx the parse tree - */ - void exitVariableModifier(Java8Parser.VariableModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#lastFormalParameter}. - * @param ctx the parse tree - */ - void enterLastFormalParameter(Java8Parser.LastFormalParameterContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#lastFormalParameter}. - * @param ctx the parse tree - */ - void exitLastFormalParameter(Java8Parser.LastFormalParameterContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#receiverParameter}. - * @param ctx the parse tree - */ - void enterReceiverParameter(Java8Parser.ReceiverParameterContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#receiverParameter}. - * @param ctx the parse tree - */ - void exitReceiverParameter(Java8Parser.ReceiverParameterContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#throws_}. - * @param ctx the parse tree - */ - void enterThrows_(Java8Parser.Throws_Context ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#throws_}. - * @param ctx the parse tree - */ - void exitThrows_(Java8Parser.Throws_Context ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#exceptionTypeList}. - * @param ctx the parse tree - */ - void enterExceptionTypeList(Java8Parser.ExceptionTypeListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#exceptionTypeList}. - * @param ctx the parse tree - */ - void exitExceptionTypeList(Java8Parser.ExceptionTypeListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#exceptionType}. - * @param ctx the parse tree - */ - void enterExceptionType(Java8Parser.ExceptionTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#exceptionType}. - * @param ctx the parse tree - */ - void exitExceptionType(Java8Parser.ExceptionTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodBody}. - * @param ctx the parse tree - */ - void enterMethodBody(Java8Parser.MethodBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodBody}. - * @param ctx the parse tree - */ - void exitMethodBody(Java8Parser.MethodBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#instanceInitializer}. - * @param ctx the parse tree - */ - void enterInstanceInitializer(Java8Parser.InstanceInitializerContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#instanceInitializer}. - * @param ctx the parse tree - */ - void exitInstanceInitializer(Java8Parser.InstanceInitializerContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#staticInitializer}. - * @param ctx the parse tree - */ - void enterStaticInitializer(Java8Parser.StaticInitializerContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#staticInitializer}. - * @param ctx the parse tree - */ - void exitStaticInitializer(Java8Parser.StaticInitializerContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constructorDeclaration}. - * @param ctx the parse tree - */ - void enterConstructorDeclaration(Java8Parser.ConstructorDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constructorDeclaration}. - * @param ctx the parse tree - */ - void exitConstructorDeclaration(Java8Parser.ConstructorDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constructorModifier}. - * @param ctx the parse tree - */ - void enterConstructorModifier(Java8Parser.ConstructorModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constructorModifier}. - * @param ctx the parse tree - */ - void exitConstructorModifier(Java8Parser.ConstructorModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constructorDeclarator}. - * @param ctx the parse tree - */ - void enterConstructorDeclarator(Java8Parser.ConstructorDeclaratorContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constructorDeclarator}. - * @param ctx the parse tree - */ - void exitConstructorDeclarator(Java8Parser.ConstructorDeclaratorContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#simpleTypeName}. - * @param ctx the parse tree - */ - void enterSimpleTypeName(Java8Parser.SimpleTypeNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#simpleTypeName}. - * @param ctx the parse tree - */ - void exitSimpleTypeName(Java8Parser.SimpleTypeNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constructorBody}. - * @param ctx the parse tree - */ - void enterConstructorBody(Java8Parser.ConstructorBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constructorBody}. - * @param ctx the parse tree - */ - void exitConstructorBody(Java8Parser.ConstructorBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#explicitConstructorInvocation}. - * @param ctx the parse tree - */ - void enterExplicitConstructorInvocation(Java8Parser.ExplicitConstructorInvocationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#explicitConstructorInvocation}. - * @param ctx the parse tree - */ - void exitExplicitConstructorInvocation(Java8Parser.ExplicitConstructorInvocationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumDeclaration}. - * @param ctx the parse tree - */ - void enterEnumDeclaration(Java8Parser.EnumDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumDeclaration}. - * @param ctx the parse tree - */ - void exitEnumDeclaration(Java8Parser.EnumDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumBody}. - * @param ctx the parse tree - */ - void enterEnumBody(Java8Parser.EnumBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumBody}. - * @param ctx the parse tree - */ - void exitEnumBody(Java8Parser.EnumBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumConstantList}. - * @param ctx the parse tree - */ - void enterEnumConstantList(Java8Parser.EnumConstantListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumConstantList}. - * @param ctx the parse tree - */ - void exitEnumConstantList(Java8Parser.EnumConstantListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumConstant}. - * @param ctx the parse tree - */ - void enterEnumConstant(Java8Parser.EnumConstantContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumConstant}. - * @param ctx the parse tree - */ - void exitEnumConstant(Java8Parser.EnumConstantContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumConstantModifier}. - * @param ctx the parse tree - */ - void enterEnumConstantModifier(Java8Parser.EnumConstantModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumConstantModifier}. - * @param ctx the parse tree - */ - void exitEnumConstantModifier(Java8Parser.EnumConstantModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumBodyDeclarations}. - * @param ctx the parse tree - */ - void enterEnumBodyDeclarations(Java8Parser.EnumBodyDeclarationsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumBodyDeclarations}. - * @param ctx the parse tree - */ - void exitEnumBodyDeclarations(Java8Parser.EnumBodyDeclarationsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceDeclaration}. - * @param ctx the parse tree - */ - void enterInterfaceDeclaration(Java8Parser.InterfaceDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceDeclaration}. - * @param ctx the parse tree - */ - void exitInterfaceDeclaration(Java8Parser.InterfaceDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#normalInterfaceDeclaration}. - * @param ctx the parse tree - */ - void enterNormalInterfaceDeclaration(Java8Parser.NormalInterfaceDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#normalInterfaceDeclaration}. - * @param ctx the parse tree - */ - void exitNormalInterfaceDeclaration(Java8Parser.NormalInterfaceDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceModifier}. - * @param ctx the parse tree - */ - void enterInterfaceModifier(Java8Parser.InterfaceModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceModifier}. - * @param ctx the parse tree - */ - void exitInterfaceModifier(Java8Parser.InterfaceModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#extendsInterfaces}. - * @param ctx the parse tree - */ - void enterExtendsInterfaces(Java8Parser.ExtendsInterfacesContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#extendsInterfaces}. - * @param ctx the parse tree - */ - void exitExtendsInterfaces(Java8Parser.ExtendsInterfacesContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceBody}. - * @param ctx the parse tree - */ - void enterInterfaceBody(Java8Parser.InterfaceBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceBody}. - * @param ctx the parse tree - */ - void exitInterfaceBody(Java8Parser.InterfaceBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceMemberDeclaration}. - * @param ctx the parse tree - */ - void enterInterfaceMemberDeclaration(Java8Parser.InterfaceMemberDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceMemberDeclaration}. - * @param ctx the parse tree - */ - void exitInterfaceMemberDeclaration(Java8Parser.InterfaceMemberDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constantDeclaration}. - * @param ctx the parse tree - */ - void enterConstantDeclaration(Java8Parser.ConstantDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constantDeclaration}. - * @param ctx the parse tree - */ - void exitConstantDeclaration(Java8Parser.ConstantDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constantModifier}. - * @param ctx the parse tree - */ - void enterConstantModifier(Java8Parser.ConstantModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constantModifier}. - * @param ctx the parse tree - */ - void exitConstantModifier(Java8Parser.ConstantModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceMethodDeclaration}. - * @param ctx the parse tree - */ - void enterInterfaceMethodDeclaration(Java8Parser.InterfaceMethodDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceMethodDeclaration}. - * @param ctx the parse tree - */ - void exitInterfaceMethodDeclaration(Java8Parser.InterfaceMethodDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#interfaceMethodModifier}. - * @param ctx the parse tree - */ - void enterInterfaceMethodModifier(Java8Parser.InterfaceMethodModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#interfaceMethodModifier}. - * @param ctx the parse tree - */ - void exitInterfaceMethodModifier(Java8Parser.InterfaceMethodModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#annotationTypeDeclaration}. - * @param ctx the parse tree - */ - void enterAnnotationTypeDeclaration(Java8Parser.AnnotationTypeDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#annotationTypeDeclaration}. - * @param ctx the parse tree - */ - void exitAnnotationTypeDeclaration(Java8Parser.AnnotationTypeDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#annotationTypeBody}. - * @param ctx the parse tree - */ - void enterAnnotationTypeBody(Java8Parser.AnnotationTypeBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#annotationTypeBody}. - * @param ctx the parse tree - */ - void exitAnnotationTypeBody(Java8Parser.AnnotationTypeBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#annotationTypeMemberDeclaration}. - * @param ctx the parse tree - */ - void enterAnnotationTypeMemberDeclaration(Java8Parser.AnnotationTypeMemberDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#annotationTypeMemberDeclaration}. - * @param ctx the parse tree - */ - void exitAnnotationTypeMemberDeclaration(Java8Parser.AnnotationTypeMemberDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#annotationTypeElementDeclaration}. - * @param ctx the parse tree - */ - void enterAnnotationTypeElementDeclaration(Java8Parser.AnnotationTypeElementDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#annotationTypeElementDeclaration}. - * @param ctx the parse tree - */ - void exitAnnotationTypeElementDeclaration(Java8Parser.AnnotationTypeElementDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#annotationTypeElementModifier}. - * @param ctx the parse tree - */ - void enterAnnotationTypeElementModifier(Java8Parser.AnnotationTypeElementModifierContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#annotationTypeElementModifier}. - * @param ctx the parse tree - */ - void exitAnnotationTypeElementModifier(Java8Parser.AnnotationTypeElementModifierContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#defaultValue}. - * @param ctx the parse tree - */ - void enterDefaultValue(Java8Parser.DefaultValueContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#defaultValue}. - * @param ctx the parse tree - */ - void exitDefaultValue(Java8Parser.DefaultValueContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#annotation}. - * @param ctx the parse tree - */ - void enterAnnotation(Java8Parser.AnnotationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#annotation}. - * @param ctx the parse tree - */ - void exitAnnotation(Java8Parser.AnnotationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#normalAnnotation}. - * @param ctx the parse tree - */ - void enterNormalAnnotation(Java8Parser.NormalAnnotationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#normalAnnotation}. - * @param ctx the parse tree - */ - void exitNormalAnnotation(Java8Parser.NormalAnnotationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#elementValuePairList}. - * @param ctx the parse tree - */ - void enterElementValuePairList(Java8Parser.ElementValuePairListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#elementValuePairList}. - * @param ctx the parse tree - */ - void exitElementValuePairList(Java8Parser.ElementValuePairListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#elementValuePair}. - * @param ctx the parse tree - */ - void enterElementValuePair(Java8Parser.ElementValuePairContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#elementValuePair}. - * @param ctx the parse tree - */ - void exitElementValuePair(Java8Parser.ElementValuePairContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#elementValue}. - * @param ctx the parse tree - */ - void enterElementValue(Java8Parser.ElementValueContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#elementValue}. - * @param ctx the parse tree - */ - void exitElementValue(Java8Parser.ElementValueContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#elementValueArrayInitializer}. - * @param ctx the parse tree - */ - void enterElementValueArrayInitializer(Java8Parser.ElementValueArrayInitializerContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#elementValueArrayInitializer}. - * @param ctx the parse tree - */ - void exitElementValueArrayInitializer(Java8Parser.ElementValueArrayInitializerContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#elementValueList}. - * @param ctx the parse tree - */ - void enterElementValueList(Java8Parser.ElementValueListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#elementValueList}. - * @param ctx the parse tree - */ - void exitElementValueList(Java8Parser.ElementValueListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#markerAnnotation}. - * @param ctx the parse tree - */ - void enterMarkerAnnotation(Java8Parser.MarkerAnnotationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#markerAnnotation}. - * @param ctx the parse tree - */ - void exitMarkerAnnotation(Java8Parser.MarkerAnnotationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#singleElementAnnotation}. - * @param ctx the parse tree - */ - void enterSingleElementAnnotation(Java8Parser.SingleElementAnnotationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#singleElementAnnotation}. - * @param ctx the parse tree - */ - void exitSingleElementAnnotation(Java8Parser.SingleElementAnnotationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#arrayInitializer}. - * @param ctx the parse tree - */ - void enterArrayInitializer(Java8Parser.ArrayInitializerContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#arrayInitializer}. - * @param ctx the parse tree - */ - void exitArrayInitializer(Java8Parser.ArrayInitializerContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#variableInitializerList}. - * @param ctx the parse tree - */ - void enterVariableInitializerList(Java8Parser.VariableInitializerListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#variableInitializerList}. - * @param ctx the parse tree - */ - void exitVariableInitializerList(Java8Parser.VariableInitializerListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#block}. - * @param ctx the parse tree - */ - void enterBlock(Java8Parser.BlockContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#block}. - * @param ctx the parse tree - */ - void exitBlock(Java8Parser.BlockContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#blockStatements}. - * @param ctx the parse tree - */ - void enterBlockStatements(Java8Parser.BlockStatementsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#blockStatements}. - * @param ctx the parse tree - */ - void exitBlockStatements(Java8Parser.BlockStatementsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#blockStatement}. - * @param ctx the parse tree - */ - void enterBlockStatement(Java8Parser.BlockStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#blockStatement}. - * @param ctx the parse tree - */ - void exitBlockStatement(Java8Parser.BlockStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#localVariableDeclarationStatement}. - * @param ctx the parse tree - */ - void enterLocalVariableDeclarationStatement(Java8Parser.LocalVariableDeclarationStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#localVariableDeclarationStatement}. - * @param ctx the parse tree - */ - void exitLocalVariableDeclarationStatement(Java8Parser.LocalVariableDeclarationStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#localVariableDeclaration}. - * @param ctx the parse tree - */ - void enterLocalVariableDeclaration(Java8Parser.LocalVariableDeclarationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#localVariableDeclaration}. - * @param ctx the parse tree - */ - void exitLocalVariableDeclaration(Java8Parser.LocalVariableDeclarationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#statement}. - * @param ctx the parse tree - */ - void enterStatement(Java8Parser.StatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#statement}. - * @param ctx the parse tree - */ - void exitStatement(Java8Parser.StatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#statementNoShortIf}. - * @param ctx the parse tree - */ - void enterStatementNoShortIf(Java8Parser.StatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#statementNoShortIf}. - * @param ctx the parse tree - */ - void exitStatementNoShortIf(Java8Parser.StatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#statementWithoutTrailingSubstatement}. - * @param ctx the parse tree - */ - void enterStatementWithoutTrailingSubstatement(Java8Parser.StatementWithoutTrailingSubstatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#statementWithoutTrailingSubstatement}. - * @param ctx the parse tree - */ - void exitStatementWithoutTrailingSubstatement(Java8Parser.StatementWithoutTrailingSubstatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#emptyStatement_}. - * @param ctx the parse tree - */ - void enterEmptyStatement_(Java8Parser.EmptyStatement_Context ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#emptyStatement_}. - * @param ctx the parse tree - */ - void exitEmptyStatement_(Java8Parser.EmptyStatement_Context ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#labeledStatement}. - * @param ctx the parse tree - */ - void enterLabeledStatement(Java8Parser.LabeledStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#labeledStatement}. - * @param ctx the parse tree - */ - void exitLabeledStatement(Java8Parser.LabeledStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#labeledStatementNoShortIf}. - * @param ctx the parse tree - */ - void enterLabeledStatementNoShortIf(Java8Parser.LabeledStatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#labeledStatementNoShortIf}. - * @param ctx the parse tree - */ - void exitLabeledStatementNoShortIf(Java8Parser.LabeledStatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#expressionStatement}. - * @param ctx the parse tree - */ - void enterExpressionStatement(Java8Parser.ExpressionStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#expressionStatement}. - * @param ctx the parse tree - */ - void exitExpressionStatement(Java8Parser.ExpressionStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#statementExpression}. - * @param ctx the parse tree - */ - void enterStatementExpression(Java8Parser.StatementExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#statementExpression}. - * @param ctx the parse tree - */ - void exitStatementExpression(Java8Parser.StatementExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#ifThenStatement}. - * @param ctx the parse tree - */ - void enterIfThenStatement(Java8Parser.IfThenStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#ifThenStatement}. - * @param ctx the parse tree - */ - void exitIfThenStatement(Java8Parser.IfThenStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#ifThenElseStatement}. - * @param ctx the parse tree - */ - void enterIfThenElseStatement(Java8Parser.IfThenElseStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#ifThenElseStatement}. - * @param ctx the parse tree - */ - void exitIfThenElseStatement(Java8Parser.IfThenElseStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#ifThenElseStatementNoShortIf}. - * @param ctx the parse tree - */ - void enterIfThenElseStatementNoShortIf(Java8Parser.IfThenElseStatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#ifThenElseStatementNoShortIf}. - * @param ctx the parse tree - */ - void exitIfThenElseStatementNoShortIf(Java8Parser.IfThenElseStatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#assertStatement}. - * @param ctx the parse tree - */ - void enterAssertStatement(Java8Parser.AssertStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#assertStatement}. - * @param ctx the parse tree - */ - void exitAssertStatement(Java8Parser.AssertStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#switchStatement}. - * @param ctx the parse tree - */ - void enterSwitchStatement(Java8Parser.SwitchStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#switchStatement}. - * @param ctx the parse tree - */ - void exitSwitchStatement(Java8Parser.SwitchStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#switchBlock}. - * @param ctx the parse tree - */ - void enterSwitchBlock(Java8Parser.SwitchBlockContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#switchBlock}. - * @param ctx the parse tree - */ - void exitSwitchBlock(Java8Parser.SwitchBlockContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#switchBlockStatementGroup}. - * @param ctx the parse tree - */ - void enterSwitchBlockStatementGroup(Java8Parser.SwitchBlockStatementGroupContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#switchBlockStatementGroup}. - * @param ctx the parse tree - */ - void exitSwitchBlockStatementGroup(Java8Parser.SwitchBlockStatementGroupContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#switchLabels}. - * @param ctx the parse tree - */ - void enterSwitchLabels(Java8Parser.SwitchLabelsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#switchLabels}. - * @param ctx the parse tree - */ - void exitSwitchLabels(Java8Parser.SwitchLabelsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#switchLabel}. - * @param ctx the parse tree - */ - void enterSwitchLabel(Java8Parser.SwitchLabelContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#switchLabel}. - * @param ctx the parse tree - */ - void exitSwitchLabel(Java8Parser.SwitchLabelContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enumConstantName}. - * @param ctx the parse tree - */ - void enterEnumConstantName(Java8Parser.EnumConstantNameContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enumConstantName}. - * @param ctx the parse tree - */ - void exitEnumConstantName(Java8Parser.EnumConstantNameContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#whileStatement}. - * @param ctx the parse tree - */ - void enterWhileStatement(Java8Parser.WhileStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#whileStatement}. - * @param ctx the parse tree - */ - void exitWhileStatement(Java8Parser.WhileStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#whileStatementNoShortIf}. - * @param ctx the parse tree - */ - void enterWhileStatementNoShortIf(Java8Parser.WhileStatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#whileStatementNoShortIf}. - * @param ctx the parse tree - */ - void exitWhileStatementNoShortIf(Java8Parser.WhileStatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#doStatement}. - * @param ctx the parse tree - */ - void enterDoStatement(Java8Parser.DoStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#doStatement}. - * @param ctx the parse tree - */ - void exitDoStatement(Java8Parser.DoStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#forStatement}. - * @param ctx the parse tree - */ - void enterForStatement(Java8Parser.ForStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#forStatement}. - * @param ctx the parse tree - */ - void exitForStatement(Java8Parser.ForStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#forStatementNoShortIf}. - * @param ctx the parse tree - */ - void enterForStatementNoShortIf(Java8Parser.ForStatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#forStatementNoShortIf}. - * @param ctx the parse tree - */ - void exitForStatementNoShortIf(Java8Parser.ForStatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#basicForStatement}. - * @param ctx the parse tree - */ - void enterBasicForStatement(Java8Parser.BasicForStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#basicForStatement}. - * @param ctx the parse tree - */ - void exitBasicForStatement(Java8Parser.BasicForStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#basicForStatementNoShortIf}. - * @param ctx the parse tree - */ - void enterBasicForStatementNoShortIf(Java8Parser.BasicForStatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#basicForStatementNoShortIf}. - * @param ctx the parse tree - */ - void exitBasicForStatementNoShortIf(Java8Parser.BasicForStatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#forInit}. - * @param ctx the parse tree - */ - void enterForInit(Java8Parser.ForInitContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#forInit}. - * @param ctx the parse tree - */ - void exitForInit(Java8Parser.ForInitContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#forUpdate}. - * @param ctx the parse tree - */ - void enterForUpdate(Java8Parser.ForUpdateContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#forUpdate}. - * @param ctx the parse tree - */ - void exitForUpdate(Java8Parser.ForUpdateContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#statementExpressionList}. - * @param ctx the parse tree - */ - void enterStatementExpressionList(Java8Parser.StatementExpressionListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#statementExpressionList}. - * @param ctx the parse tree - */ - void exitStatementExpressionList(Java8Parser.StatementExpressionListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enhancedForStatement}. - * @param ctx the parse tree - */ - void enterEnhancedForStatement(Java8Parser.EnhancedForStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enhancedForStatement}. - * @param ctx the parse tree - */ - void exitEnhancedForStatement(Java8Parser.EnhancedForStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#enhancedForStatementNoShortIf}. - * @param ctx the parse tree - */ - void enterEnhancedForStatementNoShortIf(Java8Parser.EnhancedForStatementNoShortIfContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#enhancedForStatementNoShortIf}. - * @param ctx the parse tree - */ - void exitEnhancedForStatementNoShortIf(Java8Parser.EnhancedForStatementNoShortIfContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#breakStatement}. - * @param ctx the parse tree - */ - void enterBreakStatement(Java8Parser.BreakStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#breakStatement}. - * @param ctx the parse tree - */ - void exitBreakStatement(Java8Parser.BreakStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#continueStatement}. - * @param ctx the parse tree - */ - void enterContinueStatement(Java8Parser.ContinueStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#continueStatement}. - * @param ctx the parse tree - */ - void exitContinueStatement(Java8Parser.ContinueStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#returnStatement}. - * @param ctx the parse tree - */ - void enterReturnStatement(Java8Parser.ReturnStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#returnStatement}. - * @param ctx the parse tree - */ - void exitReturnStatement(Java8Parser.ReturnStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#throwStatement}. - * @param ctx the parse tree - */ - void enterThrowStatement(Java8Parser.ThrowStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#throwStatement}. - * @param ctx the parse tree - */ - void exitThrowStatement(Java8Parser.ThrowStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#synchronizedStatement}. - * @param ctx the parse tree - */ - void enterSynchronizedStatement(Java8Parser.SynchronizedStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#synchronizedStatement}. - * @param ctx the parse tree - */ - void exitSynchronizedStatement(Java8Parser.SynchronizedStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#tryStatement}. - * @param ctx the parse tree - */ - void enterTryStatement(Java8Parser.TryStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#tryStatement}. - * @param ctx the parse tree - */ - void exitTryStatement(Java8Parser.TryStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#catches}. - * @param ctx the parse tree - */ - void enterCatches(Java8Parser.CatchesContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#catches}. - * @param ctx the parse tree - */ - void exitCatches(Java8Parser.CatchesContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#catchClause}. - * @param ctx the parse tree - */ - void enterCatchClause(Java8Parser.CatchClauseContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#catchClause}. - * @param ctx the parse tree - */ - void exitCatchClause(Java8Parser.CatchClauseContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#catchFormalParameter}. - * @param ctx the parse tree - */ - void enterCatchFormalParameter(Java8Parser.CatchFormalParameterContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#catchFormalParameter}. - * @param ctx the parse tree - */ - void exitCatchFormalParameter(Java8Parser.CatchFormalParameterContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#catchType}. - * @param ctx the parse tree - */ - void enterCatchType(Java8Parser.CatchTypeContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#catchType}. - * @param ctx the parse tree - */ - void exitCatchType(Java8Parser.CatchTypeContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#finally_}. - * @param ctx the parse tree - */ - void enterFinally_(Java8Parser.Finally_Context ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#finally_}. - * @param ctx the parse tree - */ - void exitFinally_(Java8Parser.Finally_Context ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#tryWithResourcesStatement}. - * @param ctx the parse tree - */ - void enterTryWithResourcesStatement(Java8Parser.TryWithResourcesStatementContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#tryWithResourcesStatement}. - * @param ctx the parse tree - */ - void exitTryWithResourcesStatement(Java8Parser.TryWithResourcesStatementContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#resourceSpecification}. - * @param ctx the parse tree - */ - void enterResourceSpecification(Java8Parser.ResourceSpecificationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#resourceSpecification}. - * @param ctx the parse tree - */ - void exitResourceSpecification(Java8Parser.ResourceSpecificationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#resourceList}. - * @param ctx the parse tree - */ - void enterResourceList(Java8Parser.ResourceListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#resourceList}. - * @param ctx the parse tree - */ - void exitResourceList(Java8Parser.ResourceListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#resource}. - * @param ctx the parse tree - */ - void enterResource(Java8Parser.ResourceContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#resource}. - * @param ctx the parse tree - */ - void exitResource(Java8Parser.ResourceContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primary}. - * @param ctx the parse tree - */ - void enterPrimary(Java8Parser.PrimaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primary}. - * @param ctx the parse tree - */ - void exitPrimary(Java8Parser.PrimaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray(Java8Parser.PrimaryNoNewArrayContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray(Java8Parser.PrimaryNoNewArrayContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_arrayAccess}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lf_arrayAccess(Java8Parser.PrimaryNoNewArray_lf_arrayAccessContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_arrayAccess}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lf_arrayAccess(Java8Parser.PrimaryNoNewArray_lf_arrayAccessContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_arrayAccess}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lfno_arrayAccess(Java8Parser.PrimaryNoNewArray_lfno_arrayAccessContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_arrayAccess}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lfno_arrayAccess(Java8Parser.PrimaryNoNewArray_lfno_arrayAccessContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_primary}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_primary}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lf_arrayAccess_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary(Java8Parser.PrimaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_primary}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_primary}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary}. - * @param ctx the parse tree - */ - void enterPrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary}. - * @param ctx the parse tree - */ - void exitPrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary(Java8Parser.PrimaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classInstanceCreationExpression}. - * @param ctx the parse tree - */ - void enterClassInstanceCreationExpression(Java8Parser.ClassInstanceCreationExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classInstanceCreationExpression}. - * @param ctx the parse tree - */ - void exitClassInstanceCreationExpression(Java8Parser.ClassInstanceCreationExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classInstanceCreationExpression_lf_primary}. - * @param ctx the parse tree - */ - void enterClassInstanceCreationExpression_lf_primary(Java8Parser.ClassInstanceCreationExpression_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classInstanceCreationExpression_lf_primary}. - * @param ctx the parse tree - */ - void exitClassInstanceCreationExpression_lf_primary(Java8Parser.ClassInstanceCreationExpression_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#classInstanceCreationExpression_lfno_primary}. - * @param ctx the parse tree - */ - void enterClassInstanceCreationExpression_lfno_primary(Java8Parser.ClassInstanceCreationExpression_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#classInstanceCreationExpression_lfno_primary}. - * @param ctx the parse tree - */ - void exitClassInstanceCreationExpression_lfno_primary(Java8Parser.ClassInstanceCreationExpression_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#typeArgumentsOrDiamond}. - * @param ctx the parse tree - */ - void enterTypeArgumentsOrDiamond(Java8Parser.TypeArgumentsOrDiamondContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#typeArgumentsOrDiamond}. - * @param ctx the parse tree - */ - void exitTypeArgumentsOrDiamond(Java8Parser.TypeArgumentsOrDiamondContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#fieldAccess}. - * @param ctx the parse tree - */ - void enterFieldAccess(Java8Parser.FieldAccessContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#fieldAccess}. - * @param ctx the parse tree - */ - void exitFieldAccess(Java8Parser.FieldAccessContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#fieldAccess_lf_primary}. - * @param ctx the parse tree - */ - void enterFieldAccess_lf_primary(Java8Parser.FieldAccess_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#fieldAccess_lf_primary}. - * @param ctx the parse tree - */ - void exitFieldAccess_lf_primary(Java8Parser.FieldAccess_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#fieldAccess_lfno_primary}. - * @param ctx the parse tree - */ - void enterFieldAccess_lfno_primary(Java8Parser.FieldAccess_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#fieldAccess_lfno_primary}. - * @param ctx the parse tree - */ - void exitFieldAccess_lfno_primary(Java8Parser.FieldAccess_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#arrayAccess}. - * @param ctx the parse tree - */ - void enterArrayAccess(Java8Parser.ArrayAccessContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#arrayAccess}. - * @param ctx the parse tree - */ - void exitArrayAccess(Java8Parser.ArrayAccessContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#arrayAccess_lf_primary}. - * @param ctx the parse tree - */ - void enterArrayAccess_lf_primary(Java8Parser.ArrayAccess_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#arrayAccess_lf_primary}. - * @param ctx the parse tree - */ - void exitArrayAccess_lf_primary(Java8Parser.ArrayAccess_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#arrayAccess_lfno_primary}. - * @param ctx the parse tree - */ - void enterArrayAccess_lfno_primary(Java8Parser.ArrayAccess_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#arrayAccess_lfno_primary}. - * @param ctx the parse tree - */ - void exitArrayAccess_lfno_primary(Java8Parser.ArrayAccess_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodInvocation}. - * @param ctx the parse tree - */ - void enterMethodInvocation(Java8Parser.MethodInvocationContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodInvocation}. - * @param ctx the parse tree - */ - void exitMethodInvocation(Java8Parser.MethodInvocationContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodInvocation_lf_primary}. - * @param ctx the parse tree - */ - void enterMethodInvocation_lf_primary(Java8Parser.MethodInvocation_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodInvocation_lf_primary}. - * @param ctx the parse tree - */ - void exitMethodInvocation_lf_primary(Java8Parser.MethodInvocation_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodInvocation_lfno_primary}. - * @param ctx the parse tree - */ - void enterMethodInvocation_lfno_primary(Java8Parser.MethodInvocation_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodInvocation_lfno_primary}. - * @param ctx the parse tree - */ - void exitMethodInvocation_lfno_primary(Java8Parser.MethodInvocation_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#argumentList}. - * @param ctx the parse tree - */ - void enterArgumentList(Java8Parser.ArgumentListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#argumentList}. - * @param ctx the parse tree - */ - void exitArgumentList(Java8Parser.ArgumentListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodReference}. - * @param ctx the parse tree - */ - void enterMethodReference(Java8Parser.MethodReferenceContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodReference}. - * @param ctx the parse tree - */ - void exitMethodReference(Java8Parser.MethodReferenceContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodReference_lf_primary}. - * @param ctx the parse tree - */ - void enterMethodReference_lf_primary(Java8Parser.MethodReference_lf_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodReference_lf_primary}. - * @param ctx the parse tree - */ - void exitMethodReference_lf_primary(Java8Parser.MethodReference_lf_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#methodReference_lfno_primary}. - * @param ctx the parse tree - */ - void enterMethodReference_lfno_primary(Java8Parser.MethodReference_lfno_primaryContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#methodReference_lfno_primary}. - * @param ctx the parse tree - */ - void exitMethodReference_lfno_primary(Java8Parser.MethodReference_lfno_primaryContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#arrayCreationExpression}. - * @param ctx the parse tree - */ - void enterArrayCreationExpression(Java8Parser.ArrayCreationExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#arrayCreationExpression}. - * @param ctx the parse tree - */ - void exitArrayCreationExpression(Java8Parser.ArrayCreationExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#dimExprs}. - * @param ctx the parse tree - */ - void enterDimExprs(Java8Parser.DimExprsContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#dimExprs}. - * @param ctx the parse tree - */ - void exitDimExprs(Java8Parser.DimExprsContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#dimExpr}. - * @param ctx the parse tree - */ - void enterDimExpr(Java8Parser.DimExprContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#dimExpr}. - * @param ctx the parse tree - */ - void exitDimExpr(Java8Parser.DimExprContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#constantExpression}. - * @param ctx the parse tree - */ - void enterConstantExpression(Java8Parser.ConstantExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#constantExpression}. - * @param ctx the parse tree - */ - void exitConstantExpression(Java8Parser.ConstantExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#expression}. - * @param ctx the parse tree - */ - void enterExpression(Java8Parser.ExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#expression}. - * @param ctx the parse tree - */ - void exitExpression(Java8Parser.ExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#lambdaExpression}. - * @param ctx the parse tree - */ - void enterLambdaExpression(Java8Parser.LambdaExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#lambdaExpression}. - * @param ctx the parse tree - */ - void exitLambdaExpression(Java8Parser.LambdaExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#lambdaParameters}. - * @param ctx the parse tree - */ - void enterLambdaParameters(Java8Parser.LambdaParametersContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#lambdaParameters}. - * @param ctx the parse tree - */ - void exitLambdaParameters(Java8Parser.LambdaParametersContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#inferredFormalParameterList}. - * @param ctx the parse tree - */ - void enterInferredFormalParameterList(Java8Parser.InferredFormalParameterListContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#inferredFormalParameterList}. - * @param ctx the parse tree - */ - void exitInferredFormalParameterList(Java8Parser.InferredFormalParameterListContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#lambdaBody}. - * @param ctx the parse tree - */ - void enterLambdaBody(Java8Parser.LambdaBodyContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#lambdaBody}. - * @param ctx the parse tree - */ - void exitLambdaBody(Java8Parser.LambdaBodyContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#assignmentExpression}. - * @param ctx the parse tree - */ - void enterAssignmentExpression(Java8Parser.AssignmentExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#assignmentExpression}. - * @param ctx the parse tree - */ - void exitAssignmentExpression(Java8Parser.AssignmentExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#assignment}. - * @param ctx the parse tree - */ - void enterAssignment(Java8Parser.AssignmentContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#assignment}. - * @param ctx the parse tree - */ - void exitAssignment(Java8Parser.AssignmentContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#leftHandSide}. - * @param ctx the parse tree - */ - void enterLeftHandSide(Java8Parser.LeftHandSideContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#leftHandSide}. - * @param ctx the parse tree - */ - void exitLeftHandSide(Java8Parser.LeftHandSideContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#assignmentOperator}. - * @param ctx the parse tree - */ - void enterAssignmentOperator(Java8Parser.AssignmentOperatorContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#assignmentOperator}. - * @param ctx the parse tree - */ - void exitAssignmentOperator(Java8Parser.AssignmentOperatorContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#conditionalExpression}. - * @param ctx the parse tree - */ - void enterConditionalExpression(Java8Parser.ConditionalExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#conditionalExpression}. - * @param ctx the parse tree - */ - void exitConditionalExpression(Java8Parser.ConditionalExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#conditionalOrExpression}. - * @param ctx the parse tree - */ - void enterConditionalOrExpression(Java8Parser.ConditionalOrExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#conditionalOrExpression}. - * @param ctx the parse tree - */ - void exitConditionalOrExpression(Java8Parser.ConditionalOrExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#conditionalAndExpression}. - * @param ctx the parse tree - */ - void enterConditionalAndExpression(Java8Parser.ConditionalAndExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#conditionalAndExpression}. - * @param ctx the parse tree - */ - void exitConditionalAndExpression(Java8Parser.ConditionalAndExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#inclusiveOrExpression}. - * @param ctx the parse tree - */ - void enterInclusiveOrExpression(Java8Parser.InclusiveOrExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#inclusiveOrExpression}. - * @param ctx the parse tree - */ - void exitInclusiveOrExpression(Java8Parser.InclusiveOrExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#exclusiveOrExpression}. - * @param ctx the parse tree - */ - void enterExclusiveOrExpression(Java8Parser.ExclusiveOrExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#exclusiveOrExpression}. - * @param ctx the parse tree - */ - void exitExclusiveOrExpression(Java8Parser.ExclusiveOrExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#andExpression}. - * @param ctx the parse tree - */ - void enterAndExpression(Java8Parser.AndExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#andExpression}. - * @param ctx the parse tree - */ - void exitAndExpression(Java8Parser.AndExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#equalityExpression}. - * @param ctx the parse tree - */ - void enterEqualityExpression(Java8Parser.EqualityExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#equalityExpression}. - * @param ctx the parse tree - */ - void exitEqualityExpression(Java8Parser.EqualityExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#relationalExpression}. - * @param ctx the parse tree - */ - void enterRelationalExpression(Java8Parser.RelationalExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#relationalExpression}. - * @param ctx the parse tree - */ - void exitRelationalExpression(Java8Parser.RelationalExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#shiftExpression}. - * @param ctx the parse tree - */ - void enterShiftExpression(Java8Parser.ShiftExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#shiftExpression}. - * @param ctx the parse tree - */ - void exitShiftExpression(Java8Parser.ShiftExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#additiveExpression}. - * @param ctx the parse tree - */ - void enterAdditiveExpression(Java8Parser.AdditiveExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#additiveExpression}. - * @param ctx the parse tree - */ - void exitAdditiveExpression(Java8Parser.AdditiveExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#multiplicativeExpression}. - * @param ctx the parse tree - */ - void enterMultiplicativeExpression(Java8Parser.MultiplicativeExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#multiplicativeExpression}. - * @param ctx the parse tree - */ - void exitMultiplicativeExpression(Java8Parser.MultiplicativeExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unaryExpression}. - * @param ctx the parse tree - */ - void enterUnaryExpression(Java8Parser.UnaryExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unaryExpression}. - * @param ctx the parse tree - */ - void exitUnaryExpression(Java8Parser.UnaryExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#preIncrementExpression}. - * @param ctx the parse tree - */ - void enterPreIncrementExpression(Java8Parser.PreIncrementExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#preIncrementExpression}. - * @param ctx the parse tree - */ - void exitPreIncrementExpression(Java8Parser.PreIncrementExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#preDecrementExpression}. - * @param ctx the parse tree - */ - void enterPreDecrementExpression(Java8Parser.PreDecrementExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#preDecrementExpression}. - * @param ctx the parse tree - */ - void exitPreDecrementExpression(Java8Parser.PreDecrementExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#unaryExpressionNotPlusMinus}. - * @param ctx the parse tree - */ - void enterUnaryExpressionNotPlusMinus(Java8Parser.UnaryExpressionNotPlusMinusContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#unaryExpressionNotPlusMinus}. - * @param ctx the parse tree - */ - void exitUnaryExpressionNotPlusMinus(Java8Parser.UnaryExpressionNotPlusMinusContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#postfixExpression}. - * @param ctx the parse tree - */ - void enterPostfixExpression(Java8Parser.PostfixExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#postfixExpression}. - * @param ctx the parse tree - */ - void exitPostfixExpression(Java8Parser.PostfixExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#postIncrementExpression}. - * @param ctx the parse tree - */ - void enterPostIncrementExpression(Java8Parser.PostIncrementExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#postIncrementExpression}. - * @param ctx the parse tree - */ - void exitPostIncrementExpression(Java8Parser.PostIncrementExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#postIncrementExpression_lf_postfixExpression}. - * @param ctx the parse tree - */ - void enterPostIncrementExpression_lf_postfixExpression(Java8Parser.PostIncrementExpression_lf_postfixExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#postIncrementExpression_lf_postfixExpression}. - * @param ctx the parse tree - */ - void exitPostIncrementExpression_lf_postfixExpression(Java8Parser.PostIncrementExpression_lf_postfixExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#postDecrementExpression}. - * @param ctx the parse tree - */ - void enterPostDecrementExpression(Java8Parser.PostDecrementExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#postDecrementExpression}. - * @param ctx the parse tree - */ - void exitPostDecrementExpression(Java8Parser.PostDecrementExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#postDecrementExpression_lf_postfixExpression}. - * @param ctx the parse tree - */ - void enterPostDecrementExpression_lf_postfixExpression(Java8Parser.PostDecrementExpression_lf_postfixExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#postDecrementExpression_lf_postfixExpression}. - * @param ctx the parse tree - */ - void exitPostDecrementExpression_lf_postfixExpression(Java8Parser.PostDecrementExpression_lf_postfixExpressionContext ctx); - /** - * Enter a parse tree produced by {@link Java8Parser#castExpression}. - * @param ctx the parse tree - */ - void enterCastExpression(Java8Parser.CastExpressionContext ctx); - /** - * Exit a parse tree produced by {@link Java8Parser#castExpression}. - * @param ctx the parse tree - */ - void exitCastExpression(Java8Parser.CastExpressionContext ctx); -} \ No newline at end of file diff --git a/Assignment-2/antlr-4.13.2-complete.jar b/Assignment-2/Java-8/antlr-4.13.2-complete.jar similarity index 100% rename from Assignment-2/antlr-4.13.2-complete.jar rename to Assignment-2/Java-8/antlr-4.13.2-complete.jar diff --git a/Assignment-2/Java-8/test.java b/Assignment-2/Java-8/test.java new file mode 100644 index 0000000..2946a3f --- /dev/null +++ b/Assignment-2/Java-8/test.java @@ -0,0 +1,14 @@ +public class test { + void methodOne() { + class Helper234 { + void doStuff() {} + } + class Helper2 { + void doStuff() {} + } + } + + void methodTwo() { + System.out.println("Hello"); + } +} diff --git a/Assignment-2/README.md b/Assignment-2/README.md index 1e38617..4154f0f 100644 --- a/Assignment-2/README.md +++ b/Assignment-2/README.md @@ -1,7 +1,17 @@ # Readme File -LCA parser use the jva 8 grammer provided +## Java-8 +```bash + antr4 Java8Lexer.g4 Java8Parser.g4 + javac *.java + java -cp ".:antlr-4.13.2-complete.jar" ExprTool ./Test/TaxApp.java +``` + + +## JavaParser1.0.0 ```bash javac -cp .:javaparser-1.0.0.jar LCA_JP1_0_0.java java -cp .:javaparser-1.0.0.jar test.java -``` \ No newline at end of file +``` + +## JavaParser3.27.0 diff --git a/Assignment-2/javaparser-1.0.0-src.zip b/Assignment-2/javaparser-1.0.0-src.zip deleted file mode 100644 index aa42ce4..0000000 Binary files a/Assignment-2/javaparser-1.0.0-src.zip and /dev/null differ diff --git a/Assignment-2/javaparser-1.0.0-src/java_1_5.html b/Assignment-2/javaparser-1.0.0-src/java_1_5.html deleted file mode 100644 index 5bbcd97..0000000 --- a/Assignment-2/javaparser-1.0.0-src/java_1_5.html +++ /dev/null @@ -1,557 +0,0 @@ - - - -BNF for java_1_5.jj - - -

BNF for java_1_5.jj

-

NON-TERMINALS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CompilationUnit::=( PackageDeclaration )? ( ImportDeclaration )* ( TypeDeclaration )* ( <EOF> | "\u001a" )
PackageDeclaration::=( Annotation )* "package" Name ";"
ImportDeclaration::="import" ( "static" )? Name ( "." "*" )? ";"
Modifiers::=( ( "public" | "static" | "protected" | "private" | "final" | "abstract" | "synchronized" | "native" | "transient" | "volatile" | "strictfp" | Annotation ) )*
TypeDeclaration::=( ";" | Modifiers ( ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration ) )
ClassOrInterfaceDeclaration::=( "class" | "interface" ) <IDENTIFIER> ( TypeParameters )? ( ExtendsList )? ( ImplementsList )? ClassOrInterfaceBody
ExtendsList::="extends" ClassOrInterfaceType ( "," ClassOrInterfaceType )*
ImplementsList::="implements" ClassOrInterfaceType ( "," ClassOrInterfaceType )*
EnumDeclaration::="enum" <IDENTIFIER> ( ImplementsList )? "{" ( EnumConstantDeclaration ( "," EnumConstantDeclaration )* )? ( "," )? ( ( ";" ( ClassOrInterfaceBodyDeclaration )* ) )? "}"
EnumConstantDeclaration::=( Annotation )* <IDENTIFIER> ( Arguments )? ( ClassOrInterfaceBody )?
TypeParameters::="<" TypeParameter ( "," TypeParameter )* ">"
TypeParameter::=<IDENTIFIER> ( TypeBound )?
TypeBound::="extends" ClassOrInterfaceType ( "&" ClassOrInterfaceType )*
ClassOrInterfaceBody::="{" ( ClassOrInterfaceBodyDeclaration )* "}"
ClassOrInterfaceBodyDeclaration::=( InitializerDeclaration | Modifiers ( ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration | ConstructorDeclaration | FieldDeclaration | MethodDeclaration ) | ";" )
FieldDeclaration::=Type VariableDeclarator ( "," VariableDeclarator )* ";"
VariableDeclarator::=VariableDeclaratorId ( "=" VariableInitializer )?
VariableDeclaratorId::=<IDENTIFIER> ( "[" "]" )*
VariableInitializer::=( ArrayInitializer | Expression )
ArrayInitializer::="{" ( VariableInitializer ( "," VariableInitializer )* )? ( "," )? "}"
MethodDeclaration::=( TypeParameters )? ResultType <IDENTIFIER> FormalParameters ( "[" "]" )* ( "throws" NameList )? ( Block | ";" )
FormalParameters::="(" ( FormalParameter ( "," FormalParameter )* )? ")"
FormalParameter::=Modifiers Type ( "..." )? VariableDeclaratorId
ConstructorDeclaration::=( TypeParameters )? <IDENTIFIER> FormalParameters ( "throws" NameList )? "{" ( ExplicitConstructorInvocation )? Statements "}"
ExplicitConstructorInvocation::=( ( TypeArguments )? "this" Arguments ";" | ( PrimaryExpressionWithoutSuperSuffix "." )? ( TypeArguments )? "super" Arguments ";" )
Statements::=( BlockStatement )*
InitializerDeclaration::=( "static" )? Block
Type::=( ReferenceType | PrimitiveType )
ReferenceType::=( PrimitiveType ( "[" "]" )+ | ClassOrInterfaceType ( "[" "]" )* )
ClassOrInterfaceType::=<IDENTIFIER> ( TypeArguments )? ( "." <IDENTIFIER> ( TypeArguments )? )*
TypeArguments::="<" TypeArgument ( "," TypeArgument )* ">"
TypeArgument::=( ReferenceType | Wildcard )
Wildcard::="?" ( "extends" ReferenceType | "super" ReferenceType )?
PrimitiveType::=( "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" )
ResultType::=( "void" | Type )
Name::=<IDENTIFIER> ( "." <IDENTIFIER> )*
NameList::=Name ( "," Name )*
Expression::=ConditionalExpression ( AssignmentOperator Expression )?
AssignmentOperator::=( "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" )
ConditionalExpression::=ConditionalOrExpression ( "?" Expression ":" ConditionalExpression )?
ConditionalOrExpression::=ConditionalAndExpression ( "||" ConditionalAndExpression )*
ConditionalAndExpression::=InclusiveOrExpression ( "&&" InclusiveOrExpression )*
InclusiveOrExpression::=ExclusiveOrExpression ( "|" ExclusiveOrExpression )*
ExclusiveOrExpression::=AndExpression ( "^" AndExpression )*
AndExpression::=EqualityExpression ( "&" EqualityExpression )*
EqualityExpression::=InstanceOfExpression ( ( "==" | "!=" ) InstanceOfExpression )*
InstanceOfExpression::=RelationalExpression ( "instanceof" Type )?
RelationalExpression::=ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression )*
ShiftExpression::=AdditiveExpression ( ( "<<" | RSIGNEDSHIFT | RUNSIGNEDSHIFT ) AdditiveExpression )*
AdditiveExpression::=MultiplicativeExpression ( ( "+" | "-" ) MultiplicativeExpression )*
MultiplicativeExpression::=UnaryExpression ( ( "*" | "/" | "%" ) UnaryExpression )*
UnaryExpression::=( ( "+" | "-" ) UnaryExpression | PreIncrementExpression | PreDecrementExpression | UnaryExpressionNotPlusMinus )
PreIncrementExpression::="++" PrimaryExpression
PreDecrementExpression::="--" PrimaryExpression
UnaryExpressionNotPlusMinus::=( ( "~" | "!" ) UnaryExpression | CastExpression | PostfixExpression )
CastLookahead::="(" Type "[" "]"
|"(" Type ")" UnaryExpression
PostfixExpression::=PrimaryExpression ( ( "++" | "--" ) )?
CastExpression::="(" Type ")" UnaryExpression
PrimaryExpression::=PrimaryPrefix ( PrimarySuffix )*
PrimaryExpressionWithoutSuperSuffix::=PrimaryPrefix ( PrimarySuffixWithoutSuper )*
PrimaryPrefix::=( Literal | "this" | "super" "." ( TypeArguments )? <IDENTIFIER> ( Arguments )? | "(" Expression ")" | AllocationExpression | ResultType "." "class" | <IDENTIFIER> ( Arguments )? )
PrimarySuffix::=( PrimarySuffixWithoutSuper | "." "super" )
PrimarySuffixWithoutSuper::=( "." ( "this" | AllocationExpression | ( TypeArguments )? <IDENTIFIER> ( Arguments )? ) | "[" Expression "]" )
Literal::=( <INTEGER_LITERAL> | <LONG_LITERAL> | <FLOATING_POINT_LITERAL> | <CHARACTER_LITERAL> | <STRING_LITERAL> | BooleanLiteral | NullLiteral )
BooleanLiteral::=( "true" | "false" )
NullLiteral::="null"
Arguments::="(" ( ArgumentList )? ")"
ArgumentList::=Expression ( "," Expression )*
AllocationExpression::="new" ( PrimitiveType ArrayDimsAndInits | ( TypeArguments )? ClassOrInterfaceType ( ArrayDimsAndInits | Arguments ( ClassOrInterfaceBody )? ) )
ArrayDimsAndInits::=( ( "[" Expression "]" )+ ( "[" "]" )* | ( "[" "]" )+ ArrayInitializer )
Statement::=( LabeledStatement | AssertStatement | Block | EmptyStatement | StatementExpression | SwitchStatement | IfStatement | WhileStatement | DoStatement | ForStatement | BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | SynchronizedStatement | TryStatement )
AssertStatement::="assert" Expression ( ":" Expression )? ";"
LabeledStatement::=<IDENTIFIER> ":" Statement
Block::="{" Statements "}"
BlockStatement::=( Modifiers ClassOrInterfaceDeclaration | VariableDeclarationExpression ";" | Statement )
VariableDeclarationExpression::=Modifiers Type VariableDeclarator ( "," VariableDeclarator )*
EmptyStatement::=";"
StatementExpression::=( PreIncrementExpression | PreDecrementExpression | PrimaryExpression ( "++" | "--" | AssignmentOperator Expression )? ) ";"
SwitchStatement::="switch" "(" Expression ")" "{" ( SwitchEntry )* "}"
SwitchEntry::=( "case" Expression | "default" ) ":" Statements
IfStatement::="if" "(" Expression ")" Statement ( "else" Statement )?
WhileStatement::="while" "(" Expression ")" Statement
DoStatement::="do" Statement "while" "(" Expression ")" ";"
ForStatement::="for" "(" ( VariableDeclarationExpression ":" Expression | ( ForInit )? ";" ( Expression )? ";" ( ForUpdate )? ) ")" Statement
ForInit::=( VariableDeclarationExpression | ExpressionList )
ExpressionList::=Expression ( "," Expression )*
ForUpdate::=ExpressionList
BreakStatement::="break" ( <IDENTIFIER> )? ";"
ContinueStatement::="continue" ( <IDENTIFIER> )? ";"
ReturnStatement::="return" ( Expression )? ";"
ThrowStatement::="throw" Expression ";"
SynchronizedStatement::="synchronized" "(" Expression ")" Block
TryStatement::="try" Block ( ( "catch" "(" FormalParameter ")" Block )+ ( "finally" Block )? | "finally" Block )
RUNSIGNEDSHIFT::=( ">" ">" ">" )
RSIGNEDSHIFT::=( ">" ">" )
Annotation::=( NormalAnnotation | SingleMemberAnnotation | MarkerAnnotation )
NormalAnnotation::="@" Name "(" ( MemberValuePairs )? ")"
MarkerAnnotation::="@" Name
SingleMemberAnnotation::="@" Name "(" MemberValue ")"
MemberValuePairs::=MemberValuePair ( "," MemberValuePair )*
MemberValuePair::=<IDENTIFIER> "=" MemberValue
MemberValue::=( Annotation | MemberValueArrayInitializer | ConditionalExpression )
MemberValueArrayInitializer::="{" ( MemberValue ( "," MemberValue )* )? ( "," )? "}"
AnnotationTypeDeclaration::="@" "interface" <IDENTIFIER> AnnotationTypeBody
AnnotationTypeBody::="{" ( AnnotationBodyDeclaration )* "}"
AnnotationBodyDeclaration::=( ";" | Modifiers ( AnnotationTypeMemberDeclaration | ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration | FieldDeclaration ) )
AnnotationTypeMemberDeclaration::=Type <IDENTIFIER> "(" ")" ( DefaultValue )? ";"
DefaultValue::="default" MemberValue
- - diff --git a/Assignment-2/javaparser-1.0.0-src/readme.txt b/Assignment-2/javaparser-1.0.0-src/readme.txt deleted file mode 100644 index d38e54a..0000000 --- a/Assignment-2/javaparser-1.0.0-src/readme.txt +++ /dev/null @@ -1,128 +0,0 @@ -+-------------------------------------------------------------------------------+ -| Java 1.5 parser and Abstract Syntax Tree. | -+-------------------------------------------------------------------------------+ -| Copyright (C) 2007 Júlio Vilmar Gesser | -| jgesser@gmail.com | -| http://code.google.com/p/javaparser/ | -+-------------------------------------------------------------------------------+ -| This program is free software: you can redistribute it and/or modify | -| it under the terms of the GNU Lesser General Public License as published by | -| the Free Software Foundation, either version 3 of the License, or | -| (at your option) any later version. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY; without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Lesser General Public License for more details. | -| | -| You should have received a copy of the GNU Lesser General Public License | -| along with this program. If not, see . | -+-------------------------------------------------------------------------------+ - -This package contains a Java 1.5 Parser with AST generation and visitor support. -The AST records the source code structure, javadoc and comments. Soon will be -possible change the AST nodes or create new ones to modify source code like refactoring. -This parser is based on Sreenivasa Viswanadha Java 1.5 parser. - -Visit the project site, there you can get help, view some sample codes, report -bugs and feature enhacement and download the latest version: - http://code.google.com/p/javaparser/ - - -People who helped to improve this parser -(Thank you all, sorry if I miss someone) ------------------------------------------- - -Dmitry Kichinsky -John Li -Leon Poyyayil -Keffin Barnaby -Marc-Philippe Huget -Samuel Stanojevic -Sreenivasa Viswanadha -Stephan Heiss -Vadim TSES'KO - - -Version history ---------------- - -1.0.0 (2008-06-25) -- Changed version numbering, starting version 1.0.0 -- Javadoc done for packages: - - japa.parser - - japa.parser.ast -- Corrected bug when parsing in multithread: - - JavaParser.setCacheParser(false) must be called before to use the parser concurrent - -2008-06-19 -- No code changes, added binary distribution to download page - -2008-06-11 -- Bug corrected: NPE in VoidVisitorAdapter - - http://code.google.com/p/javaparser/issues/detail?id=2 - -2008-06-09 -- Added Adapters for de visitors - -2008-05-28 -- This project now is published at Google Code: - - http://code.google.com/p/javaparser/ - -2008-05-25 -- Added support for comments and javadoc to the tree. - - Javadocs are stored directly to members (BodyDeclaration and all deriveds (classes, methods, fields, etc.)), accessible by the method getJavadoc(). - - All comments are stored in the CompilationUnit, accessible by the method getComments(). - -2008-04-01 -- Changed all nodes public attributes to be private and created getters to access them -- Changed the methods of the Node getLine e getColumn to getBeginLine and getBeginColumn -- Added the methods getEndLine and getEndColumn to the Node class (works only in the BlockNode) - -2007-12-22 -- Corrected ConditionalExpression bug - -2007-10-21 -- Added LGPL License - -2007-10-21 -- Bugs corrected: - - Created PackageDeclaration member of CompilationUnit to add suport for annotations in the package declaration - - Parameterized anonymous constructor invocation - - Explicit constructor invotation Type Arguments - - ctrl+z ("\u001A") ar end of compilation unit - -2007-10-09 -- EnumConstantDeclaration annotation support corrected -- Parssing Java Unicode escape characters suport added - -2007-10-03 -- Bug corrected: "MotifComboPopup.this.super()" statement was generating parser error - -2007-10-01 -- Bug corrected: Casting signed primitive values - double d = (double) -1; - ^ - -2007-08-06 -- Bug with the ingle line comments in the final of the unit corrected - -2007-07-31 -- Fixed the bug with the following expression: - Class c = (int.class); - -2007-06-26 -- Bug fixes from Leon Poyyayil work - - suport for hex floating point - - unicode digits in indentifier - - MemberValueArrayInitializer - -2007-03-09 -- Long and Integer literal MIN_VALUE bug - -2007-02-24 -- '\0' bug fixed - -2007-02-01 -- Many bug fixes -- Added line/column to nodes \ No newline at end of file diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/JavaCharStream.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/JavaCharStream.java deleted file mode 100644 index fb32c43..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/JavaCharStream.java +++ /dev/null @@ -1,586 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ -package japa.parser; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (with java-like unicode escape processing). - */ - -public class JavaCharStream -{ - public static final boolean staticFlag = false; - static final int hexval(char c) throws java.io.IOException { - switch(c) - { - case '0' : - return 0; - case '1' : - return 1; - case '2' : - return 2; - case '3' : - return 3; - case '4' : - return 4; - case '5' : - return 5; - case '6' : - return 6; - case '7' : - return 7; - case '8' : - return 8; - case '9' : - return 9; - - case 'a' : - case 'A' : - return 10; - case 'b' : - case 'B' : - return 11; - case 'c' : - case 'C' : - return 12; - case 'd' : - case 'D' : - return 13; - case 'e' : - case 'E' : - return 14; - case 'f' : - case 'F' : - return 15; - } - - throw new java.io.IOException(); // Should never come here - } - - public int bufpos = -1; - int bufsize; - int available; - int tokenBegin; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] nextCharBuf; - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int nextCharInd = -1; - protected int inBuf = 0; - protected int tabSize = 8; - - protected void setTabSize(int i) { tabSize = i; } - protected int getTabSize(int i) { return tabSize; } - - protected void ExpandBuff(boolean wrapAround) - { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - bufpos += (bufsize - tokenBegin); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - bufpos -= tokenBegin; - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - available = (bufsize += 2048); - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException - { - int i; - if (maxNextCharInd == 4096) - maxNextCharInd = nextCharInd = 0; - - try { - if ((i = inputStream.read(nextCharBuf, maxNextCharInd, - 4096 - maxNextCharInd)) == -1) - { - inputStream.close(); - throw new java.io.IOException(); - } - else - maxNextCharInd += i; - return; - } - catch(java.io.IOException e) { - if (bufpos != 0) - { - --bufpos; - backup(0); - } - else - { - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - throw e; - } - } - - protected char ReadByte() throws java.io.IOException - { - if (++nextCharInd >= maxNextCharInd) - FillBuff(); - - return nextCharBuf[nextCharInd]; - } - - public char BeginToken() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - tokenBegin = bufpos; - return buffer[bufpos]; - } - - tokenBegin = 0; - bufpos = -1; - - return readChar(); - } - - protected void AdjustBuffSize() - { - if (available == bufsize) - { - if (tokenBegin > 2048) - { - bufpos = 0; - available = tokenBegin; - } - else - ExpandBuff(false); - } - else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - protected void UpdateLineColumn(char c) - { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (tabSize - (column % tabSize)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - char c; - - if (++bufpos == available) - AdjustBuffSize(); - - if ((buffer[bufpos] = c = ReadByte()) == '\\') - { - UpdateLineColumn(c); - - int backSlashCnt = 1; - - for (;;) // Read all the backslashes - { - if (++bufpos == available) - AdjustBuffSize(); - - try - { - if ((buffer[bufpos] = c = ReadByte()) != '\\') - { - UpdateLineColumn(c); - // found a non-backslash char. - if ((c == 'u') && ((backSlashCnt & 1) == 1)) - { - if (--bufpos < 0) - bufpos = bufsize - 1; - - break; - } - - backup(backSlashCnt); - return '\\'; - } - } - catch(java.io.IOException e) - { - if (backSlashCnt > 1) - backup(backSlashCnt); - - return '\\'; - } - - UpdateLineColumn(c); - backSlashCnt++; - } - - // Here, we have seen an odd number of backslash's followed by a 'u' - try - { - while ((c = ReadByte()) == 'u') - ++column; - - buffer[bufpos] = c = (char)(hexval(c) << 12 | - hexval(ReadByte()) << 8 | - hexval(ReadByte()) << 4 | - hexval(ReadByte())); - - column += 4; - } - catch(java.io.IOException e) - { - throw new Error("Invalid escape character at line " + line + - " column " + column + "."); - } - - if (backSlashCnt == 1) - return c; - else - { - backup(backSlashCnt - 1); - return '\\'; - } - } - else - { - UpdateLineColumn(c); - return (c); - } - } - - /** - * @deprecated - * @see #getEndColumn - */ - - @Deprecated -public int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @deprecated - * @see #getEndLine - */ - - @Deprecated -public int getLine() { - return bufline[bufpos]; - } - - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - public int getEndLine() { - return bufline[bufpos]; - } - - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public int getBeginLine() { - return bufline[tokenBegin]; - } - - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.Reader dstream) - { - this(dstream, 1, 1, 4096); - } - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - nextCharInd = bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.Reader dstream) - { - ReInit(dstream, 1, 1, 4096); - } - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, 1, 1, 4096); - } - - public JavaCharStream(java.io.InputStream dstream) - { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream) - { - ReInit(dstream, 1, 1, 4096); - } - - public String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() - { - nextCharBuf = null; - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0, columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/JavaParserConstants.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/JavaParserConstants.java deleted file mode 100644 index 9277cf9..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/JavaParserConstants.java +++ /dev/null @@ -1,281 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. JavaParserConstants.java */ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -package japa.parser; - -public interface JavaParserConstants { - - int EOF = 0; - int SINGLE_LINE_COMMENT = 6; - int JAVA_DOC_COMMENT = 9; - int MULTI_LINE_COMMENT = 10; - int ABSTRACT = 12; - int ASSERT = 13; - int BOOLEAN = 14; - int BREAK = 15; - int BYTE = 16; - int CASE = 17; - int CATCH = 18; - int CHAR = 19; - int CLASS = 20; - int CONST = 21; - int CONTINUE = 22; - int _DEFAULT = 23; - int DO = 24; - int DOUBLE = 25; - int ELSE = 26; - int ENUM = 27; - int EXTENDS = 28; - int FALSE = 29; - int FINAL = 30; - int FINALLY = 31; - int FLOAT = 32; - int FOR = 33; - int GOTO = 34; - int IF = 35; - int IMPLEMENTS = 36; - int IMPORT = 37; - int INSTANCEOF = 38; - int INT = 39; - int INTERFACE = 40; - int LONG = 41; - int NATIVE = 42; - int NEW = 43; - int NULL = 44; - int PACKAGE = 45; - int PRIVATE = 46; - int PROTECTED = 47; - int PUBLIC = 48; - int RETURN = 49; - int SHORT = 50; - int STATIC = 51; - int STRICTFP = 52; - int SUPER = 53; - int SWITCH = 54; - int SYNCHRONIZED = 55; - int THIS = 56; - int THROW = 57; - int THROWS = 58; - int TRANSIENT = 59; - int TRUE = 60; - int TRY = 61; - int VOID = 62; - int VOLATILE = 63; - int WHILE = 64; - int LONG_LITERAL = 65; - int INTEGER_LITERAL = 66; - int DECIMAL_LITERAL = 67; - int HEX_LITERAL = 68; - int OCTAL_LITERAL = 69; - int FLOATING_POINT_LITERAL = 70; - int DECIMAL_FLOATING_POINT_LITERAL = 71; - int DECIMAL_EXPONENT = 72; - int HEXADECIMAL_FLOATING_POINT_LITERAL = 73; - int HEXADECIMAL_EXPONENT = 74; - int CHARACTER_LITERAL = 75; - int STRING_LITERAL = 76; - int IDENTIFIER = 77; - int LETTER = 78; - int PART_LETTER = 79; - int LPAREN = 80; - int RPAREN = 81; - int LBRACE = 82; - int RBRACE = 83; - int LBRACKET = 84; - int RBRACKET = 85; - int SEMICOLON = 86; - int COMMA = 87; - int DOT = 88; - int AT = 89; - int ASSIGN = 90; - int LT = 91; - int BANG = 92; - int TILDE = 93; - int HOOK = 94; - int COLON = 95; - int EQ = 96; - int LE = 97; - int GE = 98; - int NE = 99; - int SC_OR = 100; - int SC_AND = 101; - int INCR = 102; - int DECR = 103; - int PLUS = 104; - int MINUS = 105; - int STAR = 106; - int SLASH = 107; - int BIT_AND = 108; - int BIT_OR = 109; - int XOR = 110; - int REM = 111; - int LSHIFT = 112; - int PLUSASSIGN = 113; - int MINUSASSIGN = 114; - int STARASSIGN = 115; - int SLASHASSIGN = 116; - int ANDASSIGN = 117; - int ORASSIGN = 118; - int XORASSIGN = 119; - int REMASSIGN = 120; - int LSHIFTASSIGN = 121; - int RSIGNEDSHIFTASSIGN = 122; - int RUNSIGNEDSHIFTASSIGN = 123; - int ELLIPSIS = 124; - int RUNSIGNEDSHIFT = 125; - int RSIGNEDSHIFT = 126; - int GT = 127; - - int DEFAULT = 0; - int IN_JAVA_DOC_COMMENT = 1; - int IN_MULTI_LINE_COMMENT = 2; - - String[] tokenImage = { - "", - "\" \"", - "\"\\t\"", - "\"\\n\"", - "\"\\r\"", - "\"\\f\"", - "", - "", - "\"/*\"", - "\"*/\"", - "\"*/\"", - "", - "\"abstract\"", - "\"assert\"", - "\"boolean\"", - "\"break\"", - "\"byte\"", - "\"case\"", - "\"catch\"", - "\"char\"", - "\"class\"", - "\"const\"", - "\"continue\"", - "\"default\"", - "\"do\"", - "\"double\"", - "\"else\"", - "\"enum\"", - "\"extends\"", - "\"false\"", - "\"final\"", - "\"finally\"", - "\"float\"", - "\"for\"", - "\"goto\"", - "\"if\"", - "\"implements\"", - "\"import\"", - "\"instanceof\"", - "\"int\"", - "\"interface\"", - "\"long\"", - "\"native\"", - "\"new\"", - "\"null\"", - "\"package\"", - "\"private\"", - "\"protected\"", - "\"public\"", - "\"return\"", - "\"short\"", - "\"static\"", - "\"strictfp\"", - "\"super\"", - "\"switch\"", - "\"synchronized\"", - "\"this\"", - "\"throw\"", - "\"throws\"", - "\"transient\"", - "\"true\"", - "\"try\"", - "\"void\"", - "\"volatile\"", - "\"while\"", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\"(\"", - "\")\"", - "\"{\"", - "\"}\"", - "\"[\"", - "\"]\"", - "\";\"", - "\",\"", - "\".\"", - "\"@\"", - "\"=\"", - "\"<\"", - "\"!\"", - "\"~\"", - "\"?\"", - "\":\"", - "\"==\"", - "\"<=\"", - "\">=\"", - "\"!=\"", - "\"||\"", - "\"&&\"", - "\"++\"", - "\"--\"", - "\"+\"", - "\"-\"", - "\"*\"", - "\"/\"", - "\"&\"", - "\"|\"", - "\"^\"", - "\"%\"", - "\"<<\"", - "\"+=\"", - "\"-=\"", - "\"*=\"", - "\"/=\"", - "\"&=\"", - "\"|=\"", - "\"^=\"", - "\"%=\"", - "\"<<=\"", - "\">>=\"", - "\">>>=\"", - "\"...\"", - "\">>>\"", - "\">>\"", - "\">\"", - "\"\\u001a\"", - }; - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ParseException.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ParseException.java deleted file mode 100644 index 3858509..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ParseException.java +++ /dev/null @@ -1,201 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package japa.parser; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends Exception { - - /** - * This constructor is used by the method "generateParseException" - * in the generated parser. Calling this constructor generates - * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: - */ - public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { - super(""); - specialConstructor = true; - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - specialConstructor = false; - } - - public ParseException(Token currentTokenVal, String message) { - super(message); - currentToken = currentTokenVal; - specialConstructor = false; - } - - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this object has been created - * due to a parse error, and you do not catch it (it gets thrown - * from the parser), then this method is called during the printing - * of the final stack trace, and hence the correct error message - * gets displayed. - */ - @Override - public String getMessage() { - if (!specialConstructor) { - if (currentToken == null) { - return super.getMessage(); - } - StringBuilder ret = new StringBuilder(); - ret.append(super.getMessage()); - ret.append(": \""); - ret.append(currentToken.image); - ret.append("\" at line "); - ret.append(currentToken.beginLine); - ret.append(", column "); - ret.append(currentToken.beginColumn); - return ret.toString(); - } - StringBuffer expected = new StringBuffer(); - int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" "); - } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected.append("..."); - } - expected.append(eol).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) - retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += add_escapes(tok.image); - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - retval += expected.toString(); - return retval; - } - - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - */ - protected String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/Token.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/Token.java deleted file mode 100644 index 06a3cdd..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/Token.java +++ /dev/null @@ -1,88 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -package japa.parser; - -/** - * Describes the input token stream. - */ - -public class Token { - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * Returns the image. - */ - @Override - public String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : - * - * case MyParserConstants.ID : return new IDToken(); - * - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. - */ - public static final Token newToken(int ofKind) { - switch (ofKind) { - default: - return new Token(); - case JavaParserConstants.RUNSIGNEDSHIFT: - case JavaParserConstants.RSIGNEDSHIFT: - case JavaParserConstants.GT: - return new GTToken(); - } - } - - public static class GTToken extends Token { - - int realKind = JavaParserConstants.GT; - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/TokenMgrError.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/TokenMgrError.java deleted file mode 100644 index e8bf843..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/TokenMgrError.java +++ /dev/null @@ -1,135 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package japa.parser; - -public class TokenMgrError extends Error -{ - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** - * Lexical error occured. - */ - static final int LEXICAL_ERROR = 0 ; - - /** - * An attempt wass made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; - - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; - - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - */ - protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - - /** - * Returns a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - * Parameters : - * EOFSeen : indicates if EOF caused the lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured - * curchar : the offending character - * Note: You can customize the lexical error message by modifying this method. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * - * "Internal Error : Please file a bug report .... " - * - * from this method for such cases in the release version of your parser. - */ - @Override -public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/BlockComment.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/BlockComment.java deleted file mode 100644 index 9dfcd9b..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/BlockComment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 23/05/2008 - */ -package japa.parser.ast; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - *

AST node that represent block comments.

- * - * Block comments can has multi lines and are delimited - * by "/*" and "*/". - * - * @author Julio Vilmar Gesser - */ -public class BlockComment extends Comment { - - public BlockComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { - super(beginLine, beginColumn, endLine, endColumn, content); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/Comment.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/Comment.java deleted file mode 100644 index 02c0671..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/Comment.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 23/05/2008 - */ -package japa.parser.ast; - -import japa.parser.ast.body.JavadocComment; - -/** - * Abstract class for all AST nodes that represent comments. - * - * @see BlockComment - * @see LineComment - * @see JavadocComment - * @author Julio Vilmar Gesser - */ -public abstract class Comment extends Node { - - private final String content; - - public Comment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { - super(beginLine, beginColumn, endLine, endColumn); - this.content = content; - } - - /** - * Return the text of the comment. - * @return text of the comment - */ - public String getContent() { - return content; - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/CompilationUnit.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/CompilationUnit.java deleted file mode 100644 index 829a945..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/CompilationUnit.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast; - -import japa.parser.ast.body.AnnotationDeclaration; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.EmptyTypeDeclaration; -import japa.parser.ast.body.EnumDeclaration; -import japa.parser.ast.body.JavadocComment; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - *

This class represents the entire compilation unit. Each java - * file denotes a compilation unit.

- * - * The CompilationUnit is constructed following the syntax:
- * - * - * - * - * - * - * - *
CompilationUnit::= - * ( {@link PackageDeclaration} )?
- * ( {@link ImportDeclaration} )*
- * ( {@link TypeDeclaration} )*
- *
- *
- * - * @author Julio Vilmar Gesser - */ -public final class CompilationUnit extends Node { - - private final PackageDeclaration pakage; - - private final List imports; - - private final List types; - - private final List comments; - - public CompilationUnit(int line, int column, PackageDeclaration pakage, List imports, List types, List comments) { - super(line, column); - this.pakage = pakage; - this.imports = imports; - this.types = types; - this.comments = comments; - } - - /** - * Retrieves the package declaration of this compilation unit.
- * If this compilation unit has no package declaration (default package), - * null is returned. - * @return the package declaration or null - */ - public PackageDeclaration getPakage() { - return pakage; - } - - /** - * Retrieves the list of imports declared in this compilation unit or - * null if there is no import. - * @return the list of imports or null if there is no import - */ - public List getImports() { - return imports; - } - - /** - * Return the list of types declared in this compilation unit.
- * If there is no types declared, null is returned. - * @return the list of types or null null if there is no type - * @see AnnotationDeclaration - * @see ClassOrInterfaceDeclaration - * @see EmptyTypeDeclaration - * @see EnumDeclaration - */ - public List getTypes() { - return types; - } - - /** - * Return a list containing all comments declared in this compilation unit. - * Including javadocs, line comments and block comments of all types, - * inner-classes and other members.
- * If there is no comment, null is returned. - * @return list with all comments of this compilation unit of null - * @see JavadocComment - * @see LineComment - * @see BlockComment - */ - public List getComments() { - return comments; - } - - @Override - public
void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/ImportDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/ImportDeclaration.java deleted file mode 100644 index 735eaef..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/ImportDeclaration.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast; - -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - *

This class represents a import declaration. Imports are - * optional for the {@link CompilationUnit}.

- * - * The ImportDeclaration is constructed following the syntax:
- * - * - * - * - * - * - * - *
ImportDeclaration::= - * "import" ( "static" )? {@link NameExpr} ( "." "*" )? ";" - *
- *
- * - * @author Julio Vilmar Gesser - */ -public final class ImportDeclaration extends Node { - - private final NameExpr name; - - private final boolean isStatic; - - private final boolean isAsterisk; - - public ImportDeclaration(int line, int column, NameExpr name, boolean isStatic, boolean isAsterisk) { - super(line, column); - this.name = name; - this.isStatic = isStatic; - this.isAsterisk = isAsterisk; - } - - /** - * Retrieves the name of the import. - * @return the name of the import - */ - public NameExpr getName() { - return name; - } - - /** - * Return if the import is static. - * @return true if the import is static, false otherwise - */ - public boolean isStatic() { - return isStatic; - } - - /** - * Return if the import ends with "*". - * @return true if the import ends with "*", false otherwise - */ - public boolean isAsterisk() { - return isAsterisk; - } - - @Override - public
void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/LineComment.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/LineComment.java deleted file mode 100644 index 12c40ed..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/LineComment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 23/05/2008 - */ -package japa.parser.ast; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - *

AST node that represent line comments.

- * - * Line comments are started with "//" and finish at - * the end of the line ("\n"). - * - * @author Julio Vilmar Gesser - */ -public class LineComment extends Comment { - - public LineComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { - super(beginLine, beginColumn, endLine, endColumn, content); - } - - @Override - public
void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/Node.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/Node.java deleted file mode 100644 index c01c1c9..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/Node.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast; - -import japa.parser.ast.visitor.DumpVisitor; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * Abstract class for all nodes of the AST. - * - * @author Julio Vilmar Gesser - */ -public abstract class Node { - - private final int beginLine; - - private final int beginColumn; - - private final int endLine; - - private final int endColumn; - - /** - * This attribute can store additional information from semantic analysis. - */ - private Object data; - - @Deprecated - public Node(int line, int column) { - this.beginLine = line; - this.beginColumn = column; - this.endLine = line; - this.endColumn = column; - } - - public Node(int beginLine, int beginColumn, int endLine, int endColumn) { - this.beginLine = beginLine; - this.beginColumn = beginColumn; - this.endLine = endLine; - this.endColumn = endColumn; - } - - /** - * Use this to retrieve additional information associated to this node. - */ - public Object getData() { - return data; - } - - /** - * Use this to store additional information to this node. - */ - public void setData(Object data) { - this.data = data; - } - - /** - * Return the begin line of this node. - * @return the begin line of this node - */ - public final int getBeginLine() { - return beginLine; - } - - /** - * Return the begin column of this node. - * @return the begin column of this node - */ - public final int getBeginColumn() { - return beginColumn; - } - - /** - * Return the end line of this node. - * @return the end line of this node - */ - public final int getEndLine() { - return endLine; - } - - /** - * Return the end column of this node. - * @return the end column of this node - */ - public final int getEndColumn() { - return endColumn; - } - - /** - * Accept method for visitor support. - * @param the type the argument passed for the visitor - * @param v the visitor implementation - * @param arg any value relevant for the visitor - */ - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - /** - * Accept method for visitor support. - * @param the type the return value of the visitor - * @param the type the argument passed for the visitor - * @param v the visitor implementation - * @param arg any value relevant for the visitor - * @return the result of the visit - */ - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - - /** - * Return the String representation of this node. - * @return the String representation of this node - */ - @Override - public final String toString() { - DumpVisitor visitor = new DumpVisitor(); - accept(visitor, null); - return visitor.getSource(); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/PackageDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/PackageDeclaration.java deleted file mode 100644 index dcf3859..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/PackageDeclaration.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 17/10/2007 - */ -package japa.parser.ast; - -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - *

This class represents the package declaration. The package - * declaration is optional for the {@link CompilationUnit}.

- * - * The PackageDeclaration is constructed following the syntax:
- * - * - * - * - * - * - * - *
PackageDeclaration::= - * ( {@link AnnotationExpr} )* "package" {@link NameExpr} ) ";" - *
- *
- * - * @author Julio Vilmar Gesser - */ -public final class PackageDeclaration extends Node { - - private final List annotations; - - private final NameExpr name; - - public PackageDeclaration(int line, int column, List annotations, NameExpr name) { - super(line, column); - this.annotations = annotations; - this.name = name; - } - - /** - * Retrieves the list of annotations declared before the package - * declaration. Return null if there are no annotations. - * @return list of annotations or null - */ - public List getAnnotations() { - return annotations; - } - - /** - * Return the name of the package. - * @return the name of the package - */ - public NameExpr getName() { - return name; - } - - @Override - public
void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/TypeParameter.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/TypeParameter.java deleted file mode 100644 index eae2322..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/TypeParameter.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - *

This class represents the declaration of a genetics argument.

- * - * The TypeParameter is constructed following the syntax:
- * - * - * - * - * - * - * - *
TypeParameter::= - * <IDENTIFIER> ( "extends" {@link ClassOrInterfaceType} ( "&" {@link ClassOrInterfaceType} )* )? - *
- *
- * - * @author Julio Vilmar Gesser - */ -public final class TypeParameter extends Node { - - private final String name; - - private final List typeBound; - - public TypeParameter(int line, int column, String name, List typeBound) { - super(line, column); - this.name = name; - this.typeBound = typeBound; - } - - /** - * Return the name of the paramenter. - * @return the name of the paramenter - */ - public String getName() { - return name; - } - - /** - * Return the list of {@link ClassOrInterfaceType} that this parameter - * extends. Return null null if there are no type. - * @return list of types that this paramente extends or null - */ - public List getTypeBound() { - return typeBound; - } - - @Override - public
void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/AnnotationDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/AnnotationDeclaration.java deleted file mode 100644 index 35f20d8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/AnnotationDeclaration.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class AnnotationDeclaration extends TypeDeclaration { - - private final List annotations; - - public AnnotationDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, String name, List members) { - super(line, column, javaDoc, name, modifiers, members); - this.annotations = annotations; - } - - public List getAnnotations() { - return annotations; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/AnnotationMemberDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/AnnotationMemberDeclaration.java deleted file mode 100644 index cca4036..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/AnnotationMemberDeclaration.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.Expression; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class AnnotationMemberDeclaration extends BodyDeclaration { - - private final int modifiers; - - private final List annotations; - - private final Type type; - - private final String name; - - private final Expression defaultValue; - - public AnnotationMemberDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, Type type, String name, Expression defaultValue) { - super(line, column, javaDoc); - this.modifiers = modifiers; - this.annotations = annotations; - this.type = type; - this.name = name; - this.defaultValue = defaultValue; - } - - public int getModifiers() { - return modifiers; - } - - public List getAnnotations() { - return annotations; - } - - public Type getType() { - return type; - } - - public String getName() { - return name; - } - - public Expression getDefaultValue() { - return defaultValue; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/BodyDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/BodyDeclaration.java deleted file mode 100644 index 20c658c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/BodyDeclaration.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.Node; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class BodyDeclaration extends Node { - - private final JavadocComment javaDoc; - - public BodyDeclaration(int line, int column, JavadocComment javaDoc) { - super(line, column); - this.javaDoc = javaDoc; - } - - public JavadocComment getJavaDoc() { - return javaDoc; - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ClassOrInterfaceDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ClassOrInterfaceDeclaration.java deleted file mode 100644 index 131bf7b..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ClassOrInterfaceDeclaration.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.TypeParameter; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ClassOrInterfaceDeclaration extends TypeDeclaration { - - private final List annotations; - - private final boolean isInterface; - - private final List typeParameters; - - private final List extendsList; - - private final List implementsList; - - public ClassOrInterfaceDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, boolean isInterface, String name, List typeParameters, List extendsList, List implementsList, List members) { - super(line, column, javaDoc, name, modifiers, members); - this.annotations = annotations; - this.isInterface = isInterface; - this.typeParameters = typeParameters; - this.extendsList = extendsList; - this.implementsList = implementsList; - } - - public List getAnnotations() { - return annotations; - } - - public boolean isInterface() { - return isInterface; - } - - public List getTypeParameters() { - return typeParameters; - } - - public List getExtends() { - return extendsList; - } - - public List getImplements() { - return implementsList; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ConstructorDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ConstructorDeclaration.java deleted file mode 100644 index f4db6cb..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ConstructorDeclaration.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.TypeParameter; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ConstructorDeclaration extends BodyDeclaration { - - private final int modifiers; - - private final List annotations; - - private final List typeParameters; - - private final String name; - - private final List parameters; - - private final List throws_; - - private final BlockStmt block; - - public ConstructorDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, List typeParameters, String name, List parameters, List throws_, BlockStmt block) { - super(line, column, javaDoc); - this.modifiers = modifiers; - this.annotations = annotations; - this.typeParameters = typeParameters; - this.name = name; - this.parameters = parameters; - this.throws_ = throws_; - this.block = block; - } - - public int getModifiers() { - return modifiers; - } - - public List getAnnotations() { - return annotations; - } - - public List getTypeParameters() { - return typeParameters; - } - - public String getName() { - return name; - } - - public List getParameters() { - return parameters; - } - - public List getThrows() { - return throws_; - } - - public BlockStmt getBlock() { - return block; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EmptyMemberDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EmptyMemberDeclaration.java deleted file mode 100644 index 5c69086..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EmptyMemberDeclaration.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class EmptyMemberDeclaration extends BodyDeclaration { - - public EmptyMemberDeclaration(int line, int column, JavadocComment javaDoc) { - super(line, column, javaDoc); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EmptyTypeDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EmptyTypeDeclaration.java deleted file mode 100644 index 8574135..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EmptyTypeDeclaration.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 20/01/2007 - */ -package japa.parser.ast.body; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class EmptyTypeDeclaration extends TypeDeclaration { - - public EmptyTypeDeclaration(int line, int column, JavadocComment javaDoc) { - super(line, column, javaDoc, null, 0, null); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EnumConstantDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EnumConstantDeclaration.java deleted file mode 100644 index add69c9..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EnumConstantDeclaration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/11/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class EnumConstantDeclaration extends BodyDeclaration { - - private final List annotations; - - private final String name; - - private final List args; - - private final List classBody; - - public EnumConstantDeclaration(int line, int column, JavadocComment javaDoc, List annotations, String name, List args, List classBody) { - super(line, column, javaDoc); - this.annotations = annotations; - this.name = name; - this.args = args; - this.classBody = classBody; - } - - public List getAnnotations() { - return annotations; - } - - public String getName() { - return name; - } - - public List getArgs() { - return args; - } - - public List getClassBody() { - return classBody; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EnumDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EnumDeclaration.java deleted file mode 100644 index 293bf1a..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/EnumDeclaration.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class EnumDeclaration extends TypeDeclaration { - - private final List annotations; - - private final List implementsList; - - private final List entries; - - public EnumDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, String name, List implementsList, List entries, List members) { - super(line, column, javaDoc, name, modifiers, members); - this.annotations = annotations; - this.implementsList = implementsList; - this.entries = entries; - } - - public List getAnnotations() { - return annotations; - } - - public List getImplements() { - return implementsList; - } - - public List getEntries() { - return entries; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/FieldDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/FieldDeclaration.java deleted file mode 100644 index 6847a31..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/FieldDeclaration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class FieldDeclaration extends BodyDeclaration { - - private final int modifiers; - - private final List annotations; - - private final Type type; - - private final List variables; - - public FieldDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, Type type, List variables) { - super(line, column, javaDoc); - this.modifiers = modifiers; - this.annotations = annotations; - this.type = type; - this.variables = variables; - } - - public int getModifiers() { - return modifiers; - } - - public List getAnnotations() { - return annotations; - } - - public Type getType() { - return type; - } - - public List getVariables() { - return variables; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/InitializerDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/InitializerDeclaration.java deleted file mode 100644 index d5d6e25..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/InitializerDeclaration.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class InitializerDeclaration extends BodyDeclaration { - - private final boolean isStatic; - - private final BlockStmt block; - - public InitializerDeclaration(int line, int column, JavadocComment javaDoc, boolean isStatic, BlockStmt block) { - super(line, column, javaDoc); - this.isStatic = isStatic; - this.block = block; - } - - public boolean isStatic() { - return isStatic; - } - - public BlockStmt getBlock() { - return block; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/JavadocComment.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/JavadocComment.java deleted file mode 100644 index f8ee6b4..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/JavadocComment.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 23/05/2008 - */ -package japa.parser.ast.body; - -import japa.parser.ast.Comment; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public class JavadocComment extends Comment { - - public JavadocComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { - super(beginLine, beginColumn, endLine, endColumn, content); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/MethodDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/MethodDeclaration.java deleted file mode 100644 index 8d1bc09..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/MethodDeclaration.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.TypeParameter; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class MethodDeclaration extends BodyDeclaration { - - private final int modifiers; - - private final List annotations; - - private final List typeParameters; - - private final Type type; - - private final String name; - - private final List parameters; - - private final int arrayCount; - - private final List throws_; - - private final BlockStmt body; - - public MethodDeclaration(int line, int column, JavadocComment javaDoc, int modifiers, List annotations, List typeParameters, Type type, String name, List parameters, int arrayCount, List throws_, BlockStmt block) { - super(line, column, javaDoc); - this.modifiers = modifiers; - this.annotations = annotations; - this.typeParameters = typeParameters; - this.type = type; - this.name = name; - this.parameters = parameters; - this.arrayCount = arrayCount; - this.throws_ = throws_; - this.body = block; - } - - public int getModifiers() { - return modifiers; - } - - public List getAnnotations() { - return annotations; - } - - public List getTypeParameters() { - return typeParameters; - } - - public Type getType() { - return type; - } - - public String getName() { - return name; - } - - public List getParameters() { - return parameters; - } - - public int getArrayCount() { - return arrayCount; - } - - public List getThrows() { - return throws_; - } - - public BlockStmt getBody() { - return body; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ModifierSet.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ModifierSet.java deleted file mode 100644 index 5da8f55..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/ModifierSet.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -package japa.parser.ast.body; - -import japa.parser.ParseException; -import japa.parser.Token; - -/** - * Class to hold modifiers. - */ -public final class ModifierSet { - - private ModifierSet() { - } - - /* Definitions of the bits in the modifiers field. */ - public static final int PUBLIC = 0x0001; - - public static final int PROTECTED = 0x0002; - - public static final int PRIVATE = 0x0004; - - public static final int ABSTRACT = 0x0008; - - public static final int STATIC = 0x0010; - - public static final int FINAL = 0x0020; - - public static final int SYNCHRONIZED = 0x0040; - - public static final int NATIVE = 0x0080; - - public static final int TRANSIENT = 0x0100; - - public static final int VOLATILE = 0x0200; - - public static final int STRICTFP = 0x1000; - - /** A set of accessors that indicate whether the specified modifier - is in the set. */ - - public static boolean isPublic(int modifiers) { - return (modifiers & PUBLIC) != 0; - } - - public static boolean isProtected(int modifiers) { - return (modifiers & PROTECTED) != 0; - } - - public static boolean isPrivate(int modifiers) { - return (modifiers & PRIVATE) != 0; - } - - public static boolean isStatic(int modifiers) { - return (modifiers & STATIC) != 0; - } - - public static boolean isAbstract(int modifiers) { - return (modifiers & ABSTRACT) != 0; - } - - public static boolean isFinal(int modifiers) { - return (modifiers & FINAL) != 0; - } - - public static boolean isNative(int modifiers) { - return (modifiers & NATIVE) != 0; - } - - public static boolean isStrictfp(int modifiers) { - return (modifiers & STRICTFP) != 0; - } - - public static boolean isSynchronized(int modifiers) { - return (modifiers & SYNCHRONIZED) != 0; - } - - public static boolean isTransient(int modifiers) { - return (modifiers & TRANSIENT) != 0; - } - - public static boolean isVolatile(int modifiers) { - return (modifiers & VOLATILE) != 0; - } - - /** - * Adds the given modifier. - */ - public static int addModifier(int modifiers, int mod) { - return modifiers |= mod; - } - - /** - * Removes the given modifier. - */ - public static int removeModifier(int modifiers, int mod) { - return modifiers &= ~mod; - } - - /** - * Adds the given modifier. - */ - public static int addModifier(int modifiers, int mod, Token token) throws ParseException { - if ((modifiers & mod) != 0) { - throw new ParseException(token, "Duplicated modifier"); - } - return modifiers |= mod; - } -} \ No newline at end of file diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/Parameter.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/Parameter.java deleted file mode 100644 index 820eeca..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/Parameter.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 03/11/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.Node; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class Parameter extends Node { - - private final int modifiers; - - private final List annotations; - - private final Type type; - - private final boolean isVarArgs; - - private final VariableDeclaratorId id; - - public Parameter(int line, int column, int modifiers, List annotations, Type type, boolean isVarArgs, VariableDeclaratorId id) { - super(line, column); - this.modifiers = modifiers; - this.annotations = annotations; - this.type = type; - this.isVarArgs = isVarArgs; - this.id = id; - } - - public int getModifiers() { - return modifiers; - } - - public List getAnnotations() { - return annotations; - } - - public Type getType() { - return type; - } - - public boolean isVarArgs() { - return isVarArgs; - } - - public VariableDeclaratorId getId() { - return id; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/TypeDeclaration.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/TypeDeclaration.java deleted file mode 100644 index fa294f2..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/TypeDeclaration.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class TypeDeclaration extends BodyDeclaration { - - private final String name; - - private final int modifiers; - - private final List members; - - public TypeDeclaration(int line, int column, JavadocComment javaDoc, String name, int modifiers, List members) { - super(line, column, javaDoc); - this.name = name; - this.modifiers = modifiers; - this.members = members; - } - - public String getName() { - return name; - } - - public int getModifiers() { - return modifiers; - } - - public List getMembers() { - return members; - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/VariableDeclarator.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/VariableDeclarator.java deleted file mode 100644 index c4b390f..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/VariableDeclarator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.Node; -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class VariableDeclarator extends Node { - - private final VariableDeclaratorId id; - - private final Expression init; - - public VariableDeclarator(int line, int column, VariableDeclaratorId id, Expression init) { - super(line, column); - this.id = id; - this.init = init; - } - - public VariableDeclaratorId getId() { - return id; - } - - public Expression getInit() { - return init; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/VariableDeclaratorId.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/VariableDeclaratorId.java deleted file mode 100644 index b6d732c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/body/VariableDeclaratorId.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.body; - -import japa.parser.ast.Node; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class VariableDeclaratorId extends Node { - - private final String name; - - private final int arrayCount; - - public VariableDeclaratorId(int line, int column, String name, int arrayCount) { - super(line, column); - this.name = name; - this.arrayCount = arrayCount; - } - - public String getName() { - return name; - } - - public int getArrayCount() { - return arrayCount; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/AnnotationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/AnnotationExpr.java deleted file mode 100644 index c68fea1..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/AnnotationExpr.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.expr; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class AnnotationExpr extends Expression { - - public AnnotationExpr(int line, int column) { - super(line, column); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayAccessExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayAccessExpr.java deleted file mode 100644 index 3dd3031..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayAccessExpr.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ArrayAccessExpr extends Expression { - - private final Expression name; - - private final Expression index; - - public ArrayAccessExpr(int line, int column, Expression name, Expression index) { - super(line, column); - this.name = name; - this.index = index; - } - - public Expression getName() { - return name; - } - - public Expression getIndex() { - return index; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayCreationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayCreationExpr.java deleted file mode 100644 index b5c8e2b..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayCreationExpr.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ArrayCreationExpr extends Expression { - - private final Type type; - - private final List typeArgs; - - private final int arrayCount; - - private final ArrayInitializerExpr initializer; - - private final List dimensions; - - public ArrayCreationExpr(int line, int column, Type type, List typeArgs, int arrayCount, ArrayInitializerExpr initializer) { - super(line, column); - this.type = type; - this.typeArgs = typeArgs; - this.arrayCount = arrayCount; - this.initializer = initializer; - this.dimensions = null; - } - - public Type getType() { - return type; - } - - public List getTypeArgs() { - return typeArgs; - } - - public int getArrayCount() { - return arrayCount; - } - - public ArrayInitializerExpr getInitializer() { - return initializer; - } - - public List getDimensions() { - return dimensions; - } - - public ArrayCreationExpr(int line, int column, Type type, List typeArgs, List dimensions, int arrayCount) { - super(line, column); - this.type = type; - this.typeArgs = typeArgs; - this.arrayCount = arrayCount; - this.dimensions = dimensions; - this.initializer = null; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayInitializerExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayInitializerExpr.java deleted file mode 100644 index ba2aa7f..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ArrayInitializerExpr.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ArrayInitializerExpr extends Expression { - - private final List values; - - public ArrayInitializerExpr(int line, int column, List values) { - super(line, column); - this.values = values; - } - - public List getValues() { - return values; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/AssignExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/AssignExpr.java deleted file mode 100644 index 4bb80e8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/AssignExpr.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class AssignExpr extends Expression { - - public static enum Operator { - assign, // = - plus, // += - minus, // -= - star, // *= - slash, // /= - and, // &= - or, // |= - xor, // ^= - rem, // %= - lShift, // <<= - rSignedShift, // >>= - rUnsignedShift, // >>>= - } - - private final Expression target; - - private final Expression value; - - private final Operator op; - - public AssignExpr(int line, int column, Expression target, Expression value, Operator op) { - super(line, column); - this.target = target; - this.value = value; - this.op = op; - } - - public Expression getTarget() { - return target; - } - - public Expression getValue() { - return value; - } - - public Operator getOperator() { - return op; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/BinaryExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/BinaryExpr.java deleted file mode 100644 index 7c2e872..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/BinaryExpr.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class BinaryExpr extends Expression { - - public static enum Operator { - or, // || - and, // && - binOr, // | - binAnd, // & - xor, // ^ - equals, // == - notEquals, // != - less, // < - greater, // > - lessEquals, // <= - greaterEquals, // >= - lShift, // << - rSignedShift, // >> - rUnsignedShift, // >>> - plus, // + - minus, // - - times, // * - divide, // / - remainder, // % - } - - private final Expression left; - - private final Expression right; - - private final Operator op; - - public BinaryExpr(int line, int column, Expression left, Expression right, Operator op) { - super(line, column); - this.left = left; - this.right = right; - this.op = op; - } - - public Expression getLeft() { - return left; - } - - public Expression getRight() { - return right; - } - - public Operator getOperator() { - return op; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/BooleanLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/BooleanLiteralExpr.java deleted file mode 100644 index 7fe847c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/BooleanLiteralExpr.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class BooleanLiteralExpr extends LiteralExpr { - - private final Boolean value; - - public BooleanLiteralExpr(int line, int column, Boolean value) { - super(line, column); - this.value = value; - } - - public Boolean getValue() { - return value; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/CastExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/CastExpr.java deleted file mode 100644 index 1b864c5..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/CastExpr.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class CastExpr extends Expression { - - private final Type type; - - private final Expression expr; - - public CastExpr(int line, int column, Type type, Expression expr) { - super(line, column); - this.type = type; - this.expr = expr; - } - - public Type getType() { - return type; - } - - public Expression getExpr() { - return expr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/CharLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/CharLiteralExpr.java deleted file mode 100644 index 7544719..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/CharLiteralExpr.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class CharLiteralExpr extends StringLiteralExpr { - - public CharLiteralExpr(int line, int column, String value) { - super(line, column, value); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ClassExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ClassExpr.java deleted file mode 100644 index a5fd57c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ClassExpr.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ClassExpr extends Expression { - - private final Type type; - - public ClassExpr(int line, int column, Type type) { - super(line, column); - this.type = type; - } - - public Type getType() { - return type; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ConditionalExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ConditionalExpr.java deleted file mode 100644 index d4cf3e9..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ConditionalExpr.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ConditionalExpr extends Expression { - - private final Expression condition; - - private final Expression thenExpr; - - private final Expression elseExpr; - - public ConditionalExpr(int line, int column, Expression condition, Expression thenExpr, Expression elseExpr) { - super(line, column); - this.condition = condition; - this.thenExpr = thenExpr; - this.elseExpr = elseExpr; - } - - public Expression getCondition() { - return condition; - } - - public Expression getThenExpr() { - return thenExpr; - } - - public Expression getElseExpr() { - return elseExpr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/DoubleLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/DoubleLiteralExpr.java deleted file mode 100644 index 83683d0..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/DoubleLiteralExpr.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class DoubleLiteralExpr extends StringLiteralExpr { - - public DoubleLiteralExpr(int line, int column, String value) { - super(line, column, value); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/EnclosedExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/EnclosedExpr.java deleted file mode 100644 index 1aa4d17..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/EnclosedExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class EnclosedExpr extends Expression { - - private final Expression inner; - - public EnclosedExpr(int line, int column, Expression inner) { - super(line, column); - this.inner = inner; - } - - public Expression getInner() { - return inner; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/Expression.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/Expression.java deleted file mode 100644 index bb3ba92..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/Expression.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 10/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.Node; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class Expression extends Node { - - public Expression(int line, int column) { - super(line, column); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/FieldAccessExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/FieldAccessExpr.java deleted file mode 100644 index 1a96bd8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/FieldAccessExpr.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class FieldAccessExpr extends Expression { - - private final Expression scope; - - private final List typeArgs; - - private final String field; - - public FieldAccessExpr(int line, int column, Expression scope, List typeArgs, String field) { - super(line, column); - this.scope = scope; - this.typeArgs = typeArgs; - this.field = field; - } - - public Expression getScope() { - return scope; - } - - public List getTypeArgs() { - return typeArgs; - } - - public String getField() { - return field; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/InstanceOfExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/InstanceOfExpr.java deleted file mode 100644 index a076620..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/InstanceOfExpr.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class InstanceOfExpr extends Expression { - - private final Expression expr; - - private final Type type; - - public InstanceOfExpr(int line, int column, Expression expr, Type type) { - super(line, column); - this.expr = expr; - this.type = type; - } - - public Expression getExpr() { - return expr; - } - - public Type getType() { - return type; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/IntegerLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/IntegerLiteralExpr.java deleted file mode 100644 index 82af380..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/IntegerLiteralExpr.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public class IntegerLiteralExpr extends StringLiteralExpr { - - public IntegerLiteralExpr(int line, int column, String value) { - super(line, column, value); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - - public final boolean isMinValue() { - return value != null && // - value.length() == 10 && // - value.equals("2147483648"); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/IntegerLiteralMinValueExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/IntegerLiteralMinValueExpr.java deleted file mode 100644 index 40f2e7d..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/IntegerLiteralMinValueExpr.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 09/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class IntegerLiteralMinValueExpr extends IntegerLiteralExpr { - - public IntegerLiteralMinValueExpr(int line, int column) { - super(line, column, "-2147483648"); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LiteralExpr.java deleted file mode 100644 index 9f4a8d1..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LiteralExpr.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class LiteralExpr extends Expression { - - public LiteralExpr(int line, int column) { - super(line, column); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LongLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LongLiteralExpr.java deleted file mode 100644 index bfec907..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LongLiteralExpr.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public class LongLiteralExpr extends StringLiteralExpr { - - public LongLiteralExpr(int line, int column, String value) { - super(line, column, value); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - - public final boolean isMinValue() { - return value != null && // - value.length() == 20 && // - value.startsWith("9223372036854775808") && // - (value.charAt(19) == 'L' || value.charAt(19) == 'l'); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LongLiteralMinValueExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LongLiteralMinValueExpr.java deleted file mode 100644 index 299e644..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/LongLiteralMinValueExpr.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 09/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class LongLiteralMinValueExpr extends LongLiteralExpr { - - public LongLiteralMinValueExpr(int line, int column) { - super(line, column, "-9223372036854775808L"); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MarkerAnnotationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MarkerAnnotationExpr.java deleted file mode 100644 index 2c71400..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MarkerAnnotationExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class MarkerAnnotationExpr extends AnnotationExpr { - - private final NameExpr name; - - public MarkerAnnotationExpr(int line, int column, NameExpr name) { - super(line, column); - this.name = name; - } - - public NameExpr getName() { - return name; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MemberValuePair.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MemberValuePair.java deleted file mode 100644 index 4533b50..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MemberValuePair.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.Node; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class MemberValuePair extends Node { - - private final String name; - - private final Expression value; - - public MemberValuePair(int line, int column, String name, Expression value) { - super(line, column); - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public Expression getValue() { - return value; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MethodCallExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MethodCallExpr.java deleted file mode 100644 index 701e5fe..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/MethodCallExpr.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class MethodCallExpr extends Expression { - - private final Expression scope; - - private final List typeArgs; - - private final String name; - - private final List args; - - public MethodCallExpr(int line, int column, Expression scope, List typeArgs, String name, List args) { - super(line, column); - this.scope = scope; - this.typeArgs = typeArgs; - this.name = name; - this.args = args; - } - - public Expression getScope() { - return scope; - } - - public List getTypeArgs() { - return typeArgs; - } - - public String getName() { - return name; - } - - public List getArgs() { - return args; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NameExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NameExpr.java deleted file mode 100644 index 8d959fd..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NameExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public class NameExpr extends Expression { - - private final String name; - - public NameExpr(int line, int column, String name) { - super(line, column); - this.name = name; - } - - public String getName() { - return name; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NormalAnnotationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NormalAnnotationExpr.java deleted file mode 100644 index 0d38885..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NormalAnnotationExpr.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class NormalAnnotationExpr extends AnnotationExpr { - - private final NameExpr name; - - private final List pairs; - - public NormalAnnotationExpr(int line, int column, NameExpr name, List pairs) { - super(line, column); - this.name = name; - this.pairs = pairs; - } - - public NameExpr getName() { - return name; - } - - public List getPairs() { - return pairs; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NullLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NullLiteralExpr.java deleted file mode 100644 index 3fb7d0e..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/NullLiteralExpr.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class NullLiteralExpr extends LiteralExpr { - - public NullLiteralExpr(int line, int column) { - super(line, column); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ObjectCreationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ObjectCreationExpr.java deleted file mode 100644 index 6ba8a10..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ObjectCreationExpr.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.body.BodyDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ObjectCreationExpr extends Expression { - - private final Expression scope; - - private final ClassOrInterfaceType type; - - private final List typeArgs; - - private final List args; - - private final List anonymousClassBody; - - public ObjectCreationExpr(int line, int column, Expression scope, ClassOrInterfaceType type, List typeArgs, List args, List anonymousBody) { - super(line, column); - this.scope = scope; - this.type = type; - this.typeArgs = typeArgs; - this.args = args; - this.anonymousClassBody = anonymousBody; - } - - public Expression getScope() { - return scope; - } - - public ClassOrInterfaceType getType() { - return type; - } - - public List getTypeArgs() { - return typeArgs; - } - - public List getArgs() { - return args; - } - - public List getAnonymousClassBody() { - return anonymousClassBody; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/QualifiedNameExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/QualifiedNameExpr.java deleted file mode 100644 index 65ce33a..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/QualifiedNameExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class QualifiedNameExpr extends NameExpr { - - private final NameExpr qualifier; - - public QualifiedNameExpr(int line, int column, NameExpr scope, String name) { - super(line, column, name); - this.qualifier = scope; - } - - public NameExpr getQualifier() { - return qualifier; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SingleMemberAnnotationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SingleMemberAnnotationExpr.java deleted file mode 100644 index 509f9bf..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SingleMemberAnnotationExpr.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 21/11/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class SingleMemberAnnotationExpr extends AnnotationExpr { - - private final NameExpr name; - - private final Expression memberValue; - - public SingleMemberAnnotationExpr(int line, int column, NameExpr name, Expression memberValue) { - super(line, column); - this.name = name; - this.memberValue = memberValue; - } - - public NameExpr getName() { - return name; - } - - public Expression getMemberValue() { - return memberValue; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/StringLiteralExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/StringLiteralExpr.java deleted file mode 100644 index 0b6c440..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/StringLiteralExpr.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 02/03/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public class StringLiteralExpr extends LiteralExpr { - - protected final String value; - - public StringLiteralExpr(int line, int column, String value) { - super(line, column); - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SuperExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SuperExpr.java deleted file mode 100644 index 2b64d7c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SuperExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 20/01/2007 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class SuperExpr extends Expression { - - private final Expression classExpr; - - public SuperExpr(int line, int column, Expression classExpr) { - super(line, column); - this.classExpr = classExpr; - } - - public Expression getClassExpr() { - return classExpr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SuperMemberAccessExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SuperMemberAccessExpr.java deleted file mode 100644 index 8c7a3ad..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/SuperMemberAccessExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class SuperMemberAccessExpr extends Expression { - - private final String name; - - public SuperMemberAccessExpr(int line, int column, String name) { - super(line, column); - this.name = name; - } - - public String getName() { - return name; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ThisExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ThisExpr.java deleted file mode 100644 index 054d16d..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/ThisExpr.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ThisExpr extends Expression { - - private final Expression classExpr; - - public ThisExpr(int line, int column, Expression classExpr) { - super(line, column); - this.classExpr = classExpr; - } - - public Expression getClassExpr() { - return classExpr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/UnaryExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/UnaryExpr.java deleted file mode 100644 index a5f9b12..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/UnaryExpr.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class UnaryExpr extends Expression { - - public static enum Operator { - positive, // + - negative, // - - preIncrement, // ++ - preDecrement, // -- - not, // ! - inverse, // ~ - posIncrement, // ++ - posDecrement, // -- - } - - private final Expression expr; - - private final Operator op; - - public UnaryExpr(int line, int column, Expression expr, Operator op) { - super(line, column); - this.expr = expr; - this.op = op; - } - - public Expression getExpr() { - return expr; - } - - public Operator getOperator() { - return op; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/VariableDeclarationExpr.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/VariableDeclarationExpr.java deleted file mode 100644 index 93ca0a3..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/expr/VariableDeclarationExpr.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 03/11/2006 - */ -package japa.parser.ast.expr; - -import japa.parser.ast.body.VariableDeclarator; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class VariableDeclarationExpr extends Expression { - - private final int modifiers; - - private final List annotations; - - private final Type type; - - private final List vars; - - public VariableDeclarationExpr(int line, int column, int modifiers, List annotations, Type type, List vars) { - super(line, column); - this.modifiers = modifiers; - this.annotations = annotations; - this.type = type; - this.vars = vars; - } - - public int getModifiers() { - return modifiers; - } - - public List getAnnotations() { - return annotations; - } - - public Type getType() { - return type; - } - - public List getVars() { - return vars; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/AssertStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/AssertStmt.java deleted file mode 100644 index b11840b..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/AssertStmt.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class AssertStmt extends Statement { - - private final Expression check; - - private final Expression msg; - - public AssertStmt(int line, int column, Expression check, Expression msg) { - super(line, column); - this.check = check; - this.msg = msg; - } - - public Expression getCheck() { - return check; - } - - public Expression getMessage() { - return msg; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/BlockStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/BlockStmt.java deleted file mode 100644 index 914e71c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/BlockStmt.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class BlockStmt extends Statement { - - private final List stmts; - - public BlockStmt(int beginLine, int beginColumn, int endLine, int endColumn, List stmts) { - super(beginLine, beginColumn, endLine, endColumn); - this.stmts = stmts; - } - - public List getStmts() { - return stmts; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/BreakStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/BreakStmt.java deleted file mode 100644 index 6817305..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/BreakStmt.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class BreakStmt extends Statement { - - private final String id; - - public BreakStmt(int line, int column, String id) { - super(line, column); - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/CatchClause.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/CatchClause.java deleted file mode 100644 index 1afa587..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/CatchClause.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 18/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.Node; -import japa.parser.ast.body.Parameter; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class CatchClause extends Node { - - private final Parameter except; - - private final BlockStmt catchBlock; - - public CatchClause(int line, int column, Parameter except, BlockStmt catchBlock) { - super(line, column); - this.except = except; - this.catchBlock = catchBlock; - } - - public Parameter getExcept() { - return except; - } - - public BlockStmt getCatchBlock() { - return catchBlock; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ContinueStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ContinueStmt.java deleted file mode 100644 index c52af2d..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ContinueStmt.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ContinueStmt extends Statement { - - private final String id; - - public ContinueStmt(int line, int column, String id) { - super(line, column); - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/DoStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/DoStmt.java deleted file mode 100644 index bd3441d..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/DoStmt.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class DoStmt extends Statement { - - private final Statement body; - - private final Expression condition; - - public DoStmt(int line, int column, Statement body, Expression condition) { - super(line, column); - this.body = body; - this.condition = condition; - } - - public Statement getBody() { - return body; - } - - public Expression getCondition() { - return condition; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/EmptyStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/EmptyStmt.java deleted file mode 100644 index 41ce723..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/EmptyStmt.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class EmptyStmt extends Statement { - - public EmptyStmt(int line, int column) { - super(line, column); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ExplicitConstructorInvocationStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ExplicitConstructorInvocationStmt.java deleted file mode 100644 index 980e4a4..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ExplicitConstructorInvocationStmt.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 03/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.type.Type; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ExplicitConstructorInvocationStmt extends Statement { - - private final List typeArgs; - - private final boolean isThis; - - private final Expression expr; - - private final List args; - - public ExplicitConstructorInvocationStmt(int line, int column, List typeArgs, boolean isThis, Expression expr, List args) { - super(line, column); - this.typeArgs = typeArgs; - this.isThis = isThis; - this.expr = expr; - this.args = args; - } - - public List getTypeArgs() { - return typeArgs; - } - - public boolean isThis() { - return isThis; - } - - public Expression getExpr() { - return expr; - } - - public List getArgs() { - return args; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ExpressionStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ExpressionStmt.java deleted file mode 100644 index 4d7b5a4..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ExpressionStmt.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ExpressionStmt extends Statement { - - private final Expression expr; - - public ExpressionStmt(int line, int column, Expression expr) { - super(line, column); - this.expr = expr; - } - - public Expression getExpression() { - return expr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ForStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ForStmt.java deleted file mode 100644 index 2d262e1..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ForStmt.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ForStmt extends Statement { - - private final List init; - - private final Expression compare; - - private final List update; - - private final Statement body; - - public ForStmt(int line, int column, List init, Expression compare, List update, Statement body) { - super(line, column); - this.compare = compare; - this.init = init; - this.update = update; - this.body = body; - } - - public List getInit() { - return init; - } - - public Expression getCompare() { - return compare; - } - - public List getUpdate() { - return update; - } - - public Statement getBody() { - return body; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ForeachStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ForeachStmt.java deleted file mode 100644 index c994b3f..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ForeachStmt.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.expr.VariableDeclarationExpr; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ForeachStmt extends Statement { - - private final VariableDeclarationExpr var; - - private final Expression iterable; - - private final Statement body; - - public ForeachStmt(int line, int column, VariableDeclarationExpr var, Expression iterable, Statement body) { - super(line, column); - this.var = var; - this.iterable = iterable; - this.body = body; - } - - public VariableDeclarationExpr getVariable() { - return var; - } - - public Expression getIterable() { - return iterable; - } - - public Statement getBody() { - return body; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/IfStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/IfStmt.java deleted file mode 100644 index 420c7b1..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/IfStmt.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class IfStmt extends Statement { - - private final Expression condition; - - private final Statement thenStmt; - - private final Statement elseStmt; - - public IfStmt(int line, int column, Expression condition, Statement thenStmt, Statement elseStmt) { - super(line, column); - this.condition = condition; - this.thenStmt = thenStmt; - this.elseStmt = elseStmt; - } - - public Expression getCondition() { - return condition; - } - - public Statement getThenStmt() { - return thenStmt; - } - - public Statement getElseStmt() { - return elseStmt; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/LabeledStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/LabeledStmt.java deleted file mode 100644 index 17546b4..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/LabeledStmt.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class LabeledStmt extends Statement { - - private final String label; - - private final Statement stmt; - - public LabeledStmt(int line, int column, String label, Statement stmt) { - super(line, column); - this.label = label; - this.stmt = stmt; - } - - public String getLabel() { - return label; - } - - public Statement getStmt() { - return stmt; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ReturnStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ReturnStmt.java deleted file mode 100644 index 01af77e..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ReturnStmt.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ReturnStmt extends Statement { - - private final Expression expr; - - public ReturnStmt(int line, int column, Expression expr) { - super(line, column); - this.expr = expr; - } - - public Expression getExpr() { - return expr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/Statement.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/Statement.java deleted file mode 100644 index de66ec8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/Statement.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 03/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.Node; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class Statement extends Node { - - public Statement(int beginLine, int beginColumn, int endLine, int endColumn) { - super(beginLine, beginColumn, endLine, endColumn); - } - - public Statement(int line, int column) { - super(line, column); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SwitchEntryStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SwitchEntryStmt.java deleted file mode 100644 index 0963c66..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SwitchEntryStmt.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class SwitchEntryStmt extends Statement { - - private final Expression label; - - private final List stmts; - - public SwitchEntryStmt(int line, int column, Expression label, List stmts) { - super(line, column); - this.label = label; - this.stmts = stmts; - } - - public Expression getLabel() { - return label; - } - - public List getStmts() { - return stmts; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SwitchStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SwitchStmt.java deleted file mode 100644 index b704ddc..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SwitchStmt.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class SwitchStmt extends Statement { - - private final Expression selector; - - private final List entries; - - public SwitchStmt(int line, int column, Expression selector, List entries) { - super(line, column); - this.selector = selector; - this.entries = entries; - } - - public Expression getSelector() { - return selector; - } - - public List getEntries() { - return entries; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SynchronizedStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SynchronizedStmt.java deleted file mode 100644 index 7ad9b6e..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/SynchronizedStmt.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 18/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class SynchronizedStmt extends Statement { - - private final Expression expr; - - private final BlockStmt block; - - public SynchronizedStmt(int line, int column, Expression expr, BlockStmt block) { - super(line, column); - this.expr = expr; - this.block = block; - } - - public Expression getExpr() { - return expr; - } - - public BlockStmt getBlock() { - return block; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ThrowStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ThrowStmt.java deleted file mode 100644 index 9ff0d54..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/ThrowStmt.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 18/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ThrowStmt extends Statement { - - private final Expression expr; - - public ThrowStmt(int line, int column, Expression expr) { - super(line, column); - this.expr = expr; - } - - public Expression getExpr() { - return expr; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/TryStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/TryStmt.java deleted file mode 100644 index fee402f..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/TryStmt.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 18/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class TryStmt extends Statement { - - private final BlockStmt tryBlock; - - private final List catchs; - - private final BlockStmt finallyBlock; - - public TryStmt(int line, int column, BlockStmt tryBlock, List catchs, BlockStmt finallyBlock) { - super(line, column); - this.tryBlock = tryBlock; - this.catchs = catchs; - this.finallyBlock = finallyBlock; - } - - public BlockStmt getTryBlock() { - return tryBlock; - } - - public List getCatchs() { - return catchs; - } - - public BlockStmt getFinallyBlock() { - return finallyBlock; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/TypeDeclarationStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/TypeDeclarationStmt.java deleted file mode 100644 index 6336ac8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/TypeDeclarationStmt.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 04/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class TypeDeclarationStmt extends Statement { - - private final TypeDeclaration typeDecl; - - public TypeDeclarationStmt(int line, int column, TypeDeclaration typeDecl) { - super(line, column); - this.typeDecl = typeDecl; - } - - public TypeDeclaration getTypeDeclaration() { - return typeDecl; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/WhileStmt.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/WhileStmt.java deleted file mode 100644 index 2042872..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/stmt/WhileStmt.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 07/11/2006 - */ -package japa.parser.ast.stmt; - -import japa.parser.ast.expr.Expression; -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class WhileStmt extends Statement { - - private final Expression condition; - - private final Statement body; - - public WhileStmt(int line, int column, Expression condition, Statement body) { - super(line, column); - this.condition = condition; - this.body = body; - } - - public Expression getCondition() { - return condition; - } - - public Statement getBody() { - return body; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/ClassOrInterfaceType.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/ClassOrInterfaceType.java deleted file mode 100644 index 5241dc8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/ClassOrInterfaceType.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.type; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ -public final class ClassOrInterfaceType extends Type { - - private final ClassOrInterfaceType scope; - - private final String name; - - private final List typeArgs; - - public ClassOrInterfaceType(int line, int column, ClassOrInterfaceType scope, String name, List typeArgs) { - super(line, column); - this.scope = scope; - this.name = name; - this.typeArgs = typeArgs; - } - - public ClassOrInterfaceType getScope() { - return scope; - } - - public String getName() { - return name; - } - - public List getTypeArgs() { - return typeArgs; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/PrimitiveType.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/PrimitiveType.java deleted file mode 100644 index 3e10578..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/PrimitiveType.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.type; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class PrimitiveType extends Type { - - public enum Primitive { - Boolean, Char, Byte, Short, Int, Long, Float, Double - } - - private final Primitive type; - - public PrimitiveType(int line, int column, Primitive type) { - super(line, column); - this.type = type; - } - - public Primitive getType() { - return type; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/ReferenceType.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/ReferenceType.java deleted file mode 100644 index 3a44f07..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/ReferenceType.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.type; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class ReferenceType extends Type { - - private final Type type; - - private final int arrayCount; - - public ReferenceType(int line, int column, Type type, int arrayCount) { - super(line, column); - this.type = type; - this.arrayCount = arrayCount; - } - - public Type getType() { - return type; - } - - public int getArrayCount() { - return arrayCount; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/Type.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/Type.java deleted file mode 100644 index 505bc17..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/Type.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.type; - -import japa.parser.ast.Node; - -/** - * @author Julio Vilmar Gesser - */ -public abstract class Type extends Node { - - public Type(int line, int column) { - super(line, column); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/VoidType.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/VoidType.java deleted file mode 100644 index 1c927b8..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/VoidType.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.type; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class VoidType extends Type { - - public VoidType(int line, int column) { - super(line, column); - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/WildcardType.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/WildcardType.java deleted file mode 100644 index 9f3a325..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/type/WildcardType.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.type; - -import japa.parser.ast.visitor.GenericVisitor; -import japa.parser.ast.visitor.VoidVisitor; - -/** - * @author Julio Vilmar Gesser - */ -public final class WildcardType extends Type { - - private final ReferenceType ext; - - private final ReferenceType sup; - - public WildcardType(int line, int column, ReferenceType ext, ReferenceType sup) { - super(line, column); - assert ext == null || sup == null; - this.ext = ext; - this.sup = sup; - } - - public ReferenceType getExtends() { - return ext; - } - - public ReferenceType getSuper() { - return sup; - } - - @Override - public void accept(VoidVisitor v, A arg) { - v.visit(this, arg); - } - - @Override - public R accept(GenericVisitor v, A arg) { - return v.visit(this, arg); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/DumpVisitor.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/DumpVisitor.java deleted file mode 100644 index 8ef9a22..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/DumpVisitor.java +++ /dev/null @@ -1,1352 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.visitor; - -import japa.parser.ast.BlockComment; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.ImportDeclaration; -import japa.parser.ast.LineComment; -import japa.parser.ast.Node; -import japa.parser.ast.PackageDeclaration; -import japa.parser.ast.TypeParameter; -import japa.parser.ast.body.AnnotationDeclaration; -import japa.parser.ast.body.AnnotationMemberDeclaration; -import japa.parser.ast.body.BodyDeclaration; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.ConstructorDeclaration; -import japa.parser.ast.body.EmptyMemberDeclaration; -import japa.parser.ast.body.EmptyTypeDeclaration; -import japa.parser.ast.body.EnumConstantDeclaration; -import japa.parser.ast.body.EnumDeclaration; -import japa.parser.ast.body.FieldDeclaration; -import japa.parser.ast.body.InitializerDeclaration; -import japa.parser.ast.body.JavadocComment; -import japa.parser.ast.body.MethodDeclaration; -import japa.parser.ast.body.ModifierSet; -import japa.parser.ast.body.Parameter; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.body.VariableDeclarator; -import japa.parser.ast.body.VariableDeclaratorId; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.ArrayAccessExpr; -import japa.parser.ast.expr.ArrayCreationExpr; -import japa.parser.ast.expr.ArrayInitializerExpr; -import japa.parser.ast.expr.AssignExpr; -import japa.parser.ast.expr.BinaryExpr; -import japa.parser.ast.expr.BooleanLiteralExpr; -import japa.parser.ast.expr.CastExpr; -import japa.parser.ast.expr.CharLiteralExpr; -import japa.parser.ast.expr.ClassExpr; -import japa.parser.ast.expr.ConditionalExpr; -import japa.parser.ast.expr.DoubleLiteralExpr; -import japa.parser.ast.expr.EnclosedExpr; -import japa.parser.ast.expr.Expression; -import japa.parser.ast.expr.FieldAccessExpr; -import japa.parser.ast.expr.InstanceOfExpr; -import japa.parser.ast.expr.IntegerLiteralExpr; -import japa.parser.ast.expr.IntegerLiteralMinValueExpr; -import japa.parser.ast.expr.LongLiteralExpr; -import japa.parser.ast.expr.LongLiteralMinValueExpr; -import japa.parser.ast.expr.MarkerAnnotationExpr; -import japa.parser.ast.expr.MemberValuePair; -import japa.parser.ast.expr.MethodCallExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.expr.NormalAnnotationExpr; -import japa.parser.ast.expr.NullLiteralExpr; -import japa.parser.ast.expr.ObjectCreationExpr; -import japa.parser.ast.expr.QualifiedNameExpr; -import japa.parser.ast.expr.SingleMemberAnnotationExpr; -import japa.parser.ast.expr.StringLiteralExpr; -import japa.parser.ast.expr.SuperExpr; -import japa.parser.ast.expr.SuperMemberAccessExpr; -import japa.parser.ast.expr.ThisExpr; -import japa.parser.ast.expr.UnaryExpr; -import japa.parser.ast.expr.VariableDeclarationExpr; -import japa.parser.ast.stmt.AssertStmt; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.stmt.BreakStmt; -import japa.parser.ast.stmt.CatchClause; -import japa.parser.ast.stmt.ContinueStmt; -import japa.parser.ast.stmt.DoStmt; -import japa.parser.ast.stmt.EmptyStmt; -import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; -import japa.parser.ast.stmt.ExpressionStmt; -import japa.parser.ast.stmt.ForStmt; -import japa.parser.ast.stmt.ForeachStmt; -import japa.parser.ast.stmt.IfStmt; -import japa.parser.ast.stmt.LabeledStmt; -import japa.parser.ast.stmt.ReturnStmt; -import japa.parser.ast.stmt.Statement; -import japa.parser.ast.stmt.SwitchEntryStmt; -import japa.parser.ast.stmt.SwitchStmt; -import japa.parser.ast.stmt.SynchronizedStmt; -import japa.parser.ast.stmt.ThrowStmt; -import japa.parser.ast.stmt.TryStmt; -import japa.parser.ast.stmt.TypeDeclarationStmt; -import japa.parser.ast.stmt.WhileStmt; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; - -import java.util.Iterator; -import java.util.List; - -/** - * @author Julio Vilmar Gesser - */ - -public final class DumpVisitor implements VoidVisitor { - - private class SourcePrinter { - - private int level = 0; - - private boolean indented = false; - - private final StringBuilder buf = new StringBuilder(); - - public void indent() { - level++; - } - - public void unindent() { - level--; - } - - private void makeIndent() { - for (int i = 0; i < level; i++) { - buf.append(" "); - } - } - - public void print(String arg) { - if (!indented) { - makeIndent(); - indented = true; - } - buf.append(arg); - } - - public void printLn(String arg) { - print(arg); - printLn(); - } - - public void printLn() { - buf.append("\n"); - indented = false; - } - - public String getSource() { - return buf.toString(); - } - - @Override - public String toString() { - return getSource(); - } - } - - private final SourcePrinter printer = new SourcePrinter(); - - public String getSource() { - return printer.getSource(); - } - - private void printModifiers(int modifiers) { - if (ModifierSet.isPrivate(modifiers)) { - printer.print("private "); - } - if (ModifierSet.isProtected(modifiers)) { - printer.print("protected "); - } - if (ModifierSet.isPublic(modifiers)) { - printer.print("public "); - } - if (ModifierSet.isAbstract(modifiers)) { - printer.print("abstract "); - } - if (ModifierSet.isStatic(modifiers)) { - printer.print("static "); - } - if (ModifierSet.isFinal(modifiers)) { - printer.print("final "); - } - if (ModifierSet.isNative(modifiers)) { - printer.print("native "); - } - if (ModifierSet.isStrictfp(modifiers)) { - printer.print("strictfp "); - } - if (ModifierSet.isSynchronized(modifiers)) { - printer.print("synchronized "); - } - if (ModifierSet.isTransient(modifiers)) { - printer.print("transient "); - } - if (ModifierSet.isVolatile(modifiers)) { - printer.print("volatile "); - } - } - - private void printMembers(List members, Object arg) { - for (BodyDeclaration member : members) { - printer.printLn(); - member.accept(this, arg); - printer.printLn(); - } - } - - private void printMemberAnnotations(List annotations, Object arg) { - if (annotations != null) { - for (AnnotationExpr a : annotations) { - a.accept(this, arg); - printer.printLn(); - } - } - } - - private void printAnnotations(List annotations, Object arg) { - if (annotations != null) { - for (AnnotationExpr a : annotations) { - a.accept(this, arg); - printer.print(" "); - } - } - } - - private void printTypeArgs(List args, Object arg) { - if (args != null) { - printer.print("<"); - for (Iterator i = args.iterator(); i.hasNext();) { - Type t = i.next(); - t.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - printer.print(">"); - } - } - - private void printTypeParameters(List args, Object arg) { - if (args != null) { - printer.print("<"); - for (Iterator i = args.iterator(); i.hasNext();) { - TypeParameter t = i.next(); - t.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - printer.print(">"); - } - } - - public void visit(Node n, Object arg) { - throw new IllegalStateException(n.getClass().getName()); - } - - public void visit(CompilationUnit n, Object arg) { - if (n.getPakage() != null) { - n.getPakage().accept(this, arg); - } - if (n.getImports() != null) { - for (ImportDeclaration i : n.getImports()) { - i.accept(this, arg); - } - printer.printLn(); - } - if (n.getTypes() != null) { - for (Iterator i = n.getTypes().iterator(); i.hasNext();) { - i.next().accept(this, arg); - printer.printLn(); - if (i.hasNext()) { - printer.printLn(); - } - } - } - } - - public void visit(PackageDeclaration n, Object arg) { - printAnnotations(n.getAnnotations(), arg); - printer.print("package "); - n.getName().accept(this, arg); - printer.printLn(";"); - printer.printLn(); - } - - public void visit(NameExpr n, Object arg) { - printer.print(n.getName()); - } - - public void visit(QualifiedNameExpr n, Object arg) { - n.getQualifier().accept(this, arg); - printer.print("."); - printer.print(n.getName()); - } - - public void visit(ImportDeclaration n, Object arg) { - printer.print("import "); - if (n.isStatic()) { - printer.print("static "); - } - n.getName().accept(this, arg); - if (n.isAsterisk()) { - printer.print(".*"); - } - printer.printLn(";"); - } - - public void visit(ClassOrInterfaceDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - if (n.isInterface()) { - printer.print("interface "); - } else { - printer.print("class "); - } - - printer.print(n.getName()); - - printTypeParameters(n.getTypeParameters(), arg); - - if (n.getExtends() != null) { - printer.print(" extends "); - for (Iterator i = n.getExtends().iterator(); i.hasNext();) { - ClassOrInterfaceType c = i.next(); - c.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - - if (n.getImplements() != null) { - printer.print(" implements "); - for (Iterator i = n.getImplements().iterator(); i.hasNext();) { - ClassOrInterfaceType c = i.next(); - c.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - - printer.printLn(" {"); - printer.indent(); - if (n.getMembers() != null) { - printMembers(n.getMembers(), arg); - } - printer.unindent(); - printer.print("}"); - } - - public void visit(EmptyTypeDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printer.print(";"); - } - - public void visit(JavadocComment n, Object arg) { - printer.print("/**"); - printer.print(n.getContent()); - printer.printLn("*/"); - } - - public void visit(ClassOrInterfaceType n, Object arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - printer.print("."); - } - printer.print(n.getName()); - printTypeArgs(n.getTypeArgs(), arg); - } - - public void visit(TypeParameter n, Object arg) { - printer.print(n.getName()); - if (n.getTypeBound() != null) { - printer.print(" extends "); - for (Iterator i = n.getTypeBound().iterator(); i.hasNext();) { - ClassOrInterfaceType c = i.next(); - c.accept(this, arg); - if (i.hasNext()) { - printer.print(" & "); - } - } - } - } - - public void visit(PrimitiveType n, Object arg) { - switch (n.getType()) { - case Boolean: - printer.print("boolean"); - break; - case Byte: - printer.print("byte"); - break; - case Char: - printer.print("char"); - break; - case Double: - printer.print("double"); - break; - case Float: - printer.print("float"); - break; - case Int: - printer.print("int"); - break; - case Long: - printer.print("long"); - break; - case Short: - printer.print("short"); - break; - } - } - - public void visit(ReferenceType n, Object arg) { - n.getType().accept(this, arg); - for (int i = 0; i < n.getArrayCount(); i++) { - printer.print("[]"); - } - } - - public void visit(WildcardType n, Object arg) { - printer.print("?"); - if (n.getExtends() != null) { - printer.print(" extends "); - n.getExtends().accept(this, arg); - } - if (n.getSuper() != null) { - printer.print(" super "); - n.getSuper().accept(this, arg); - } - } - - public void visit(FieldDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - n.getType().accept(this, arg); - - printer.print(" "); - for (Iterator i = n.getVariables().iterator(); i.hasNext();) { - VariableDeclarator var = i.next(); - var.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - - printer.print(";"); - } - - public void visit(VariableDeclarator n, Object arg) { - n.getId().accept(this, arg); - if (n.getInit() != null) { - printer.print(" = "); - n.getInit().accept(this, arg); - } - } - - public void visit(VariableDeclaratorId n, Object arg) { - printer.print(n.getName()); - for (int i = 0; i < n.getArrayCount(); i++) { - printer.print("[]"); - } - } - - public void visit(ArrayInitializerExpr n, Object arg) { - printer.print("{"); - if (n.getValues() != null) { - printer.print(" "); - for (Iterator i = n.getValues().iterator(); i.hasNext();) { - Expression expr = i.next(); - expr.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - printer.print(" "); - } - printer.print("}"); - } - - public void visit(VoidType n, Object arg) { - printer.print("void"); - } - - public void visit(ArrayAccessExpr n, Object arg) { - n.getName().accept(this, arg); - printer.print("["); - n.getIndex().accept(this, arg); - printer.print("]"); - } - - public void visit(ArrayCreationExpr n, Object arg) { - printer.print("new "); - n.getType().accept(this, arg); - printTypeArgs(n.getTypeArgs(), arg); - - if (n.getDimensions() != null) { - for (Expression dim : n.getDimensions()) { - printer.print("["); - dim.accept(this, arg); - printer.print("]"); - } - for (int i = 0; i < n.getArrayCount(); i++) { - printer.print("[]"); - } - } else { - for (int i = 0; i < n.getArrayCount(); i++) { - printer.print("[]"); - } - printer.print(" "); - n.getInitializer().accept(this, arg); - } - } - - public void visit(AssignExpr n, Object arg) { - n.getTarget().accept(this, arg); - printer.print(" "); - switch (n.getOperator()) { - case assign: - printer.print("="); - break; - case and: - printer.print("&="); - break; - case or: - printer.print("|="); - break; - case xor: - printer.print("^="); - break; - case plus: - printer.print("+="); - break; - case minus: - printer.print("-="); - break; - case rem: - printer.print("%="); - break; - case slash: - printer.print("/="); - break; - case star: - printer.print("*="); - break; - case lShift: - printer.print("<<="); - break; - case rSignedShift: - printer.print(">>="); - break; - case rUnsignedShift: - printer.print(">>>="); - break; - } - printer.print(" "); - n.getValue().accept(this, arg); - } - - public void visit(BinaryExpr n, Object arg) { - n.getLeft().accept(this, arg); - printer.print(" "); - switch (n.getOperator()) { - case or: - printer.print("||"); - break; - case and: - printer.print("&&"); - break; - case binOr: - printer.print("|"); - break; - case binAnd: - printer.print("&"); - break; - case xor: - printer.print("^"); - break; - case equals: - printer.print("=="); - break; - case notEquals: - printer.print("!="); - break; - case less: - printer.print("<"); - break; - case greater: - printer.print(">"); - break; - case lessEquals: - printer.print("<="); - break; - case greaterEquals: - printer.print(">="); - break; - case lShift: - printer.print("<<"); - break; - case rSignedShift: - printer.print(">>"); - break; - case rUnsignedShift: - printer.print(">>>"); - break; - case plus: - printer.print("+"); - break; - case minus: - printer.print("-"); - break; - case times: - printer.print("*"); - break; - case divide: - printer.print("/"); - break; - case remainder: - printer.print("%"); - break; - } - printer.print(" "); - n.getRight().accept(this, arg); - } - - public void visit(CastExpr n, Object arg) { - printer.print("("); - n.getType().accept(this, arg); - printer.print(") "); - n.getExpr().accept(this, arg); - } - - public void visit(ClassExpr n, Object arg) { - n.getType().accept(this, arg); - printer.print(".class"); - } - - public void visit(ConditionalExpr n, Object arg) { - n.getCondition().accept(this, arg); - printer.print(" ? "); - n.getThenExpr().accept(this, arg); - printer.print(" : "); - n.getElseExpr().accept(this, arg); - } - - public void visit(EnclosedExpr n, Object arg) { - printer.print("("); - n.getInner().accept(this, arg); - printer.print(")"); - } - - public void visit(FieldAccessExpr n, Object arg) { - n.getScope().accept(this, arg); - printer.print("."); - printer.print(n.getField()); - } - - public void visit(InstanceOfExpr n, Object arg) { - n.getExpr().accept(this, arg); - printer.print(" instanceof "); - n.getType().accept(this, arg); - } - - public void visit(CharLiteralExpr n, Object arg) { - printer.print("'"); - printer.print(n.getValue()); - printer.print("'"); - } - - public void visit(DoubleLiteralExpr n, Object arg) { - printer.print(n.getValue()); - } - - public void visit(IntegerLiteralExpr n, Object arg) { - printer.print(n.getValue()); - } - - public void visit(LongLiteralExpr n, Object arg) { - printer.print(n.getValue()); - } - - public void visit(IntegerLiteralMinValueExpr n, Object arg) { - printer.print(n.getValue()); - } - - public void visit(LongLiteralMinValueExpr n, Object arg) { - printer.print(n.getValue()); - } - - public void visit(StringLiteralExpr n, Object arg) { - printer.print("\""); - printer.print(n.getValue()); - printer.print("\""); - } - - public void visit(BooleanLiteralExpr n, Object arg) { - printer.print(n.getValue().toString()); - } - - public void visit(NullLiteralExpr n, Object arg) { - printer.print("null"); - } - - public void visit(ThisExpr n, Object arg) { - if (n.getClassExpr() != null) { - n.getClassExpr().accept(this, arg); - printer.print("."); - } - printer.print("this"); - } - - public void visit(SuperExpr n, Object arg) { - if (n.getClassExpr() != null) { - n.getClassExpr().accept(this, arg); - printer.print("."); - } - printer.print("super"); - } - - public void visit(MethodCallExpr n, Object arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - printer.print("."); - } - printTypeArgs(n.getTypeArgs(), arg); - printer.print(n.getName()); - printer.print("("); - if (n.getArgs() != null) { - for (Iterator i = n.getArgs().iterator(); i.hasNext();) { - Expression e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(")"); - } - - public void visit(ObjectCreationExpr n, Object arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - printer.print("."); - } - - printer.print("new "); - - printTypeArgs(n.getTypeArgs(), arg); - n.getType().accept(this, arg); - - printer.print("("); - if (n.getArgs() != null) { - for (Iterator i = n.getArgs().iterator(); i.hasNext();) { - Expression e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(")"); - - if (n.getAnonymousClassBody() != null) { - printer.printLn(" {"); - printer.indent(); - printMembers(n.getAnonymousClassBody(), arg); - printer.unindent(); - printer.print("}"); - } - } - - public void visit(SuperMemberAccessExpr n, Object arg) { - printer.print("super."); - printer.print(n.getName()); - } - - public void visit(UnaryExpr n, Object arg) { - switch (n.getOperator()) { - case positive: - printer.print("+"); - break; - case negative: - printer.print("-"); - break; - case inverse: - printer.print("~"); - break; - case not: - printer.print("!"); - break; - case preIncrement: - printer.print("++"); - break; - case preDecrement: - printer.print("--"); - break; - } - - n.getExpr().accept(this, arg); - - switch (n.getOperator()) { - case posIncrement: - printer.print("++"); - break; - case posDecrement: - printer.print("--"); - break; - } - } - - public void visit(ConstructorDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - printTypeParameters(n.getTypeParameters(), arg); - if (n.getTypeParameters() != null) { - printer.print(" "); - } - printer.print(n.getName()); - - printer.print("("); - if (n.getParameters() != null) { - for (Iterator i = n.getParameters().iterator(); i.hasNext();) { - Parameter p = i.next(); - p.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(")"); - - if (n.getThrows() != null) { - printer.print(" throws "); - for (Iterator i = n.getThrows().iterator(); i.hasNext();) { - NameExpr name = i.next(); - name.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(" "); - n.getBlock().accept(this, arg); - } - - public void visit(MethodDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - printTypeParameters(n.getTypeParameters(), arg); - if (n.getTypeParameters() != null) { - printer.print(" "); - } - - n.getType().accept(this, arg); - printer.print(" "); - printer.print(n.getName()); - - printer.print("("); - if (n.getParameters() != null) { - for (Iterator i = n.getParameters().iterator(); i.hasNext();) { - Parameter p = i.next(); - p.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(")"); - - for (int i = 0; i < n.getArrayCount(); i++) { - printer.print("[]"); - } - - if (n.getThrows() != null) { - printer.print(" throws "); - for (Iterator i = n.getThrows().iterator(); i.hasNext();) { - NameExpr name = i.next(); - name.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - if (n.getBody() == null) { - printer.print(";"); - } else { - printer.print(" "); - n.getBody().accept(this, arg); - } - } - - public void visit(Parameter n, Object arg) { - printAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - n.getType().accept(this, arg); - if (n.isVarArgs()) { - printer.print("..."); - } - printer.print(" "); - n.getId().accept(this, arg); - } - - public void visit(ExplicitConstructorInvocationStmt n, Object arg) { - if (n.isThis()) { - printTypeArgs(n.getTypeArgs(), arg); - printer.print("this"); - } else { - if (n.getExpr() != null) { - n.getExpr().accept(this, arg); - printer.print("."); - } - printTypeArgs(n.getTypeArgs(), arg); - printer.print("super"); - } - printer.print("("); - if (n.getArgs() != null) { - for (Iterator i = n.getArgs().iterator(); i.hasNext();) { - Expression e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(");"); - } - - public void visit(VariableDeclarationExpr n, Object arg) { - printAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - n.getType().accept(this, arg); - printer.print(" "); - - for (Iterator i = n.getVars().iterator(); i.hasNext();) { - VariableDeclarator v = i.next(); - v.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - - public void visit(TypeDeclarationStmt n, Object arg) { - n.getTypeDeclaration().accept(this, arg); - } - - public void visit(AssertStmt n, Object arg) { - printer.print("assert "); - n.getCheck().accept(this, arg); - if (n.getMessage() != null) { - printer.print(" : "); - n.getMessage().accept(this, arg); - } - printer.print(";"); - } - - public void visit(BlockStmt n, Object arg) { - printer.printLn("{"); - if (n.getStmts() != null) { - printer.indent(); - for (Statement s : n.getStmts()) { - s.accept(this, arg); - printer.printLn(); - } - printer.unindent(); - } - printer.print("}"); - - } - - public void visit(LabeledStmt n, Object arg) { - printer.print(n.getLabel()); - printer.print(": "); - n.getStmt().accept(this, arg); - } - - public void visit(EmptyStmt n, Object arg) { - printer.print(";"); - } - - public void visit(ExpressionStmt n, Object arg) { - n.getExpression().accept(this, arg); - printer.print(";"); - } - - public void visit(SwitchStmt n, Object arg) { - printer.print("switch("); - n.getSelector().accept(this, arg); - printer.printLn(") {"); - if (n.getEntries() != null) { - printer.indent(); - for (SwitchEntryStmt e : n.getEntries()) { - e.accept(this, arg); - } - printer.unindent(); - } - printer.print("}"); - - } - - public void visit(SwitchEntryStmt n, Object arg) { - if (n.getLabel() != null) { - printer.print("case "); - n.getLabel().accept(this, arg); - printer.print(":"); - } else { - printer.print("default:"); - } - printer.printLn(); - printer.indent(); - if (n.getStmts() != null) { - for (Statement s : n.getStmts()) { - s.accept(this, arg); - printer.printLn(); - } - } - printer.unindent(); - } - - public void visit(BreakStmt n, Object arg) { - printer.print("break"); - if (n.getId() != null) { - printer.print(" "); - printer.print(n.getId()); - } - printer.print(";"); - } - - public void visit(ReturnStmt n, Object arg) { - printer.print("return"); - if (n.getExpr() != null) { - printer.print(" "); - n.getExpr().accept(this, arg); - } - printer.print(";"); - } - - public void visit(EnumDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - printer.print("enum "); - printer.print(n.getName()); - - if (n.getImplements() != null) { - printer.print(" implements "); - for (Iterator i = n.getImplements().iterator(); i.hasNext();) { - ClassOrInterfaceType c = i.next(); - c.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - - printer.printLn(" {"); - printer.indent(); - if (n.getEntries() != null) { - printer.printLn(); - for (Iterator i = n.getEntries().iterator(); i.hasNext();) { - EnumConstantDeclaration e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - if (n.getMembers() != null) { - printer.printLn(";"); - printMembers(n.getMembers(), arg); - } else { - if (n.getEntries() != null) { - printer.printLn(); - } - } - printer.unindent(); - printer.print("}"); - } - - public void visit(EnumConstantDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printer.print(n.getName()); - - if (n.getArgs() != null) { - printer.print("("); - for (Iterator i = n.getArgs().iterator(); i.hasNext();) { - Expression e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - printer.print(")"); - } - - if (n.getClassBody() != null) { - printer.printLn(" {"); - printer.indent(); - printMembers(n.getClassBody(), arg); - printer.unindent(); - printer.printLn("}"); - } - } - - public void visit(EmptyMemberDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printer.print(";"); - } - - public void visit(InitializerDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.isStatic()) { - printer.print("static "); - } - n.getBlock().accept(this, arg); - } - - public void visit(IfStmt n, Object arg) { - printer.print("if ("); - n.getCondition().accept(this, arg); - printer.print(") "); - n.getThenStmt().accept(this, arg); - if (n.getElseStmt() != null) { - printer.print(" else "); - n.getElseStmt().accept(this, arg); - } - } - - public void visit(WhileStmt n, Object arg) { - printer.print("while ("); - n.getCondition().accept(this, arg); - printer.print(") "); - n.getBody().accept(this, arg); - } - - public void visit(ContinueStmt n, Object arg) { - printer.print("continue"); - if (n.getId() != null) { - printer.print(" "); - printer.print(n.getId()); - } - printer.print(";"); - } - - public void visit(DoStmt n, Object arg) { - printer.print("do "); - n.getBody().accept(this, arg); - printer.print(" while ("); - n.getCondition().accept(this, arg); - printer.print(");"); - } - - public void visit(ForeachStmt n, Object arg) { - printer.print("for ("); - n.getVariable().accept(this, arg); - printer.print(" : "); - n.getIterable().accept(this, arg); - printer.print(") "); - n.getBody().accept(this, arg); - } - - public void visit(ForStmt n, Object arg) { - printer.print("for ("); - if (n.getInit() != null) { - for (Iterator i = n.getInit().iterator(); i.hasNext();) { - Expression e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print("; "); - if (n.getCompare() != null) { - n.getCompare().accept(this, arg); - } - printer.print("; "); - if (n.getUpdate() != null) { - for (Iterator i = n.getUpdate().iterator(); i.hasNext();) { - Expression e = i.next(); - e.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(") "); - n.getBody().accept(this, arg); - } - - public void visit(ThrowStmt n, Object arg) { - printer.print("throw "); - n.getExpr().accept(this, arg); - printer.print(";"); - } - - public void visit(SynchronizedStmt n, Object arg) { - printer.print("synchronized ("); - n.getExpr().accept(this, arg); - printer.print(") "); - n.getBlock().accept(this, arg); - } - - public void visit(TryStmt n, Object arg) { - printer.print("try "); - n.getTryBlock().accept(this, arg); - if (n.getCatchs() != null) { - for (CatchClause c : n.getCatchs()) { - c.accept(this, arg); - } - } - if (n.getFinallyBlock() != null) { - printer.print(" finally "); - n.getFinallyBlock().accept(this, arg); - } - } - - public void visit(CatchClause n, Object arg) { - printer.print(" catch ("); - n.getExcept().accept(this, arg); - printer.print(") "); - n.getCatchBlock().accept(this, arg); - - } - - public void visit(AnnotationDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - printer.print("@interface "); - printer.print(n.getName()); - printer.printLn(" {"); - printer.indent(); - if (n.getMembers() != null) { - printMembers(n.getMembers(), arg); - } - printer.unindent(); - printer.print("}"); - } - - public void visit(AnnotationMemberDeclaration n, Object arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - printMemberAnnotations(n.getAnnotations(), arg); - printModifiers(n.getModifiers()); - - n.getType().accept(this, arg); - printer.print(" "); - printer.print(n.getName()); - printer.print("()"); - if (n.getDefaultValue() != null) { - printer.print(" default "); - n.getDefaultValue().accept(this, arg); - } - printer.print(";"); - } - - public void visit(MarkerAnnotationExpr n, Object arg) { - printer.print("@"); - n.getName().accept(this, arg); - } - - public void visit(SingleMemberAnnotationExpr n, Object arg) { - printer.print("@"); - n.getName().accept(this, arg); - printer.print("("); - n.getMemberValue().accept(this, arg); - printer.print(")"); - } - - public void visit(NormalAnnotationExpr n, Object arg) { - printer.print("@"); - n.getName().accept(this, arg); - printer.print("("); - if (n.getPairs() != null) { - for (Iterator i = n.getPairs().iterator(); i.hasNext();) { - MemberValuePair m = i.next(); - m.accept(this, arg); - if (i.hasNext()) { - printer.print(", "); - } - } - } - printer.print(")"); - } - - public void visit(MemberValuePair n, Object arg) { - printer.print(n.getName()); - printer.print(" = "); - n.getValue().accept(this, arg); - } - - public void visit(LineComment n, Object arg) { - printer.print("//"); - printer.printLn(n.getContent()); - } - - public void visit(BlockComment n, Object arg) { - printer.print("/*"); - printer.print(n.getContent()); - printer.printLn("*/"); - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/GenericVisitor.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/GenericVisitor.java deleted file mode 100644 index 118da0c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/GenericVisitor.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.visitor; - -import japa.parser.ast.BlockComment; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.ImportDeclaration; -import japa.parser.ast.LineComment; -import japa.parser.ast.Node; -import japa.parser.ast.PackageDeclaration; -import japa.parser.ast.TypeParameter; -import japa.parser.ast.body.AnnotationDeclaration; -import japa.parser.ast.body.AnnotationMemberDeclaration; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.ConstructorDeclaration; -import japa.parser.ast.body.EmptyMemberDeclaration; -import japa.parser.ast.body.EmptyTypeDeclaration; -import japa.parser.ast.body.EnumConstantDeclaration; -import japa.parser.ast.body.EnumDeclaration; -import japa.parser.ast.body.FieldDeclaration; -import japa.parser.ast.body.InitializerDeclaration; -import japa.parser.ast.body.JavadocComment; -import japa.parser.ast.body.MethodDeclaration; -import japa.parser.ast.body.Parameter; -import japa.parser.ast.body.VariableDeclarator; -import japa.parser.ast.body.VariableDeclaratorId; -import japa.parser.ast.expr.ArrayAccessExpr; -import japa.parser.ast.expr.ArrayCreationExpr; -import japa.parser.ast.expr.ArrayInitializerExpr; -import japa.parser.ast.expr.AssignExpr; -import japa.parser.ast.expr.BinaryExpr; -import japa.parser.ast.expr.BooleanLiteralExpr; -import japa.parser.ast.expr.CastExpr; -import japa.parser.ast.expr.CharLiteralExpr; -import japa.parser.ast.expr.ClassExpr; -import japa.parser.ast.expr.ConditionalExpr; -import japa.parser.ast.expr.DoubleLiteralExpr; -import japa.parser.ast.expr.EnclosedExpr; -import japa.parser.ast.expr.FieldAccessExpr; -import japa.parser.ast.expr.InstanceOfExpr; -import japa.parser.ast.expr.IntegerLiteralExpr; -import japa.parser.ast.expr.IntegerLiteralMinValueExpr; -import japa.parser.ast.expr.LongLiteralExpr; -import japa.parser.ast.expr.LongLiteralMinValueExpr; -import japa.parser.ast.expr.MarkerAnnotationExpr; -import japa.parser.ast.expr.MemberValuePair; -import japa.parser.ast.expr.MethodCallExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.expr.NormalAnnotationExpr; -import japa.parser.ast.expr.NullLiteralExpr; -import japa.parser.ast.expr.ObjectCreationExpr; -import japa.parser.ast.expr.QualifiedNameExpr; -import japa.parser.ast.expr.SingleMemberAnnotationExpr; -import japa.parser.ast.expr.StringLiteralExpr; -import japa.parser.ast.expr.SuperExpr; -import japa.parser.ast.expr.SuperMemberAccessExpr; -import japa.parser.ast.expr.ThisExpr; -import japa.parser.ast.expr.UnaryExpr; -import japa.parser.ast.expr.VariableDeclarationExpr; -import japa.parser.ast.stmt.AssertStmt; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.stmt.BreakStmt; -import japa.parser.ast.stmt.CatchClause; -import japa.parser.ast.stmt.ContinueStmt; -import japa.parser.ast.stmt.DoStmt; -import japa.parser.ast.stmt.EmptyStmt; -import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; -import japa.parser.ast.stmt.ExpressionStmt; -import japa.parser.ast.stmt.ForStmt; -import japa.parser.ast.stmt.ForeachStmt; -import japa.parser.ast.stmt.IfStmt; -import japa.parser.ast.stmt.LabeledStmt; -import japa.parser.ast.stmt.ReturnStmt; -import japa.parser.ast.stmt.SwitchEntryStmt; -import japa.parser.ast.stmt.SwitchStmt; -import japa.parser.ast.stmt.SynchronizedStmt; -import japa.parser.ast.stmt.ThrowStmt; -import japa.parser.ast.stmt.TryStmt; -import japa.parser.ast.stmt.TypeDeclarationStmt; -import japa.parser.ast.stmt.WhileStmt; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; - -/** - * @author Julio Vilmar Gesser - */ -public interface GenericVisitor { - - public R visit(Node n, A arg); - - //- Compilation Unit ---------------------------------- - - public R visit(CompilationUnit n, A arg); - - public R visit(PackageDeclaration n, A arg); - - public R visit(ImportDeclaration n, A arg); - - public R visit(TypeParameter n, A arg); - - public R visit(LineComment n, A arg); - - public R visit(BlockComment n, A arg); - - //- Body ---------------------------------------------- - - public R visit(ClassOrInterfaceDeclaration n, A arg); - - public R visit(EnumDeclaration n, A arg); - - public R visit(EmptyTypeDeclaration n, A arg); - - public R visit(EnumConstantDeclaration n, A arg); - - public R visit(AnnotationDeclaration n, A arg); - - public R visit(AnnotationMemberDeclaration n, A arg); - - public R visit(FieldDeclaration n, A arg); - - public R visit(VariableDeclarator n, A arg); - - public R visit(VariableDeclaratorId n, A arg); - - public R visit(ConstructorDeclaration n, A arg); - - public R visit(MethodDeclaration n, A arg); - - public R visit(Parameter n, A arg); - - public R visit(EmptyMemberDeclaration n, A arg); - - public R visit(InitializerDeclaration n, A arg); - - public R visit(JavadocComment n, A arg); - - //- Type ---------------------------------------------- - - public R visit(ClassOrInterfaceType n, A arg); - - public R visit(PrimitiveType n, A arg); - - public R visit(ReferenceType n, A arg); - - public R visit(VoidType n, A arg); - - public R visit(WildcardType n, A arg); - - //- Expression ---------------------------------------- - - public R visit(ArrayAccessExpr n, A arg); - - public R visit(ArrayCreationExpr n, A arg); - - public R visit(ArrayInitializerExpr n, A arg); - - public R visit(AssignExpr n, A arg); - - public R visit(BinaryExpr n, A arg); - - public R visit(CastExpr n, A arg); - - public R visit(ClassExpr n, A arg); - - public R visit(ConditionalExpr n, A arg); - - public R visit(EnclosedExpr n, A arg); - - public R visit(FieldAccessExpr n, A arg); - - public R visit(InstanceOfExpr n, A arg); - - public R visit(StringLiteralExpr n, A arg); - - public R visit(IntegerLiteralExpr n, A arg); - - public R visit(LongLiteralExpr n, A arg); - - public R visit(IntegerLiteralMinValueExpr n, A arg); - - public R visit(LongLiteralMinValueExpr n, A arg); - - public R visit(CharLiteralExpr n, A arg); - - public R visit(DoubleLiteralExpr n, A arg); - - public R visit(BooleanLiteralExpr n, A arg); - - public R visit(NullLiteralExpr n, A arg); - - public R visit(MethodCallExpr n, A arg); - - public R visit(NameExpr n, A arg); - - public R visit(ObjectCreationExpr n, A arg); - - public R visit(QualifiedNameExpr n, A arg); - - public R visit(SuperMemberAccessExpr n, A arg); - - public R visit(ThisExpr n, A arg); - - public R visit(SuperExpr n, A arg); - - public R visit(UnaryExpr n, A arg); - - public R visit(VariableDeclarationExpr n, A arg); - - public R visit(MarkerAnnotationExpr n, A arg); - - public R visit(SingleMemberAnnotationExpr n, A arg); - - public R visit(NormalAnnotationExpr n, A arg); - - public R visit(MemberValuePair n, A arg); - - //- Statements ---------------------------------------- - - public R visit(ExplicitConstructorInvocationStmt n, A arg); - - public R visit(TypeDeclarationStmt n, A arg); - - public R visit(AssertStmt n, A arg); - - public R visit(BlockStmt n, A arg); - - public R visit(LabeledStmt n, A arg); - - public R visit(EmptyStmt n, A arg); - - public R visit(ExpressionStmt n, A arg); - - public R visit(SwitchStmt n, A arg); - - public R visit(SwitchEntryStmt n, A arg); - - public R visit(BreakStmt n, A arg); - - public R visit(ReturnStmt n, A arg); - - public R visit(IfStmt n, A arg); - - public R visit(WhileStmt n, A arg); - - public R visit(ContinueStmt n, A arg); - - public R visit(DoStmt n, A arg); - - public R visit(ForeachStmt n, A arg); - - public R visit(ForStmt n, A arg); - - public R visit(ThrowStmt n, A arg); - - public R visit(SynchronizedStmt n, A arg); - - public R visit(TryStmt n, A arg); - - public R visit(CatchClause n, A arg); - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/GenericVisitorAdapter.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/GenericVisitorAdapter.java deleted file mode 100644 index 7a6f3fe..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/GenericVisitorAdapter.java +++ /dev/null @@ -1,839 +0,0 @@ -/* - * Copyright (C) 2008 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 09/06/2008 - */ -package japa.parser.ast.visitor; - -import japa.parser.ast.BlockComment; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.ImportDeclaration; -import japa.parser.ast.LineComment; -import japa.parser.ast.Node; -import japa.parser.ast.PackageDeclaration; -import japa.parser.ast.TypeParameter; -import japa.parser.ast.body.AnnotationDeclaration; -import japa.parser.ast.body.AnnotationMemberDeclaration; -import japa.parser.ast.body.BodyDeclaration; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.ConstructorDeclaration; -import japa.parser.ast.body.EmptyMemberDeclaration; -import japa.parser.ast.body.EmptyTypeDeclaration; -import japa.parser.ast.body.EnumConstantDeclaration; -import japa.parser.ast.body.EnumDeclaration; -import japa.parser.ast.body.FieldDeclaration; -import japa.parser.ast.body.InitializerDeclaration; -import japa.parser.ast.body.JavadocComment; -import japa.parser.ast.body.MethodDeclaration; -import japa.parser.ast.body.Parameter; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.body.VariableDeclarator; -import japa.parser.ast.body.VariableDeclaratorId; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.ArrayAccessExpr; -import japa.parser.ast.expr.ArrayCreationExpr; -import japa.parser.ast.expr.ArrayInitializerExpr; -import japa.parser.ast.expr.AssignExpr; -import japa.parser.ast.expr.BinaryExpr; -import japa.parser.ast.expr.BooleanLiteralExpr; -import japa.parser.ast.expr.CastExpr; -import japa.parser.ast.expr.CharLiteralExpr; -import japa.parser.ast.expr.ClassExpr; -import japa.parser.ast.expr.ConditionalExpr; -import japa.parser.ast.expr.DoubleLiteralExpr; -import japa.parser.ast.expr.EnclosedExpr; -import japa.parser.ast.expr.Expression; -import japa.parser.ast.expr.FieldAccessExpr; -import japa.parser.ast.expr.InstanceOfExpr; -import japa.parser.ast.expr.IntegerLiteralExpr; -import japa.parser.ast.expr.IntegerLiteralMinValueExpr; -import japa.parser.ast.expr.LongLiteralExpr; -import japa.parser.ast.expr.LongLiteralMinValueExpr; -import japa.parser.ast.expr.MarkerAnnotationExpr; -import japa.parser.ast.expr.MemberValuePair; -import japa.parser.ast.expr.MethodCallExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.expr.NormalAnnotationExpr; -import japa.parser.ast.expr.NullLiteralExpr; -import japa.parser.ast.expr.ObjectCreationExpr; -import japa.parser.ast.expr.QualifiedNameExpr; -import japa.parser.ast.expr.SingleMemberAnnotationExpr; -import japa.parser.ast.expr.StringLiteralExpr; -import japa.parser.ast.expr.SuperExpr; -import japa.parser.ast.expr.SuperMemberAccessExpr; -import japa.parser.ast.expr.ThisExpr; -import japa.parser.ast.expr.UnaryExpr; -import japa.parser.ast.expr.VariableDeclarationExpr; -import japa.parser.ast.stmt.AssertStmt; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.stmt.BreakStmt; -import japa.parser.ast.stmt.CatchClause; -import japa.parser.ast.stmt.ContinueStmt; -import japa.parser.ast.stmt.DoStmt; -import japa.parser.ast.stmt.EmptyStmt; -import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; -import japa.parser.ast.stmt.ExpressionStmt; -import japa.parser.ast.stmt.ForStmt; -import japa.parser.ast.stmt.ForeachStmt; -import japa.parser.ast.stmt.IfStmt; -import japa.parser.ast.stmt.LabeledStmt; -import japa.parser.ast.stmt.ReturnStmt; -import japa.parser.ast.stmt.Statement; -import japa.parser.ast.stmt.SwitchEntryStmt; -import japa.parser.ast.stmt.SwitchStmt; -import japa.parser.ast.stmt.SynchronizedStmt; -import japa.parser.ast.stmt.ThrowStmt; -import japa.parser.ast.stmt.TryStmt; -import japa.parser.ast.stmt.TypeDeclarationStmt; -import japa.parser.ast.stmt.WhileStmt; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; - -/** - * @author Julio Vilmar Gesser - */ -public class GenericVisitorAdapter implements GenericVisitor { - - public R visit(AnnotationDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getMembers() != null) { - for (BodyDeclaration member : n.getMembers()) { - member.accept(this, arg); - } - } - return null; - } - - public R visit(AnnotationMemberDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - if (n.getDefaultValue() != null) { - n.getDefaultValue().accept(this, arg); - } - return null; - } - - public R visit(ArrayAccessExpr n, A arg) { - n.getName().accept(this, arg); - n.getIndex().accept(this, arg); - return null; - } - - public R visit(ArrayCreationExpr n, A arg) { - n.getType().accept(this, arg); - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - if (n.getDimensions() != null) { - for (Expression dim : n.getDimensions()) { - dim.accept(this, arg); - } - } else { - n.getInitializer().accept(this, arg); - } - return null; - } - - public R visit(ArrayInitializerExpr n, A arg) { - if (n.getValues() != null) { - for (Expression expr : n.getValues()) { - expr.accept(this, arg); - } - } - return null; - } - - public R visit(AssertStmt n, A arg) { - n.getCheck().accept(this, arg); - if (n.getMessage() != null) { - n.getMessage().accept(this, arg); - } - return null; - } - - public R visit(AssignExpr n, A arg) { - n.getTarget().accept(this, arg); - n.getValue().accept(this, arg); - return null; - } - - public R visit(BinaryExpr n, A arg) { - n.getLeft().accept(this, arg); - n.getRight().accept(this, arg); - return null; - } - - public R visit(BlockComment n, A arg) { - return null; - } - - public R visit(BlockStmt n, A arg) { - if (n.getStmts() != null) { - for (Statement s : n.getStmts()) { - s.accept(this, arg); - } - } - return null; - - } - - public R visit(BooleanLiteralExpr n, A arg) { - return null; - } - - public R visit(BreakStmt n, A arg) { - return null; - } - - public R visit(CastExpr n, A arg) { - n.getType().accept(this, arg); - n.getExpr().accept(this, arg); - return null; - } - - public R visit(CatchClause n, A arg) { - n.getExcept().accept(this, arg); - n.getCatchBlock().accept(this, arg); - return null; - - } - - public R visit(CharLiteralExpr n, A arg) { - return null; - } - - public R visit(ClassExpr n, A arg) { - n.getType().accept(this, arg); - return null; - } - - public R visit(ClassOrInterfaceDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getTypeParameters() != null) { - for (TypeParameter t : n.getTypeParameters()) { - t.accept(this, arg); - } - } - if (n.getExtends() != null) { - for (ClassOrInterfaceType c : n.getExtends()) { - c.accept(this, arg); - } - } - - if (n.getImplements() != null) { - for (ClassOrInterfaceType c : n.getImplements()) { - c.accept(this, arg); - } - } - if (n.getMembers() != null) { - for (BodyDeclaration member : n.getMembers()) { - member.accept(this, arg); - } - } - return null; - } - - public R visit(ClassOrInterfaceType n, A arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - return null; - } - - public R visit(CompilationUnit n, A arg) { - if (n.getPakage() != null) { - n.getPakage().accept(this, arg); - } - if (n.getImports() != null) { - for (ImportDeclaration i : n.getImports()) { - i.accept(this, arg); - } - } - if (n.getTypes() != null) { - for (TypeDeclaration typeDeclaration : n.getTypes()) { - typeDeclaration.accept(this, arg); - } - } - return null; - } - - public R visit(ConditionalExpr n, A arg) { - n.getCondition().accept(this, arg); - n.getThenExpr().accept(this, arg); - n.getElseExpr().accept(this, arg); - return null; - } - - public R visit(ConstructorDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getTypeParameters() != null) { - for (TypeParameter t : n.getTypeParameters()) { - t.accept(this, arg); - } - } - if (n.getParameters() != null) { - for (Parameter p : n.getParameters()) { - p.accept(this, arg); - } - } - if (n.getThrows() != null) { - for (NameExpr name : n.getThrows()) { - name.accept(this, arg); - } - } - n.getBlock().accept(this, arg); - return null; - } - - public R visit(ContinueStmt n, A arg) { - return null; - } - - public R visit(DoStmt n, A arg) { - n.getBody().accept(this, arg); - n.getCondition().accept(this, arg); - return null; - } - - public R visit(DoubleLiteralExpr n, A arg) { - return null; - } - - public R visit(EmptyMemberDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - return null; - } - - public R visit(EmptyStmt n, A arg) { - return null; - } - - public R visit(EmptyTypeDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - return null; - } - - public R visit(EnclosedExpr n, A arg) { - n.getInner().accept(this, arg); - return null; - } - - public R visit(EnumConstantDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - if (n.getClassBody() != null) { - for (BodyDeclaration member : n.getClassBody()) { - member.accept(this, arg); - } - } - return null; - } - - public R visit(EnumDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getImplements() != null) { - for (ClassOrInterfaceType c : n.getImplements()) { - c.accept(this, arg); - } - } - if (n.getEntries() != null) { - for (EnumConstantDeclaration e : n.getEntries()) { - e.accept(this, arg); - } - } - if (n.getMembers() != null) { - for (BodyDeclaration member : n.getMembers()) { - member.accept(this, arg); - } - } - return null; - } - - public R visit(ExplicitConstructorInvocationStmt n, A arg) { - if (!n.isThis()) { - if (n.getExpr() != null) { - n.getExpr().accept(this, arg); - } - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - return null; - } - - public R visit(ExpressionStmt n, A arg) { - n.getExpression().accept(this, arg); - return null; - } - - public R visit(FieldAccessExpr n, A arg) { - n.getScope().accept(this, arg); - return null; - } - - public R visit(FieldDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - for (VariableDeclarator var : n.getVariables()) { - var.accept(this, arg); - } - return null; - } - - public R visit(ForeachStmt n, A arg) { - n.getVariable().accept(this, arg); - n.getIterable().accept(this, arg); - n.getBody().accept(this, arg); - return null; - } - - public R visit(ForStmt n, A arg) { - if (n.getInit() != null) { - for (Expression e : n.getInit()) { - e.accept(this, arg); - } - } - if (n.getCompare() != null) { - n.getCompare().accept(this, arg); - } - if (n.getUpdate() != null) { - for (Expression e : n.getUpdate()) { - e.accept(this, arg); - } - } - n.getBody().accept(this, arg); - return null; - } - - public R visit(IfStmt n, A arg) { - n.getCondition().accept(this, arg); - n.getThenStmt().accept(this, arg); - if (n.getElseStmt() != null) { - n.getElseStmt().accept(this, arg); - } - return null; - } - - public R visit(ImportDeclaration n, A arg) { - n.getName().accept(this, arg); - return null; - } - - public R visit(InitializerDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - n.getBlock().accept(this, arg); - return null; - } - - public R visit(InstanceOfExpr n, A arg) { - n.getExpr().accept(this, arg); - n.getType().accept(this, arg); - return null; - } - - public R visit(IntegerLiteralExpr n, A arg) { - return null; - } - - public R visit(IntegerLiteralMinValueExpr n, A arg) { - return null; - } - - public R visit(JavadocComment n, A arg) { - return null; - } - - public R visit(LabeledStmt n, A arg) { - n.getStmt().accept(this, arg); - return null; - } - - public R visit(LineComment n, A arg) { - return null; - } - - public R visit(LongLiteralExpr n, A arg) { - return null; - } - - public R visit(LongLiteralMinValueExpr n, A arg) { - return null; - } - - public R visit(MarkerAnnotationExpr n, A arg) { - n.getName().accept(this, arg); - return null; - } - - public R visit(MemberValuePair n, A arg) { - n.getValue().accept(this, arg); - return null; - } - - public R visit(MethodCallExpr n, A arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - return null; - } - - public R visit(MethodDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getTypeParameters() != null) { - for (TypeParameter t : n.getTypeParameters()) { - t.accept(this, arg); - } - } - n.getType().accept(this, arg); - if (n.getParameters() != null) { - for (Parameter p : n.getParameters()) { - p.accept(this, arg); - } - } - if (n.getThrows() != null) { - for (NameExpr name : n.getThrows()) { - name.accept(this, arg); - } - } - if (n.getBody() != null) { - n.getBody().accept(this, arg); - } - return null; - } - - public R visit(NameExpr n, A arg) { - return null; - } - - public R visit(Node n, A arg) { - throw new IllegalStateException(n.getClass().getName()); - } - - public R visit(NormalAnnotationExpr n, A arg) { - n.getName().accept(this, arg); - if (n.getPairs() != null) { - for (MemberValuePair m : n.getPairs()) { - m.accept(this, arg); - } - } - return null; - } - - public R visit(NullLiteralExpr n, A arg) { - return null; - } - - public R visit(ObjectCreationExpr n, A arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - n.getType().accept(this, arg); - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - if (n.getAnonymousClassBody() != null) { - for (BodyDeclaration member : n.getAnonymousClassBody()) { - member.accept(this, arg); - } - } - return null; - } - - public R visit(PackageDeclaration n, A arg) { - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getName().accept(this, arg); - return null; - } - - public R visit(Parameter n, A arg) { - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - n.getId().accept(this, arg); - return null; - } - - public R visit(PrimitiveType n, A arg) { - return null; - } - - public R visit(QualifiedNameExpr n, A arg) { - n.getQualifier().accept(this, arg); - return null; - } - - public R visit(ReferenceType n, A arg) { - n.getType().accept(this, arg); - return null; - } - - public R visit(ReturnStmt n, A arg) { - if (n.getExpr() != null) { - n.getExpr().accept(this, arg); - } - return null; - } - - public R visit(SingleMemberAnnotationExpr n, A arg) { - n.getName().accept(this, arg); - n.getMemberValue().accept(this, arg); - return null; - } - - public R visit(StringLiteralExpr n, A arg) { - return null; - } - - public R visit(SuperExpr n, A arg) { - if (n.getClassExpr() != null) { - n.getClassExpr().accept(this, arg); - } - return null; - } - - public R visit(SuperMemberAccessExpr n, A arg) { - return null; - } - - public R visit(SwitchEntryStmt n, A arg) { - if (n.getLabel() != null) { - n.getLabel().accept(this, arg); - } - if (n.getStmts() != null) { - for (Statement s : n.getStmts()) { - s.accept(this, arg); - } - } - return null; - } - - public R visit(SwitchStmt n, A arg) { - n.getSelector().accept(this, arg); - if (n.getEntries() != null) { - for (SwitchEntryStmt e : n.getEntries()) { - e.accept(this, arg); - } - } - return null; - - } - - public R visit(SynchronizedStmt n, A arg) { - n.getExpr().accept(this, arg); - n.getBlock().accept(this, arg); - return null; - } - - public R visit(ThisExpr n, A arg) { - if (n.getClassExpr() != null) { - n.getClassExpr().accept(this, arg); - } - return null; - } - - public R visit(ThrowStmt n, A arg) { - n.getExpr().accept(this, arg); - return null; - } - - public R visit(TryStmt n, A arg) { - n.getTryBlock().accept(this, arg); - if (n.getCatchs() != null) { - for (CatchClause c : n.getCatchs()) { - c.accept(this, arg); - } - } - if (n.getFinallyBlock() != null) { - n.getFinallyBlock().accept(this, arg); - } - return null; - } - - public R visit(TypeDeclarationStmt n, A arg) { - n.getTypeDeclaration().accept(this, arg); - return null; - } - - public R visit(TypeParameter n, A arg) { - if (n.getTypeBound() != null) { - for (ClassOrInterfaceType c : n.getTypeBound()) { - c.accept(this, arg); - } - } - return null; - } - - public R visit(UnaryExpr n, A arg) { - n.getExpr().accept(this, arg); - return null; - } - - public R visit(VariableDeclarationExpr n, A arg) { - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - for (VariableDeclarator v : n.getVars()) { - v.accept(this, arg); - } - return null; - } - - public R visit(VariableDeclarator n, A arg) { - n.getId().accept(this, arg); - if (n.getInit() != null) { - n.getInit().accept(this, arg); - } - return null; - } - - public R visit(VariableDeclaratorId n, A arg) { - return null; - } - - public R visit(VoidType n, A arg) { - return null; - } - - public R visit(WhileStmt n, A arg) { - n.getCondition().accept(this, arg); - n.getBody().accept(this, arg); - return null; - } - - public R visit(WildcardType n, A arg) { - if (n.getExtends() != null) { - n.getExtends().accept(this, arg); - } - if (n.getSuper() != null) { - n.getSuper().accept(this, arg); - } - return null; - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/VoidVisitor.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/VoidVisitor.java deleted file mode 100644 index 2fdc916..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/VoidVisitor.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 05/10/2006 - */ -package japa.parser.ast.visitor; - -import japa.parser.ast.BlockComment; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.ImportDeclaration; -import japa.parser.ast.LineComment; -import japa.parser.ast.Node; -import japa.parser.ast.PackageDeclaration; -import japa.parser.ast.TypeParameter; -import japa.parser.ast.body.AnnotationDeclaration; -import japa.parser.ast.body.AnnotationMemberDeclaration; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.ConstructorDeclaration; -import japa.parser.ast.body.EmptyMemberDeclaration; -import japa.parser.ast.body.EmptyTypeDeclaration; -import japa.parser.ast.body.EnumConstantDeclaration; -import japa.parser.ast.body.EnumDeclaration; -import japa.parser.ast.body.FieldDeclaration; -import japa.parser.ast.body.InitializerDeclaration; -import japa.parser.ast.body.JavadocComment; -import japa.parser.ast.body.MethodDeclaration; -import japa.parser.ast.body.Parameter; -import japa.parser.ast.body.VariableDeclarator; -import japa.parser.ast.body.VariableDeclaratorId; -import japa.parser.ast.expr.ArrayAccessExpr; -import japa.parser.ast.expr.ArrayCreationExpr; -import japa.parser.ast.expr.ArrayInitializerExpr; -import japa.parser.ast.expr.AssignExpr; -import japa.parser.ast.expr.BinaryExpr; -import japa.parser.ast.expr.BooleanLiteralExpr; -import japa.parser.ast.expr.CastExpr; -import japa.parser.ast.expr.CharLiteralExpr; -import japa.parser.ast.expr.ClassExpr; -import japa.parser.ast.expr.ConditionalExpr; -import japa.parser.ast.expr.DoubleLiteralExpr; -import japa.parser.ast.expr.EnclosedExpr; -import japa.parser.ast.expr.FieldAccessExpr; -import japa.parser.ast.expr.InstanceOfExpr; -import japa.parser.ast.expr.IntegerLiteralExpr; -import japa.parser.ast.expr.IntegerLiteralMinValueExpr; -import japa.parser.ast.expr.LongLiteralExpr; -import japa.parser.ast.expr.LongLiteralMinValueExpr; -import japa.parser.ast.expr.MarkerAnnotationExpr; -import japa.parser.ast.expr.MemberValuePair; -import japa.parser.ast.expr.MethodCallExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.expr.NormalAnnotationExpr; -import japa.parser.ast.expr.NullLiteralExpr; -import japa.parser.ast.expr.ObjectCreationExpr; -import japa.parser.ast.expr.QualifiedNameExpr; -import japa.parser.ast.expr.SingleMemberAnnotationExpr; -import japa.parser.ast.expr.StringLiteralExpr; -import japa.parser.ast.expr.SuperExpr; -import japa.parser.ast.expr.SuperMemberAccessExpr; -import japa.parser.ast.expr.ThisExpr; -import japa.parser.ast.expr.UnaryExpr; -import japa.parser.ast.expr.VariableDeclarationExpr; -import japa.parser.ast.stmt.AssertStmt; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.stmt.BreakStmt; -import japa.parser.ast.stmt.CatchClause; -import japa.parser.ast.stmt.ContinueStmt; -import japa.parser.ast.stmt.DoStmt; -import japa.parser.ast.stmt.EmptyStmt; -import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; -import japa.parser.ast.stmt.ExpressionStmt; -import japa.parser.ast.stmt.ForStmt; -import japa.parser.ast.stmt.ForeachStmt; -import japa.parser.ast.stmt.IfStmt; -import japa.parser.ast.stmt.LabeledStmt; -import japa.parser.ast.stmt.ReturnStmt; -import japa.parser.ast.stmt.SwitchEntryStmt; -import japa.parser.ast.stmt.SwitchStmt; -import japa.parser.ast.stmt.SynchronizedStmt; -import japa.parser.ast.stmt.ThrowStmt; -import japa.parser.ast.stmt.TryStmt; -import japa.parser.ast.stmt.TypeDeclarationStmt; -import japa.parser.ast.stmt.WhileStmt; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; - -/** - * @author Julio Vilmar Gesser - */ -public interface VoidVisitor { - - public void visit(Node n, A arg); - - //- Compilation Unit ---------------------------------- - - public void visit(CompilationUnit n, A arg); - - public void visit(PackageDeclaration n, A arg); - - public void visit(ImportDeclaration n, A arg); - - public void visit(TypeParameter n, A arg); - - public void visit(LineComment n, A arg); - - public void visit(BlockComment n, A arg); - - //- Body ---------------------------------------------- - - public void visit(ClassOrInterfaceDeclaration n, A arg); - - public void visit(EnumDeclaration n, A arg); - - public void visit(EmptyTypeDeclaration n, A arg); - - public void visit(EnumConstantDeclaration n, A arg); - - public void visit(AnnotationDeclaration n, A arg); - - public void visit(AnnotationMemberDeclaration n, A arg); - - public void visit(FieldDeclaration n, A arg); - - public void visit(VariableDeclarator n, A arg); - - public void visit(VariableDeclaratorId n, A arg); - - public void visit(ConstructorDeclaration n, A arg); - - public void visit(MethodDeclaration n, A arg); - - public void visit(Parameter n, A arg); - - public void visit(EmptyMemberDeclaration n, A arg); - - public void visit(InitializerDeclaration n, A arg); - - public void visit(JavadocComment n, A arg); - - //- Type ---------------------------------------------- - - public void visit(ClassOrInterfaceType n, A arg); - - public void visit(PrimitiveType n, A arg); - - public void visit(ReferenceType n, A arg); - - public void visit(VoidType n, A arg); - - public void visit(WildcardType n, A arg); - - //- Expression ---------------------------------------- - - public void visit(ArrayAccessExpr n, A arg); - - public void visit(ArrayCreationExpr n, A arg); - - public void visit(ArrayInitializerExpr n, A arg); - - public void visit(AssignExpr n, A arg); - - public void visit(BinaryExpr n, A arg); - - public void visit(CastExpr n, A arg); - - public void visit(ClassExpr n, A arg); - - public void visit(ConditionalExpr n, A arg); - - public void visit(EnclosedExpr n, A arg); - - public void visit(FieldAccessExpr n, A arg); - - public void visit(InstanceOfExpr n, A arg); - - public void visit(StringLiteralExpr n, A arg); - - public void visit(IntegerLiteralExpr n, A arg); - - public void visit(LongLiteralExpr n, A arg); - - public void visit(IntegerLiteralMinValueExpr n, A arg); - - public void visit(LongLiteralMinValueExpr n, A arg); - - public void visit(CharLiteralExpr n, A arg); - - public void visit(DoubleLiteralExpr n, A arg); - - public void visit(BooleanLiteralExpr n, A arg); - - public void visit(NullLiteralExpr n, A arg); - - public void visit(MethodCallExpr n, A arg); - - public void visit(NameExpr n, A arg); - - public void visit(ObjectCreationExpr n, A arg); - - public void visit(QualifiedNameExpr n, A arg); - - public void visit(SuperMemberAccessExpr n, A arg); - - public void visit(ThisExpr n, A arg); - - public void visit(SuperExpr n, A arg); - - public void visit(UnaryExpr n, A arg); - - public void visit(VariableDeclarationExpr n, A arg); - - public void visit(MarkerAnnotationExpr n, A arg); - - public void visit(SingleMemberAnnotationExpr n, A arg); - - public void visit(NormalAnnotationExpr n, A arg); - - public void visit(MemberValuePair n, A arg); - - //- Statements ---------------------------------------- - - public void visit(ExplicitConstructorInvocationStmt n, A arg); - - public void visit(TypeDeclarationStmt n, A arg); - - public void visit(AssertStmt n, A arg); - - public void visit(BlockStmt n, A arg); - - public void visit(LabeledStmt n, A arg); - - public void visit(EmptyStmt n, A arg); - - public void visit(ExpressionStmt n, A arg); - - public void visit(SwitchStmt n, A arg); - - public void visit(SwitchEntryStmt n, A arg); - - public void visit(BreakStmt n, A arg); - - public void visit(ReturnStmt n, A arg); - - public void visit(IfStmt n, A arg); - - public void visit(WhileStmt n, A arg); - - public void visit(ContinueStmt n, A arg); - - public void visit(DoStmt n, A arg); - - public void visit(ForeachStmt n, A arg); - - public void visit(ForStmt n, A arg); - - public void visit(ThrowStmt n, A arg); - - public void visit(SynchronizedStmt n, A arg); - - public void visit(TryStmt n, A arg); - - public void visit(CatchClause n, A arg); - -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/VoidVisitorAdapter.java b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/VoidVisitorAdapter.java deleted file mode 100644 index 43731c6..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/ast/visitor/VoidVisitorAdapter.java +++ /dev/null @@ -1,757 +0,0 @@ -/* - * Copyright (C) 2008 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 09/06/2008 - */ -package japa.parser.ast.visitor; - -import japa.parser.ast.BlockComment; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.ImportDeclaration; -import japa.parser.ast.LineComment; -import japa.parser.ast.Node; -import japa.parser.ast.PackageDeclaration; -import japa.parser.ast.TypeParameter; -import japa.parser.ast.body.AnnotationDeclaration; -import japa.parser.ast.body.AnnotationMemberDeclaration; -import japa.parser.ast.body.BodyDeclaration; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.ConstructorDeclaration; -import japa.parser.ast.body.EmptyMemberDeclaration; -import japa.parser.ast.body.EmptyTypeDeclaration; -import japa.parser.ast.body.EnumConstantDeclaration; -import japa.parser.ast.body.EnumDeclaration; -import japa.parser.ast.body.FieldDeclaration; -import japa.parser.ast.body.InitializerDeclaration; -import japa.parser.ast.body.JavadocComment; -import japa.parser.ast.body.MethodDeclaration; -import japa.parser.ast.body.Parameter; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.body.VariableDeclarator; -import japa.parser.ast.body.VariableDeclaratorId; -import japa.parser.ast.expr.AnnotationExpr; -import japa.parser.ast.expr.ArrayAccessExpr; -import japa.parser.ast.expr.ArrayCreationExpr; -import japa.parser.ast.expr.ArrayInitializerExpr; -import japa.parser.ast.expr.AssignExpr; -import japa.parser.ast.expr.BinaryExpr; -import japa.parser.ast.expr.BooleanLiteralExpr; -import japa.parser.ast.expr.CastExpr; -import japa.parser.ast.expr.CharLiteralExpr; -import japa.parser.ast.expr.ClassExpr; -import japa.parser.ast.expr.ConditionalExpr; -import japa.parser.ast.expr.DoubleLiteralExpr; -import japa.parser.ast.expr.EnclosedExpr; -import japa.parser.ast.expr.Expression; -import japa.parser.ast.expr.FieldAccessExpr; -import japa.parser.ast.expr.InstanceOfExpr; -import japa.parser.ast.expr.IntegerLiteralExpr; -import japa.parser.ast.expr.IntegerLiteralMinValueExpr; -import japa.parser.ast.expr.LongLiteralExpr; -import japa.parser.ast.expr.LongLiteralMinValueExpr; -import japa.parser.ast.expr.MarkerAnnotationExpr; -import japa.parser.ast.expr.MemberValuePair; -import japa.parser.ast.expr.MethodCallExpr; -import japa.parser.ast.expr.NameExpr; -import japa.parser.ast.expr.NormalAnnotationExpr; -import japa.parser.ast.expr.NullLiteralExpr; -import japa.parser.ast.expr.ObjectCreationExpr; -import japa.parser.ast.expr.QualifiedNameExpr; -import japa.parser.ast.expr.SingleMemberAnnotationExpr; -import japa.parser.ast.expr.StringLiteralExpr; -import japa.parser.ast.expr.SuperExpr; -import japa.parser.ast.expr.SuperMemberAccessExpr; -import japa.parser.ast.expr.ThisExpr; -import japa.parser.ast.expr.UnaryExpr; -import japa.parser.ast.expr.VariableDeclarationExpr; -import japa.parser.ast.stmt.AssertStmt; -import japa.parser.ast.stmt.BlockStmt; -import japa.parser.ast.stmt.BreakStmt; -import japa.parser.ast.stmt.CatchClause; -import japa.parser.ast.stmt.ContinueStmt; -import japa.parser.ast.stmt.DoStmt; -import japa.parser.ast.stmt.EmptyStmt; -import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; -import japa.parser.ast.stmt.ExpressionStmt; -import japa.parser.ast.stmt.ForStmt; -import japa.parser.ast.stmt.ForeachStmt; -import japa.parser.ast.stmt.IfStmt; -import japa.parser.ast.stmt.LabeledStmt; -import japa.parser.ast.stmt.ReturnStmt; -import japa.parser.ast.stmt.Statement; -import japa.parser.ast.stmt.SwitchEntryStmt; -import japa.parser.ast.stmt.SwitchStmt; -import japa.parser.ast.stmt.SynchronizedStmt; -import japa.parser.ast.stmt.ThrowStmt; -import japa.parser.ast.stmt.TryStmt; -import japa.parser.ast.stmt.TypeDeclarationStmt; -import japa.parser.ast.stmt.WhileStmt; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; - -/** - * @author Julio Vilmar Gesser - */ -public class VoidVisitorAdapter implements VoidVisitor { - - public void visit(AnnotationDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getMembers() != null) { - for (BodyDeclaration member : n.getMembers()) { - member.accept(this, arg); - } - } - } - - public void visit(AnnotationMemberDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - if (n.getDefaultValue() != null) { - n.getDefaultValue().accept(this, arg); - } - } - - public void visit(ArrayAccessExpr n, A arg) { - n.getName().accept(this, arg); - n.getIndex().accept(this, arg); - } - - public void visit(ArrayCreationExpr n, A arg) { - n.getType().accept(this, arg); - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - if (n.getDimensions() != null) { - for (Expression dim : n.getDimensions()) { - dim.accept(this, arg); - } - } else { - n.getInitializer().accept(this, arg); - } - } - - public void visit(ArrayInitializerExpr n, A arg) { - if (n.getValues() != null) { - for (Expression expr : n.getValues()) { - expr.accept(this, arg); - } - } - } - - public void visit(AssertStmt n, A arg) { - n.getCheck().accept(this, arg); - if (n.getMessage() != null) { - n.getMessage().accept(this, arg); - } - } - - public void visit(AssignExpr n, A arg) { - n.getTarget().accept(this, arg); - n.getValue().accept(this, arg); - } - - public void visit(BinaryExpr n, A arg) { - n.getLeft().accept(this, arg); - n.getRight().accept(this, arg); - } - - public void visit(BlockComment n, A arg) { - } - - public void visit(BlockStmt n, A arg) { - if (n.getStmts() != null) { - for (Statement s : n.getStmts()) { - s.accept(this, arg); - } - } - } - - public void visit(BooleanLiteralExpr n, A arg) { - } - - public void visit(BreakStmt n, A arg) { - } - - public void visit(CastExpr n, A arg) { - n.getType().accept(this, arg); - n.getExpr().accept(this, arg); - } - - public void visit(CatchClause n, A arg) { - n.getExcept().accept(this, arg); - n.getCatchBlock().accept(this, arg); - } - - public void visit(CharLiteralExpr n, A arg) { - } - - public void visit(ClassExpr n, A arg) { - n.getType().accept(this, arg); - } - - public void visit(ClassOrInterfaceDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getTypeParameters() != null) { - for (TypeParameter t : n.getTypeParameters()) { - t.accept(this, arg); - } - } - if (n.getExtends() != null) { - for (ClassOrInterfaceType c : n.getExtends()) { - c.accept(this, arg); - } - } - - if (n.getImplements() != null) { - for (ClassOrInterfaceType c : n.getImplements()) { - c.accept(this, arg); - } - } - if (n.getMembers() != null) { - for (BodyDeclaration member : n.getMembers()) { - member.accept(this, arg); - } - } - } - - public void visit(ClassOrInterfaceType n, A arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - } - - public void visit(CompilationUnit n, A arg) { - if (n.getPakage() != null) { - n.getPakage().accept(this, arg); - } - if (n.getImports() != null) { - for (ImportDeclaration i : n.getImports()) { - i.accept(this, arg); - } - } - if (n.getTypes() != null) { - for (TypeDeclaration typeDeclaration : n.getTypes()) { - typeDeclaration.accept(this, arg); - } - } - } - - public void visit(ConditionalExpr n, A arg) { - n.getCondition().accept(this, arg); - n.getThenExpr().accept(this, arg); - n.getElseExpr().accept(this, arg); - } - - public void visit(ConstructorDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getTypeParameters() != null) { - for (TypeParameter t : n.getTypeParameters()) { - t.accept(this, arg); - } - } - if (n.getParameters() != null) { - for (Parameter p : n.getParameters()) { - p.accept(this, arg); - } - } - if (n.getThrows() != null) { - for (NameExpr name : n.getThrows()) { - name.accept(this, arg); - } - } - n.getBlock().accept(this, arg); - } - - public void visit(ContinueStmt n, A arg) { - } - - public void visit(DoStmt n, A arg) { - n.getBody().accept(this, arg); - n.getCondition().accept(this, arg); - } - - public void visit(DoubleLiteralExpr n, A arg) { - } - - public void visit(EmptyMemberDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - } - - public void visit(EmptyStmt n, A arg) { - } - - public void visit(EmptyTypeDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - } - - public void visit(EnclosedExpr n, A arg) { - n.getInner().accept(this, arg); - } - - public void visit(EnumConstantDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - if (n.getClassBody() != null) { - for (BodyDeclaration member : n.getClassBody()) { - member.accept(this, arg); - } - } - } - - public void visit(EnumDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getImplements() != null) { - for (ClassOrInterfaceType c : n.getImplements()) { - c.accept(this, arg); - } - } - if (n.getEntries() != null) { - for (EnumConstantDeclaration e : n.getEntries()) { - e.accept(this, arg); - } - } - if (n.getMembers() != null) { - for (BodyDeclaration member : n.getMembers()) { - member.accept(this, arg); - } - } - } - - public void visit(ExplicitConstructorInvocationStmt n, A arg) { - if (!n.isThis()) { - if (n.getExpr() != null) { - n.getExpr().accept(this, arg); - } - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - } - - public void visit(ExpressionStmt n, A arg) { - n.getExpression().accept(this, arg); - } - - public void visit(FieldAccessExpr n, A arg) { - n.getScope().accept(this, arg); - } - - public void visit(FieldDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - for (VariableDeclarator var : n.getVariables()) { - var.accept(this, arg); - } - } - - public void visit(ForeachStmt n, A arg) { - n.getVariable().accept(this, arg); - n.getIterable().accept(this, arg); - n.getBody().accept(this, arg); - } - - public void visit(ForStmt n, A arg) { - if (n.getInit() != null) { - for (Expression e : n.getInit()) { - e.accept(this, arg); - } - } - if (n.getCompare() != null) { - n.getCompare().accept(this, arg); - } - if (n.getUpdate() != null) { - for (Expression e : n.getUpdate()) { - e.accept(this, arg); - } - } - n.getBody().accept(this, arg); - } - - public void visit(IfStmt n, A arg) { - n.getCondition().accept(this, arg); - n.getThenStmt().accept(this, arg); - if (n.getElseStmt() != null) { - n.getElseStmt().accept(this, arg); - } - } - - public void visit(ImportDeclaration n, A arg) { - n.getName().accept(this, arg); - } - - public void visit(InitializerDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - n.getBlock().accept(this, arg); - } - - public void visit(InstanceOfExpr n, A arg) { - n.getExpr().accept(this, arg); - n.getType().accept(this, arg); - } - - public void visit(IntegerLiteralExpr n, A arg) { - } - - public void visit(IntegerLiteralMinValueExpr n, A arg) { - } - - public void visit(JavadocComment n, A arg) { - } - - public void visit(LabeledStmt n, A arg) { - n.getStmt().accept(this, arg); - } - - public void visit(LineComment n, A arg) { - } - - public void visit(LongLiteralExpr n, A arg) { - } - - public void visit(LongLiteralMinValueExpr n, A arg) { - } - - public void visit(MarkerAnnotationExpr n, A arg) { - n.getName().accept(this, arg); - } - - public void visit(MemberValuePair n, A arg) { - n.getValue().accept(this, arg); - } - - public void visit(MethodCallExpr n, A arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - } - - public void visit(MethodDeclaration n, A arg) { - if (n.getJavaDoc() != null) { - n.getJavaDoc().accept(this, arg); - } - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - if (n.getTypeParameters() != null) { - for (TypeParameter t : n.getTypeParameters()) { - t.accept(this, arg); - } - } - n.getType().accept(this, arg); - if (n.getParameters() != null) { - for (Parameter p : n.getParameters()) { - p.accept(this, arg); - } - } - if (n.getThrows() != null) { - for (NameExpr name : n.getThrows()) { - name.accept(this, arg); - } - } - if (n.getBody() != null) { - n.getBody().accept(this, arg); - } - } - - public void visit(NameExpr n, A arg) { - } - - public void visit(Node n, A arg) { - throw new IllegalStateException(n.getClass().getName()); - } - - public void visit(NormalAnnotationExpr n, A arg) { - n.getName().accept(this, arg); - if (n.getPairs() != null) { - for (MemberValuePair m : n.getPairs()) { - m.accept(this, arg); - } - } - } - - public void visit(NullLiteralExpr n, A arg) { - } - - public void visit(ObjectCreationExpr n, A arg) { - if (n.getScope() != null) { - n.getScope().accept(this, arg); - } - if (n.getTypeArgs() != null) { - for (Type t : n.getTypeArgs()) { - t.accept(this, arg); - } - } - n.getType().accept(this, arg); - if (n.getArgs() != null) { - for (Expression e : n.getArgs()) { - e.accept(this, arg); - } - } - if (n.getAnonymousClassBody() != null) { - for (BodyDeclaration member : n.getAnonymousClassBody()) { - member.accept(this, arg); - } - } - } - - public void visit(PackageDeclaration n, A arg) { - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getName().accept(this, arg); - } - - public void visit(Parameter n, A arg) { - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - n.getId().accept(this, arg); - } - - public void visit(PrimitiveType n, A arg) { - } - - public void visit(QualifiedNameExpr n, A arg) { - n.getQualifier().accept(this, arg); - } - - public void visit(ReferenceType n, A arg) { - n.getType().accept(this, arg); - } - - public void visit(ReturnStmt n, A arg) { - if (n.getExpr() != null) { - n.getExpr().accept(this, arg); - } - } - - public void visit(SingleMemberAnnotationExpr n, A arg) { - n.getName().accept(this, arg); - n.getMemberValue().accept(this, arg); - } - - public void visit(StringLiteralExpr n, A arg) { - } - - public void visit(SuperExpr n, A arg) { - if (n.getClassExpr() != null) { - n.getClassExpr().accept(this, arg); - } - } - - public void visit(SuperMemberAccessExpr n, A arg) { - } - - public void visit(SwitchEntryStmt n, A arg) { - if (n.getLabel() != null) { - n.getLabel().accept(this, arg); - } - if (n.getStmts() != null) { - for (Statement s : n.getStmts()) { - s.accept(this, arg); - } - } - } - - public void visit(SwitchStmt n, A arg) { - n.getSelector().accept(this, arg); - if (n.getEntries() != null) { - for (SwitchEntryStmt e : n.getEntries()) { - e.accept(this, arg); - } - } - } - - public void visit(SynchronizedStmt n, A arg) { - n.getExpr().accept(this, arg); - n.getBlock().accept(this, arg); - - } - - public void visit(ThisExpr n, A arg) { - if (n.getClassExpr() != null) { - n.getClassExpr().accept(this, arg); - } - } - - public void visit(ThrowStmt n, A arg) { - n.getExpr().accept(this, arg); - } - - public void visit(TryStmt n, A arg) { - n.getTryBlock().accept(this, arg); - if (n.getCatchs() != null) { - for (CatchClause c : n.getCatchs()) { - c.accept(this, arg); - } - } - if (n.getFinallyBlock() != null) { - n.getFinallyBlock().accept(this, arg); - } - } - - public void visit(TypeDeclarationStmt n, A arg) { - n.getTypeDeclaration().accept(this, arg); - } - - public void visit(TypeParameter n, A arg) { - if (n.getTypeBound() != null) { - for (ClassOrInterfaceType c : n.getTypeBound()) { - c.accept(this, arg); - } - } - } - - public void visit(UnaryExpr n, A arg) { - n.getExpr().accept(this, arg); - } - - public void visit(VariableDeclarationExpr n, A arg) { - if (n.getAnnotations() != null) { - for (AnnotationExpr a : n.getAnnotations()) { - a.accept(this, arg); - } - } - n.getType().accept(this, arg); - for (VariableDeclarator v : n.getVars()) { - v.accept(this, arg); - } - } - - public void visit(VariableDeclarator n, A arg) { - n.getId().accept(this, arg); - if (n.getInit() != null) { - n.getInit().accept(this, arg); - } - } - - public void visit(VariableDeclaratorId n, A arg) { - } - - public void visit(VoidType n, A arg) { - } - - public void visit(WhileStmt n, A arg) { - n.getCondition().accept(this, arg); - n.getBody().accept(this, arg); - } - - public void visit(WildcardType n, A arg) { - if (n.getExtends() != null) { - n.getExtends().accept(this, arg); - } - if (n.getSuper() != null) { - n.getSuper().accept(this, arg); - } - } -} diff --git a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/java_1_5.jj b/Assignment-2/javaparser-1.0.0-src/src/japa/parser/java_1_5.jj deleted file mode 100644 index d780e97..0000000 --- a/Assignment-2/javaparser-1.0.0-src/src/japa/parser/java_1_5.jj +++ /dev/null @@ -1,3027 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ - -options { - LOOKAHEAD=1; - STATIC=false; - CACHE_TOKENS=true; - ERROR_REPORTING = true; - JAVA_UNICODE_ESCAPE=true; - DEBUG_PARSER=false; - DEBUG_LOOKAHEAD=false; - DEBUG_TOKEN_MANAGER=false; - COMMON_TOKEN_ACTION=true; -} - -PARSER_BEGIN(JavaParser) -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -package japa.parser; - -import java.io.*; -import java.util.*; -import japa.parser.ast.*; -import japa.parser.ast.body.*; -import japa.parser.ast.expr.*; -import japa.parser.ast.stmt.*; -import japa.parser.ast.type.*; - -/** - *

This class was generated automatically by javacc, do not edit.

- *

Parse Java 1.5 source code and creates Abstract Syntax Tree classes.

- *

Note: To use this parser asynchronously, disable de parser cache - * by calling the method {@link setCacheParser} with false - * as argument.

- * - * @author Júlio Vilmar Gesser - */ -public final class JavaParser { - - private static JavaParser parser; - - private static boolean cacheParser = true; - - /** - * Changes the way that the parser acts when starts to parse. If the - * parser cache is enabled, only one insance of this object will be - * used in every call to parse methods. - * If this parser is intend to be used asynchonously, the cache must - * be disabled setting this flag to false. - * By default, the cache is enabled. - * @param value false to disable the parser instance cache. - */ - public static void setCacheParser(boolean value) { - cacheParser = value; - if(!value) { - parser = null; - } - } - - /** - * Parses the Java code contained in the {@link InputStream} and returns - * a {@link CompilationUnit} that represents it. - * @param in {@link InputStream} containing Java source code - * @param encoding encoding of the source code - * @return CompilationUnit representing the Java source code - * @throws ParseException if the source code has parser errors - */ - public static CompilationUnit parse(InputStream in, String encoding) throws ParseException { - if(cacheParser) { - if (parser == null) { - parser = new JavaParser(in, encoding); - } else { - parser.reset(in, encoding); - } - return parser.CompilationUnit(); - } - return new JavaParser(in, encoding).CompilationUnit(); - } - - /** - * Parses the Java code contained in the {@link InputStream} and returns - * a {@link CompilationUnit} that represents it. - * @param in {@link InputStream} containing Java source code - * @return CompilationUnit representing the Java source code - * @throws ParseException if the source code has parser errors - */ - public static CompilationUnit parse(InputStream in) throws ParseException { - return parse(in, null); - } - - /** - * Parses the Java code contained in a {@link File} and returns - * a {@link CompilationUnit} that represents it. - * @param file {@link File} containing Java source code - * @param encoding encoding of the source code - * @return CompilationUnit representing the Java source code - * @throws ParseException if the source code has parser errors - */ - public static CompilationUnit parse(File file, String encoding) throws ParseException { - try { - FileInputStream in = new FileInputStream(file); - try { - return parse(in, encoding); - } finally { - in.close(); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Parses the Java code contained in a {@link File} and returns - * a {@link CompilationUnit} that represents it. - * @param file {@link File} containing Java source code - * @return CompilationUnit representing the Java source code - * @throws ParseException if the source code has parser errors - */ - public static CompilationUnit parse(File file) throws ParseException { - return parse(file, null); - } - - private void reset(InputStream in, String encoding) { - ReInit(in, encoding); - token_source.clearComments(); - } - - private List add(List list, Object obj) { - if (list == null) { - list = new LinkedList(); - } - list.add(obj); - return list; - } - - private class Modifier { - - final int modifiers; - final List annotations; - - public Modifier(int modifiers, List annotations) { - this.modifiers = modifiers; - this.annotations = annotations; - } - - } - - private void pushJavadoc() { - token_source.pushJavadoc(); - } - - private JavadocComment popJavadoc() { - return token_source.popJavadoc(); - } - - List getComments() { - return token_source.getComments(); - } -} - -PARSER_END(JavaParser) - -/* WHITE SPACE */ - -SKIP : -{ - " " -| "\t" -| "\n" -| "\r" -| "\f" -} - -/* COMMENTS */ - -TOKEN_MGR_DECLS : -{ - private List comments; - private final Stack javadocStack = new Stack(); - private JavadocComment lastJavadoc; - - void pushJavadoc() { - javadocStack.push(lastJavadoc); - } - - JavadocComment popJavadoc() { - return javadocStack.pop(); - } - - List getComments() { - return comments; - } - - void clearComments() { - comments = null; - javadocStack.clear(); - lastJavadoc = null; - } - - private void CommonTokenAction(Token token) { - lastJavadoc = null; - if (token.specialToken != null) { - if(comments == null) { - comments = new ArrayList(); - } - Token special = token.specialToken; - if(special.kind == JAVA_DOC_COMMENT) { - lastJavadoc = new JavadocComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(3, special.image.length()-2)); - comments.add(lastJavadoc); - } else if(special.kind == SINGLE_LINE_COMMENT) { - LineComment comment = new LineComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(2)); - comments.add(comment); - } else if(special.kind == MULTI_LINE_COMMENT) { - BlockComment comment = new BlockComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(2, special.image.length()-2)); - comments.add(comment); - } - } - } -} - -SPECIAL_TOKEN : -{ - -} - -MORE : -{ - <"/**" ~["/"]> { input_stream.backup(1); } : IN_JAVA_DOC_COMMENT -| - <"/*"> : IN_MULTI_LINE_COMMENT -} - - -SPECIAL_TOKEN : -{ - : DEFAULT -} - - -SPECIAL_TOKEN : -{ - : DEFAULT -} - - -MORE : -{ - < ~[] > -} - -/* RESERVED WORDS AND LITERALS */ - -TOKEN : -{ - < ABSTRACT: "abstract" > -| < ASSERT: "assert" > -| < BOOLEAN: "boolean" > -| < BREAK: "break" > -| < BYTE: "byte" > -| < CASE: "case" > -| < CATCH: "catch" > -| < CHAR: "char" > -| < CLASS: "class" > -| < CONST: "const" > -| < CONTINUE: "continue" > -| < _DEFAULT: "default" > -| < DO: "do" > -| < DOUBLE: "double" > -| < ELSE: "else" > -| < ENUM: "enum" > -| < EXTENDS: "extends" > -| < FALSE: "false" > -| < FINAL: "final" > -| < FINALLY: "finally" > -| < FLOAT: "float" > -| < FOR: "for" > -| < GOTO: "goto" > -| < IF: "if" > -| < IMPLEMENTS: "implements" > -| < IMPORT: "import" > -| < INSTANCEOF: "instanceof" > -| < INT: "int" > -| < INTERFACE: "interface" > -| < LONG: "long" > -| < NATIVE: "native" > -| < NEW: "new" > -| < NULL: "null" > -| < PACKAGE: "package"> -| < PRIVATE: "private" > -| < PROTECTED: "protected" > -| < PUBLIC: "public" > -| < RETURN: "return" > -| < SHORT: "short" > -| < STATIC: "static" > -| < STRICTFP: "strictfp" > -| < SUPER: "super" > -| < SWITCH: "switch" > -| < SYNCHRONIZED: "synchronized" > -| < THIS: "this" > -| < THROW: "throw" > -| < THROWS: "throws" > -| < TRANSIENT: "transient" > -| < TRUE: "true" > -| < TRY: "try" > -| < VOID: "void" > -| < VOLATILE: "volatile" > -| < WHILE: "while" > -} - -/* LITERALS */ - -TOKEN : -{ - < LONG_LITERAL: - (["l","L"]) - | (["l","L"]) - | (["l","L"]) - > -| - < INTEGER_LITERAL: - - | - | - > -| - < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > -| - < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > -| - < #OCTAL_LITERAL: "0" (["0"-"7"])* > -| - < FLOATING_POINT_LITERAL: - - | - > -| - < #DECIMAL_FLOATING_POINT_LITERAL: - (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? - | "." (["0"-"9"])+ ()? (["f","F","d","D"])? - | (["0"-"9"])+ (["f","F","d","D"])? - | (["0"-"9"])+ ()? ["f","F","d","D"] - > -| - < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > -| - < #HEXADECIMAL_FLOATING_POINT_LITERAL: - "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? - | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])? - > -| - < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > -| - < CHARACTER_LITERAL: - "'" - ( (~["'","\\","\n","\r"]) - | ("\\" - ( ["n","t","b","r","f","\\","'","\""] - | ["0"-"7"] ( ["0"-"7"] )? - | ["0"-"3"] ["0"-"7"] ["0"-"7"] - ) - ) - | ("\\u" - ["0"-"9","A"-"F","a"-"f"] - ["0"-"9","A"-"F","a"-"f"] - ["0"-"9","A"-"F","a"-"f"] - ["0"-"9","A"-"F","a"-"f"] - ) - ) - "'" - > -| - < STRING_LITERAL: - "\"" - ( (~["\"","\\","\n","\r"]) - | ("\\" - ( ["n","t","b","r","f","\\","'","\""] - | ["0"-"7"] ( ["0"-"7"] )? - | ["0"-"3"] ["0"-"7"] ["0"-"7"] - ) - ) - | ("\\u" - ["0"-"9","A"-"F","a"-"f"] - ["0"-"9","A"-"F","a"-"f"] - ["0"-"9","A"-"F","a"-"f"] - ["0"-"9","A"-"F","a"-"f"] - ) - )* - "\"" - > -} - -/* IDENTIFIERS */ - -TOKEN : -{ - < IDENTIFIER: ()* > -| - < #LETTER: - [ // all chars for which Character.isIdentifierStart is true - "\u0024", // "$" - "\u0041"-"\u005a", // "A"-"Z" - "\u005f", // "_" - "\u0061"-"\u007a", // "a"-"z" - "\u00a2"-"\u00a5", - "\u00aa", - "\u00b5", - "\u00ba", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u0236", - "\u0250"-"\u02c1", - "\u02c6"-"\u02d1", - "\u02e0"-"\u02e4", - "\u02ee", - "\u037a", - "\u0386", - "\u0388"-"\u038a", - "\u038c", - "\u038e"-"\u03a1", - "\u03a3"-"\u03ce", - "\u03d0"-"\u03f5", - "\u03f7"-"\u03fb", - "\u0400"-"\u0481", - "\u048a"-"\u04ce", - "\u04d0"-"\u04f5", - "\u04f8"-"\u04f9", - "\u0500"-"\u050f", - "\u0531"-"\u0556", - "\u0559", - "\u0561"-"\u0587", - "\u05d0"-"\u05ea", - "\u05f0"-"\u05f2", - "\u0621"-"\u063a", - "\u0640"-"\u064a", - "\u066e"-"\u066f", - "\u0671"-"\u06d3", - "\u06d5", - "\u06e5"-"\u06e6", - "\u06ee"-"\u06ef", - "\u06fa"-"\u06fc", - "\u06ff", - "\u0710", - "\u0712"-"\u072f", - "\u074d"-"\u074f", - "\u0780"-"\u07a5", - "\u07b1", - "\u0904"-"\u0939", - "\u093d", - "\u0950", - "\u0958"-"\u0961", - "\u0985"-"\u098c", - "\u098f"-"\u0990", - "\u0993"-"\u09a8", - "\u09aa"-"\u09b0", - "\u09b2", - "\u09b6"-"\u09b9", - "\u09bd", - "\u09dc"-"\u09dd", - "\u09df"-"\u09e1", - "\u09f0"-"\u09f3", - "\u0a05"-"\u0a0a", - "\u0a0f"-"\u0a10", - "\u0a13"-"\u0a28", - "\u0a2a"-"\u0a30", - "\u0a32"-"\u0a33", - "\u0a35"-"\u0a36", - "\u0a38"-"\u0a39", - "\u0a59"-"\u0a5c", - "\u0a5e", - "\u0a72"-"\u0a74", - "\u0a85"-"\u0a8d", - "\u0a8f"-"\u0a91", - "\u0a93"-"\u0aa8", - "\u0aaa"-"\u0ab0", - "\u0ab2"-"\u0ab3", - "\u0ab5"-"\u0ab9", - "\u0abd", - "\u0ad0", - "\u0ae0"-"\u0ae1", - "\u0af1", - "\u0b05"-"\u0b0c", - "\u0b0f"-"\u0b10", - "\u0b13"-"\u0b28", - "\u0b2a"-"\u0b30", - "\u0b32"-"\u0b33", - "\u0b35"-"\u0b39", - "\u0b3d", - "\u0b5c"-"\u0b5d", - "\u0b5f"-"\u0b61", - "\u0b71", - "\u0b83", - "\u0b85"-"\u0b8a", - "\u0b8e"-"\u0b90", - "\u0b92"-"\u0b95", - "\u0b99"-"\u0b9a", - "\u0b9c", - "\u0b9e"-"\u0b9f", - "\u0ba3"-"\u0ba4", - "\u0ba8"-"\u0baa", - "\u0bae"-"\u0bb5", - "\u0bb7"-"\u0bb9", - "\u0bf9", - "\u0c05"-"\u0c0c", - "\u0c0e"-"\u0c10", - "\u0c12"-"\u0c28", - "\u0c2a"-"\u0c33", - "\u0c35"-"\u0c39", - "\u0c60"-"\u0c61", - "\u0c85"-"\u0c8c", - "\u0c8e"-"\u0c90", - "\u0c92"-"\u0ca8", - "\u0caa"-"\u0cb3", - "\u0cb5"-"\u0cb9", - "\u0cbd", - "\u0cde", - "\u0ce0"-"\u0ce1", - "\u0d05"-"\u0d0c", - "\u0d0e"-"\u0d10", - "\u0d12"-"\u0d28", - "\u0d2a"-"\u0d39", - "\u0d60"-"\u0d61", - "\u0d85"-"\u0d96", - "\u0d9a"-"\u0db1", - "\u0db3"-"\u0dbb", - "\u0dbd", - "\u0dc0"-"\u0dc6", - "\u0e01"-"\u0e30", - "\u0e32"-"\u0e33", - "\u0e3f"-"\u0e46", - "\u0e81"-"\u0e82", - "\u0e84", - "\u0e87"-"\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94"-"\u0e97", - "\u0e99"-"\u0e9f", - "\u0ea1"-"\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa"-"\u0eab", - "\u0ead"-"\u0eb0", - "\u0eb2"-"\u0eb3", - "\u0ebd", - "\u0ec0"-"\u0ec4", - "\u0ec6", - "\u0edc"-"\u0edd", - "\u0f00", - "\u0f40"-"\u0f47", - "\u0f49"-"\u0f6a", - "\u0f88"-"\u0f8b", - "\u1000"-"\u1021", - "\u1023"-"\u1027", - "\u1029"-"\u102a", - "\u1050"-"\u1055", - "\u10a0"-"\u10c5", - "\u10d0"-"\u10f8", - "\u1100"-"\u1159", - "\u115f"-"\u11a2", - "\u11a8"-"\u11f9", - "\u1200"-"\u1206", - "\u1208"-"\u1246", - "\u1248", - "\u124a"-"\u124d", - "\u1250"-"\u1256", - "\u1258", - "\u125a"-"\u125d", - "\u1260"-"\u1286", - "\u1288", - "\u128a"-"\u128d", - "\u1290"-"\u12ae", - "\u12b0", - "\u12b2"-"\u12b5", - "\u12b8"-"\u12be", - "\u12c0", - "\u12c2"-"\u12c5", - "\u12c8"-"\u12ce", - "\u12d0"-"\u12d6", - "\u12d8"-"\u12ee", - "\u12f0"-"\u130e", - "\u1310", - "\u1312"-"\u1315", - "\u1318"-"\u131e", - "\u1320"-"\u1346", - "\u1348"-"\u135a", - "\u13a0"-"\u13f4", - "\u1401"-"\u166c", - "\u166f"-"\u1676", - "\u1681"-"\u169a", - "\u16a0"-"\u16ea", - "\u16ee"-"\u16f0", - "\u1700"-"\u170c", - "\u170e"-"\u1711", - "\u1720"-"\u1731", - "\u1740"-"\u1751", - "\u1760"-"\u176c", - "\u176e"-"\u1770", - "\u1780"-"\u17b3", - "\u17d7", - "\u17db"-"\u17dc", - "\u1820"-"\u1877", - "\u1880"-"\u18a8", - "\u1900"-"\u191c", - "\u1950"-"\u196d", - "\u1970"-"\u1974", - "\u1d00"-"\u1d6b", - "\u1e00"-"\u1e9b", - "\u1ea0"-"\u1ef9", - "\u1f00"-"\u1f15", - "\u1f18"-"\u1f1d", - "\u1f20"-"\u1f45", - "\u1f48"-"\u1f4d", - "\u1f50"-"\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f"-"\u1f7d", - "\u1f80"-"\u1fb4", - "\u1fb6"-"\u1fbc", - "\u1fbe", - "\u1fc2"-"\u1fc4", - "\u1fc6"-"\u1fcc", - "\u1fd0"-"\u1fd3", - "\u1fd6"-"\u1fdb", - "\u1fe0"-"\u1fec", - "\u1ff2"-"\u1ff4", - "\u1ff6"-"\u1ffc", - "\u203f"-"\u2040", - "\u2054", - "\u2071", - "\u207f", - "\u20a0"-"\u20b1", - "\u2102", - "\u2107", - "\u210a"-"\u2113", - "\u2115", - "\u2119"-"\u211d", - "\u2124", - "\u2126", - "\u2128", - "\u212a"-"\u212d", - "\u212f"-"\u2131", - "\u2133"-"\u2139", - "\u213d"-"\u213f", - "\u2145"-"\u2149", - "\u2160"-"\u2183", - "\u3005"-"\u3007", - "\u3021"-"\u3029", - "\u3031"-"\u3035", - "\u3038"-"\u303c", - "\u3041"-"\u3096", - "\u309d"-"\u309f", - "\u30a1"-"\u30ff", - "\u3105"-"\u312c", - "\u3131"-"\u318e", - "\u31a0"-"\u31b7", - "\u31f0"-"\u31ff", - "\u3400"-"\u4db5", - "\u4e00"-"\u9fa5", - "\ua000"-"\ua48c", - "\uac00"-"\ud7a3", - "\ud801", //for supplementary characters suport - "\ud802", //for supplementary characters suport - "\uf900"-"\ufa2d", - "\ufa30"-"\ufa6a", - "\ufb00"-"\ufb06", - "\ufb13"-"\ufb17", - "\ufb1d", - "\ufb1f"-"\ufb28", - "\ufb2a"-"\ufb36", - "\ufb38"-"\ufb3c", - "\ufb3e", - "\ufb40"-"\ufb41", - "\ufb43"-"\ufb44", - "\ufb46"-"\ufbb1", - "\ufbd3"-"\ufd3d", - "\ufd50"-"\ufd8f", - "\ufd92"-"\ufdc7", - "\ufdf0"-"\ufdfc", - "\ufe33"-"\ufe34", - "\ufe4d"-"\ufe4f", - "\ufe69", - "\ufe70"-"\ufe74", - "\ufe76"-"\ufefc", - "\uff04", - "\uff21"-"\uff3a", - "\uff3f", - "\uff41"-"\uff5a", - "\uff65"-"\uffbe", - "\uffc2"-"\uffc7", - "\uffca"-"\uffcf", - "\uffd2"-"\uffd7", - "\uffda"-"\uffdc", - "\uffe0"-"\uffe1", - "\uffe5"-"\uffe6" - ] - > -| - < #PART_LETTER: - [ // all chars for which Character.isIdentifierPart is true - "\u0000"-"\u0008", - "\u000e"-"\u001b", - "\u0024", // "$" - "\u0030"-"\u0039", // "0"-"9" - "\u0041"-"\u005a", // "A"-"Z" - "\u005f", // "_" - "\u0061"-"\u007a", // "a"-"z" - "\u007f"-"\u009f", - "\u00a2"-"\u00a5", - "\u00aa", - "\u00ad", - "\u00b5", - "\u00ba", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u0236", - "\u0250"-"\u02c1", - "\u02c6"-"\u02d1", - "\u02e0"-"\u02e4", - "\u02ee", - "\u0300"-"\u0357", - "\u035d"-"\u036f", - "\u037a", - "\u0386", - "\u0388"-"\u038a", - "\u038c", - "\u038e"-"\u03a1", - "\u03a3"-"\u03ce", - "\u03d0"-"\u03f5", - "\u03f7"-"\u03fb", - "\u0400"-"\u0481", - "\u0483"-"\u0486", - "\u048a"-"\u04ce", - "\u04d0"-"\u04f5", - "\u04f8"-"\u04f9", - "\u0500"-"\u050f", - "\u0531"-"\u0556", - "\u0559", - "\u0561"-"\u0587", - "\u0591"-"\u05a1", - "\u05a3"-"\u05b9", - "\u05bb"-"\u05bd", - "\u05bf", - "\u05c1"-"\u05c2", - "\u05c4", - "\u05d0"-"\u05ea", - "\u05f0"-"\u05f2", - "\u0600"-"\u0603", - "\u0610"-"\u0615", - "\u0621"-"\u063a", - "\u0640"-"\u0658", - "\u0660"-"\u0669", - "\u066e"-"\u06d3", - "\u06d5"-"\u06dd", - "\u06df"-"\u06e8", - "\u06ea"-"\u06fc", - "\u06ff", - "\u070f"-"\u074a", - "\u074d"-"\u074f", - "\u0780"-"\u07b1", - "\u0901"-"\u0939", - "\u093c"-"\u094d", - "\u0950"-"\u0954", - "\u0958"-"\u0963", - "\u0966"-"\u096f", - "\u0981"-"\u0983", - "\u0985"-"\u098c", - "\u098f"-"\u0990", - "\u0993"-"\u09a8", - "\u09aa"-"\u09b0", - "\u09b2", - "\u09b6"-"\u09b9", - "\u09bc"-"\u09c4", - "\u09c7"-"\u09c8", - "\u09cb"-"\u09cd", - "\u09d7", - "\u09dc"-"\u09dd", - "\u09df"-"\u09e3", - "\u09e6"-"\u09f3", - "\u0a01"-"\u0a03", - "\u0a05"-"\u0a0a", - "\u0a0f"-"\u0a10", - "\u0a13"-"\u0a28", - "\u0a2a"-"\u0a30", - "\u0a32"-"\u0a33", - "\u0a35"-"\u0a36", - "\u0a38"-"\u0a39", - "\u0a3c", - "\u0a3e"-"\u0a42", - "\u0a47"-"\u0a48", - "\u0a4b"-"\u0a4d", - "\u0a59"-"\u0a5c", - "\u0a5e", - "\u0a66"-"\u0a74", - "\u0a81"-"\u0a83", - "\u0a85"-"\u0a8d", - "\u0a8f"-"\u0a91", - "\u0a93"-"\u0aa8", - "\u0aaa"-"\u0ab0", - "\u0ab2"-"\u0ab3", - "\u0ab5"-"\u0ab9", - "\u0abc"-"\u0ac5", - "\u0ac7"-"\u0ac9", - "\u0acb"-"\u0acd", - "\u0ad0", - "\u0ae0"-"\u0ae3", - "\u0ae6"-"\u0aef", - "\u0af1", - "\u0b01"-"\u0b03", - "\u0b05"-"\u0b0c", - "\u0b0f"-"\u0b10", - "\u0b13"-"\u0b28", - "\u0b2a"-"\u0b30", - "\u0b32"-"\u0b33", - "\u0b35"-"\u0b39", - "\u0b3c"-"\u0b43", - "\u0b47"-"\u0b48", - "\u0b4b"-"\u0b4d", - "\u0b56"-"\u0b57", - "\u0b5c"-"\u0b5d", - "\u0b5f"-"\u0b61", - "\u0b66"-"\u0b6f", - "\u0b71", - "\u0b82"-"\u0b83", - "\u0b85"-"\u0b8a", - "\u0b8e"-"\u0b90", - "\u0b92"-"\u0b95", - "\u0b99"-"\u0b9a", - "\u0b9c", - "\u0b9e"-"\u0b9f", - "\u0ba3"-"\u0ba4", - "\u0ba8"-"\u0baa", - "\u0bae"-"\u0bb5", - "\u0bb7"-"\u0bb9", - "\u0bbe"-"\u0bc2", - "\u0bc6"-"\u0bc8", - "\u0bca"-"\u0bcd", - "\u0bd7", - "\u0be7"-"\u0bef", - "\u0bf9", - "\u0c01"-"\u0c03", - "\u0c05"-"\u0c0c", - "\u0c0e"-"\u0c10", - "\u0c12"-"\u0c28", - "\u0c2a"-"\u0c33", - "\u0c35"-"\u0c39", - "\u0c3e"-"\u0c44", - "\u0c46"-"\u0c48", - "\u0c4a"-"\u0c4d", - "\u0c55"-"\u0c56", - "\u0c60"-"\u0c61", - "\u0c66"-"\u0c6f", - "\u0c82"-"\u0c83", - "\u0c85"-"\u0c8c", - "\u0c8e"-"\u0c90", - "\u0c92"-"\u0ca8", - "\u0caa"-"\u0cb3", - "\u0cb5"-"\u0cb9", - "\u0cbc"-"\u0cc4", - "\u0cc6"-"\u0cc8", - "\u0cca"-"\u0ccd", - "\u0cd5"-"\u0cd6", - "\u0cde", - "\u0ce0"-"\u0ce1", - "\u0ce6"-"\u0cef", - "\u0d02"-"\u0d03", - "\u0d05"-"\u0d0c", - "\u0d0e"-"\u0d10", - "\u0d12"-"\u0d28", - "\u0d2a"-"\u0d39", - "\u0d3e"-"\u0d43", - "\u0d46"-"\u0d48", - "\u0d4a"-"\u0d4d", - "\u0d57", - "\u0d60"-"\u0d61", - "\u0d66"-"\u0d6f", - "\u0d82"-"\u0d83", - "\u0d85"-"\u0d96", - "\u0d9a"-"\u0db1", - "\u0db3"-"\u0dbb", - "\u0dbd", - "\u0dc0"-"\u0dc6", - "\u0dca", - "\u0dcf"-"\u0dd4", - "\u0dd6", - "\u0dd8"-"\u0ddf", - "\u0df2"-"\u0df3", - "\u0e01"-"\u0e3a", - "\u0e3f"-"\u0e4e", - "\u0e50"-"\u0e59", - "\u0e81"-"\u0e82", - "\u0e84", - "\u0e87"-"\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94"-"\u0e97", - "\u0e99"-"\u0e9f", - "\u0ea1"-"\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa"-"\u0eab", - "\u0ead"-"\u0eb9", - "\u0ebb"-"\u0ebd", - "\u0ec0"-"\u0ec4", - "\u0ec6", - "\u0ec8"-"\u0ecd", - "\u0ed0"-"\u0ed9", - "\u0edc"-"\u0edd", - "\u0f00", - "\u0f18"-"\u0f19", - "\u0f20"-"\u0f29", - "\u0f35", - "\u0f37", - "\u0f39", - "\u0f3e"-"\u0f47", - "\u0f49"-"\u0f6a", - "\u0f71"-"\u0f84", - "\u0f86"-"\u0f8b", - "\u0f90"-"\u0f97", - "\u0f99"-"\u0fbc", - "\u0fc6", - "\u1000"-"\u1021", - "\u1023"-"\u1027", - "\u1029"-"\u102a", - "\u102c"-"\u1032", - "\u1036"-"\u1039", - "\u1040"-"\u1049", - "\u1050"-"\u1059", - "\u10a0"-"\u10c5", - "\u10d0"-"\u10f8", - "\u1100"-"\u1159", - "\u115f"-"\u11a2", - "\u11a8"-"\u11f9", - "\u1200"-"\u1206", - "\u1208"-"\u1246", - "\u1248", - "\u124a"-"\u124d", - "\u1250"-"\u1256", - "\u1258", - "\u125a"-"\u125d", - "\u1260"-"\u1286", - "\u1288", - "\u128a"-"\u128d", - "\u1290"-"\u12ae", - "\u12b0", - "\u12b2"-"\u12b5", - "\u12b8"-"\u12be", - "\u12c0", - "\u12c2"-"\u12c5", - "\u12c8"-"\u12ce", - "\u12d0"-"\u12d6", - "\u12d8"-"\u12ee", - "\u12f0"-"\u130e", - "\u1310", - "\u1312"-"\u1315", - "\u1318"-"\u131e", - "\u1320"-"\u1346", - "\u1348"-"\u135a", - "\u1369"-"\u1371", - "\u13a0"-"\u13f4", - "\u1401"-"\u166c", - "\u166f"-"\u1676", - "\u1681"-"\u169a", - "\u16a0"-"\u16ea", - "\u16ee"-"\u16f0", - "\u1700"-"\u170c", - "\u170e"-"\u1714", - "\u1720"-"\u1734", - "\u1740"-"\u1753", - "\u1760"-"\u176c", - "\u176e"-"\u1770", - "\u1772"-"\u1773", - "\u1780"-"\u17d3", - "\u17d7", - "\u17db"-"\u17dd", - "\u17e0"-"\u17e9", - "\u180b"-"\u180d", - "\u1810"-"\u1819", - "\u1820"-"\u1877", - "\u1880"-"\u18a9", - "\u1900"-"\u191c", - "\u1920"-"\u192b", - "\u1930"-"\u193b", - "\u1946"-"\u196d", - "\u1970"-"\u1974", - "\u1d00"-"\u1d6b", - "\u1e00"-"\u1e9b", - "\u1ea0"-"\u1ef9", - "\u1f00"-"\u1f15", - "\u1f18"-"\u1f1d", - "\u1f20"-"\u1f45", - "\u1f48"-"\u1f4d", - "\u1f50"-"\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f"-"\u1f7d", - "\u1f80"-"\u1fb4", - "\u1fb6"-"\u1fbc", - "\u1fbe", - "\u1fc2"-"\u1fc4", - "\u1fc6"-"\u1fcc", - "\u1fd0"-"\u1fd3", - "\u1fd6"-"\u1fdb", - "\u1fe0"-"\u1fec", - "\u1ff2"-"\u1ff4", - "\u1ff6"-"\u1ffc", - "\u200c"-"\u200f", - "\u202a"-"\u202e", - "\u203f"-"\u2040", - "\u2054", - "\u2060"-"\u2063", - "\u206a"-"\u206f", - "\u2071", - "\u207f", - "\u20a0"-"\u20b1", - "\u20d0"-"\u20dc", - "\u20e1", - "\u20e5"-"\u20ea", - "\u2102", - "\u2107", - "\u210a"-"\u2113", - "\u2115", - "\u2119"-"\u211d", - "\u2124", - "\u2126", - "\u2128", - "\u212a"-"\u212d", - "\u212f"-"\u2131", - "\u2133"-"\u2139", - "\u213d"-"\u213f", - "\u2145"-"\u2149", - "\u2160"-"\u2183", - "\u3005"-"\u3007", - "\u3021"-"\u302f", - "\u3031"-"\u3035", - "\u3038"-"\u303c", - "\u3041"-"\u3096", - "\u3099"-"\u309a", - "\u309d"-"\u309f", - "\u30a1"-"\u30ff", - "\u3105"-"\u312c", - "\u3131"-"\u318e", - "\u31a0"-"\u31b7", - "\u31f0"-"\u31ff", - "\u3400"-"\u4db5", - "\u4e00"-"\u9fa5", - "\ua000"-"\ua48c", - "\uac00"-"\ud7a3", - "\ud801", //for supplementary characters suport - "\ud802", //for supplementary characters suport - "\ud834", //for supplementary characters suport - "\udc00", //for supplementary characters suport - "\udc01", //for supplementary characters suport - "\udd7b", //for supplementary characters suport - "\uf900"-"\ufa2d", - "\ufa30"-"\ufa6a", - "\ufb00"-"\ufb06", - "\ufb13"-"\ufb17", - "\ufb1d"-"\ufb28", - "\ufb2a"-"\ufb36", - "\ufb38"-"\ufb3c", - "\ufb3e", - "\ufb40"-"\ufb41", - "\ufb43"-"\ufb44", - "\ufb46"-"\ufbb1", - "\ufbd3"-"\ufd3d", - "\ufd50"-"\ufd8f", - "\ufd92"-"\ufdc7", - "\ufdf0"-"\ufdfc", - "\ufe00"-"\ufe0f", - "\ufe20"-"\ufe23", - "\ufe33"-"\ufe34", - "\ufe4d"-"\ufe4f", - "\ufe69", - "\ufe70"-"\ufe74", - "\ufe76"-"\ufefc", - "\ufeff", - "\uff04", - "\uff10"-"\uff19", - "\uff21"-"\uff3a", - "\uff3f", - "\uff41"-"\uff5a", - "\uff65"-"\uffbe", - "\uffc2"-"\uffc7", - "\uffca"-"\uffcf", - "\uffd2"-"\uffd7", - "\uffda"-"\uffdc", - "\uffe0"-"\uffe1", - "\uffe5"-"\uffe6", - "\ufff9"-"\ufffb" - ] - > -} - -/* SEPARATORS */ - -TOKEN : -{ - < LPAREN: "(" > -| < RPAREN: ")" > -| < LBRACE: "{" > -| < RBRACE: "}" > -| < LBRACKET: "[" > -| < RBRACKET: "]" > -| < SEMICOLON: ";" > -| < COMMA: "," > -| < DOT: "." > -| < AT: "@" > -} - -/* OPERATORS */ - -TOKEN : -{ - < ASSIGN: "=" > -| < LT: "<" > -| < BANG: "!" > -| < TILDE: "~" > -| < HOOK: "?" > -| < COLON: ":" > -| < EQ: "==" > -| < LE: "<=" > -| < GE: ">=" > -| < NE: "!=" > -| < SC_OR: "||" > -| < SC_AND: "&&" > -| < INCR: "++" > -| < DECR: "--" > -| < PLUS: "+" > -| < MINUS: "-" > -| < STAR: "*" > -| < SLASH: "/" > -| < BIT_AND: "&" > -| < BIT_OR: "|" > -| < XOR: "^" > -| < REM: "%" > -| < LSHIFT: "<<" > -| < PLUSASSIGN: "+=" > -| < MINUSASSIGN: "-=" > -| < STARASSIGN: "*=" > -| < SLASHASSIGN: "/=" > -| < ANDASSIGN: "&=" > -| < ORASSIGN: "|=" > -| < XORASSIGN: "^=" > -| < REMASSIGN: "%=" > -| < LSHIFTASSIGN: "<<=" > -| < RSIGNEDSHIFTASSIGN: ">>=" > -| < RUNSIGNEDSHIFTASSIGN: ">>>=" > -| < ELLIPSIS: "..." > -} - -/* >'s need special attention due to generics syntax. */ -TOKEN : -{ - < RUNSIGNEDSHIFT: ">>>" > - { - matchedToken.kind = GT; - ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; - input_stream.backup(2); - } -| < RSIGNEDSHIFT: ">>" > - { - matchedToken.kind = GT; - ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; - input_stream.backup(1); - } -| < GT: ">" > -} - - -/***************************************** - * THE JAVA LANGUAGE GRAMMAR STARTS HERE * - *****************************************/ - -/* - * Program structuring syntax follows. - */ - -CompilationUnit CompilationUnit(): -{ - PackageDeclaration pakage = null; - List imports = null; - ImportDeclaration in = null; - List types = null; - TypeDeclaration tn = null; - int line = -1; - int column = 0; -} -{ - [ LOOKAHEAD(PackageDeclaration()) pakage = PackageDeclaration() {line = pakage.getBeginLine(); column = pakage.getBeginColumn();} ] - ( in = ImportDeclaration() { if(line==-1){line = in.getBeginLine(); column = in.getBeginColumn();} imports = add(imports, in); } )* - ( tn = TypeDeclaration() { if(line==-1){line = tn.getBeginLine(); column = tn.getBeginColumn();} types = add(types, tn); } )* - ( | "\u001A" /** ctrl+z char **/) - { return new CompilationUnit(line == -1 ? 0 : line, column, pakage, imports, types, getComments()); } -} - -PackageDeclaration PackageDeclaration(): -{ - List annotations = null; - AnnotationExpr ann; - NameExpr name; - int line; - int column; -} -{ -( ann = Annotation() { annotations = add(annotations, ann); } )* - "package" {line=token.beginLine; column=token.beginColumn;} name = Name() ";" - { return new PackageDeclaration(line, column, annotations, name); } -} - -ImportDeclaration ImportDeclaration(): -{ - NameExpr name; - boolean isStatic = false; - boolean isAsterisk = false; - int line; - int column; -} -{ - "import" {line=token.beginLine; column=token.beginColumn;} [ "static" { isStatic = true; } ] name = Name() [ "." "*" { isAsterisk = true; } ] ";" - { return new ImportDeclaration(line, column, name, isStatic, isAsterisk); } -} - -/* - * Modifiers. We match all modifiers in a single rule to reduce the chances of - * syntax errors for simple modifier mistakes. It will also enable us to give - * better error messages. - */ - -Modifier Modifiers(): -{ - int modifiers = 0; - List annotations = null; - AnnotationExpr ann; -} -{ - ( - LOOKAHEAD(2) - ( - "public" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.PUBLIC, token); } - | - "static" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.STATIC, token); } - | - "protected" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.PROTECTED, token); } - | - "private" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.PRIVATE, token); } - | - "final" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.FINAL, token); } - | - "abstract" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.ABSTRACT, token); } - | - "synchronized" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.SYNCHRONIZED, token); } - | - "native" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.NATIVE, token); } - | - "transient" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.TRANSIENT, token); } - | - "volatile" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.VOLATILE, token); } - | - "strictfp" { modifiers = ModifierSet.addModifier(modifiers, ModifierSet.STRICTFP, token); } - | - ann = Annotation() { annotations = add(annotations, ann); } - ) - )* - - { - return new Modifier(modifiers, annotations); - } -} - -/* - * Declaration syntax follows. - */ -TypeDeclaration TypeDeclaration(): -{ - Modifier modifier; - TypeDeclaration ret; -} -{ - { pushJavadoc(); } - ( - ";" { ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, popJavadoc()); } - | - modifier = Modifiers() - ( - ret = ClassOrInterfaceDeclaration(modifier) - | - ret = EnumDeclaration(modifier) - | - ret = AnnotationTypeDeclaration(modifier) - ) - ) - { return ret; } -} - - -ClassOrInterfaceDeclaration ClassOrInterfaceDeclaration(Modifier modifier): -{ - boolean isInterface = false; - String name; - List typePar = null; - List extList = null; - List impList = null; - List members; - int line = 0; - int column = 0; -} -{ - ( "class" | "interface" { isInterface = true; } ) {line=token.beginLine; column=token.beginColumn;} - { name = token.image; } - [ typePar = TypeParameters() ] - [ extList = ExtendsList(isInterface) ] - [ impList = ImplementsList(isInterface) ] - members = ClassOrInterfaceBody(isInterface) - - { return new ClassOrInterfaceDeclaration(line, column, popJavadoc(), modifier.modifiers, modifier.annotations, isInterface, name, typePar, extList, impList, members); } -} - -List ExtendsList(boolean isInterface): -{ - boolean extendsMoreThanOne = false; - List ret = new LinkedList(); - ClassOrInterfaceType cit; -} -{ - "extends" cit = ClassOrInterfaceType() { ret.add(cit); } - ( "," cit = ClassOrInterfaceType() { ret.add(cit); extendsMoreThanOne = true; } )* - { - if (extendsMoreThanOne && !isInterface) - throw new ParseException(token, "A class cannot extend more than one other class"); - } - { return ret; } -} - -List ImplementsList(boolean isInterface): -{ - List ret = new LinkedList(); - ClassOrInterfaceType cit; -} -{ - "implements" cit = ClassOrInterfaceType() { ret.add(cit); } - ( "," cit = ClassOrInterfaceType() { ret.add(cit); } )* - { - if (isInterface) - throw new ParseException(token, "An interface cannot implement other interfaces"); - } - { return ret; } -} - -EnumDeclaration EnumDeclaration(Modifier modifier): -{ - String name; - List impList = null; - EnumConstantDeclaration entry; - List entries = null; - BodyDeclaration member; - List members = null; - int line; - int column; -} -{ - "enum" {line=token.beginLine; column=token.beginColumn;} { name = token.image; } - [ impList = ImplementsList(false) ] - "{" - [ - { entries = new LinkedList(); } - entry = EnumConstantDeclaration() { entries.add(entry); } ( LOOKAHEAD(2) "," entry = EnumConstantDeclaration() { entries.add(entry); } )* - ] - [ "," ] - [ - ( ";" ( member = ClassOrInterfaceBodyDeclaration(false) { members = add(members, member); } )* ) - ] - "}" - - { return new EnumDeclaration(line, column, popJavadoc(), modifier.modifiers, modifier.annotations, name, impList, entries, members); } -} - - -EnumConstantDeclaration EnumConstantDeclaration(): -{ - List annotations = null; - AnnotationExpr ann; - String name; - List args = null; - List classBody = null; - int line; - int column; -} -{ - { pushJavadoc(); } - ( ann = Annotation() { annotations = add(annotations, ann); } )* - { name = token.image; line=token.beginLine; column=token.beginColumn;} [ args = Arguments() ] [ classBody = ClassOrInterfaceBody(false) ] - { return new EnumConstantDeclaration(line, column, popJavadoc(), annotations, name, args, classBody); } -} - -List TypeParameters(): -{ - List ret = new LinkedList(); - TypeParameter tp; -} -{ - "<" tp = TypeParameter() { ret.add(tp); } - ( "," tp = TypeParameter() { ret.add(tp); } )* ">" - { return ret; } -} - -TypeParameter TypeParameter(): -{ - String name; - List typeBound = null; - int line; - int column; -} -{ - { name = token.image; line=token.beginLine; column=token.beginColumn;} [ typeBound = TypeBound() ] - { return new TypeParameter(line, column, name, typeBound); } -} - -List TypeBound(): -{ - List ret = new LinkedList(); - ClassOrInterfaceType cit; -} -{ - "extends" cit = ClassOrInterfaceType() { ret.add(cit); } - ( "&" cit = ClassOrInterfaceType() { ret.add(cit); } )* - { return ret; } -} - -List ClassOrInterfaceBody(boolean isInterface): -{ - List ret = new LinkedList(); - BodyDeclaration member; -} -{ - "{" ( member = ClassOrInterfaceBodyDeclaration(isInterface) { ret.add(member); } )* "}" - { return ret; } -} - -BodyDeclaration ClassOrInterfaceBodyDeclaration(boolean isInterface): -{ - boolean isNestedInterface = false; - Modifier modifier; - BodyDeclaration ret; -} -{ - { pushJavadoc(); } - ( - LOOKAHEAD(2) - ret = InitializerDeclaration() - { - if (isInterface) - throw new ParseException(token, "An interface cannot have initializers"); - } - | - modifier = Modifiers() // Just get all the modifiers out of the way. If you want to do - // more checks, pass the modifiers down to the member - ( - ret = ClassOrInterfaceDeclaration(modifier) - | - ret = EnumDeclaration(modifier) - | - ret = AnnotationTypeDeclaration(modifier) - | - LOOKAHEAD( [ TypeParameters() ] "(" ) - ret = ConstructorDeclaration(modifier) - | - LOOKAHEAD( Type() ( "[" "]" )* ( "," | "=" | ";" ) ) - ret = FieldDeclaration(modifier) - | - ret = MethodDeclaration(modifier) - ) - | - ";" { ret = new EmptyMemberDeclaration(token.beginLine, token.beginColumn, popJavadoc()); } - ) - { return ret; } -} - -FieldDeclaration FieldDeclaration(Modifier modifier): -{ - Type type; - List variables = new LinkedList(); - VariableDeclarator val; -} -{ - // Modifiers are already matched in the caller - type = Type() - val = VariableDeclarator() { variables.add(val); } - ( "," val = VariableDeclarator() { variables.add(val); } )* ";" - - { return new FieldDeclaration(type.getBeginLine(), type.getBeginColumn(), popJavadoc(), modifier.modifiers, modifier.annotations, type, variables); } -} - -VariableDeclarator VariableDeclarator(): -{ - VariableDeclaratorId id; - Expression init = null; -} -{ - id = VariableDeclaratorId() [ "=" init = VariableInitializer() ] - { return new VariableDeclarator(id.getBeginLine(), id.getBeginColumn(), id, init); } -} - -VariableDeclaratorId VariableDeclaratorId(): -{ - String name; - int arrayCount = 0; - int line; - int column; -} -{ - { name = token.image; line=token.beginLine; column=token.beginColumn;} ( "[" "]" { arrayCount++; } )* - { return new VariableDeclaratorId(line, column, name, arrayCount); } -} - -Expression VariableInitializer(): -{ - Expression ret; -} -{ - ( - ret = ArrayInitializer() - | - ret = Expression() - ) - { return ret;} -} - -ArrayInitializerExpr ArrayInitializer(): -{ - List values = null; - Expression val; - int line; - int column; -} -{ - "{" {line=token.beginLine; column=token.beginColumn;} [ val = VariableInitializer() { values = add(values, val); } ( LOOKAHEAD(2) "," val = VariableInitializer() { values = add(values, val); } )* ] [ "," ] "}" - { return new ArrayInitializerExpr(line, column, values); } -} - -MethodDeclaration MethodDeclaration(Modifier modifier): -{ - List typeParameters = null; - Type type; - String name; - List parameters; - int arrayCount = 0; - List throws_ = null; - BlockStmt block = null; - int line = -1; - int column = 0; -} -{ - // Modifiers already matched in the caller! - [ typeParameters = TypeParameters() {line=((TypeParameter)typeParameters.get(0)).getBeginLine(); column=((TypeParameter)typeParameters.get(0)).getBeginColumn();} ] - type = ResultType() { if(line==-1){line=type.getBeginLine(); column=type.getBeginColumn();}} - { name = token.image; } parameters = FormalParameters() ( "[" "]" { arrayCount++; } )* - [ "throws" throws_ = NameList() ] - ( block = Block() | ";" ) - - { return new MethodDeclaration(line, column, popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, type, name, parameters, arrayCount, throws_, block); } -} - -List FormalParameters(): -{ - List ret = null; - Parameter par; -} -{ - "(" [ par = FormalParameter() { ret = add(ret, par); } ( "," par = FormalParameter() { ret = add(ret, par); } )* ] ")" - - { return ret; } -} - -Parameter FormalParameter(): -{ - Modifier modifier; - Type type; - boolean isVarArg = false; - VariableDeclaratorId id; -} -{ - modifier = Modifiers() type = Type() [ "..." { isVarArg = true;} ] id = VariableDeclaratorId() - - { return new Parameter(type.getBeginLine(), type.getBeginColumn(), modifier.modifiers, modifier.annotations, type, isVarArg, id); } -} - -ConstructorDeclaration ConstructorDeclaration(Modifier modifier): -{ - List typeParameters = null; - String name; - List parameters; - List throws_ = null; - ExplicitConstructorInvocationStmt exConsInv = null; - List stmts; - int line = -1; - int column = 0; - int bbLine = 0; - int bbColumn = 0; - int beLine = 0; - int beColumn = 0; -} -{ - [ typeParameters = TypeParameters() {line=((TypeParameter)typeParameters.get(0)).getBeginLine(); column=((TypeParameter)typeParameters.get(0)).getBeginColumn();} ] - // Modifiers matched in the caller - { name = token.image; if(line==-1){line=token.beginLine; column=token.beginColumn;}} parameters = FormalParameters() [ "throws" throws_ = NameList() ] - "{" { bbLine=token.beginLine; bbColumn=token.beginColumn; } - [ LOOKAHEAD(ExplicitConstructorInvocation()) exConsInv = ExplicitConstructorInvocation() ] - stmts = Statements() - "}" { beLine=token.beginLine; beColumn=token.beginColumn; } - - { - if (exConsInv != null) { - if (stmts == null) { - stmts = new LinkedList(); - } - stmts.add(0, exConsInv); - } - return new ConstructorDeclaration(line, column, popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, name, parameters, throws_, new BlockStmt(bbLine, bbColumn, beLine, beColumn, stmts)); - } -} - -ExplicitConstructorInvocationStmt ExplicitConstructorInvocation(): -{ - boolean isThis = false; - List args; - Expression expr = null; - List typeArgs = null; - int line = -1; - int column = 0; -} -{ - ( - LOOKAHEAD([ TypeArguments() ] "this" "(") - [ typeArgs = TypeArguments() {line=((Type)typeArgs.get(0)).getBeginLine(); column=((Type)typeArgs.get(0)).getBeginColumn();} ] - "this" { if (line == -1) {line=token.beginLine; column=token.beginColumn;} isThis = true; } - args = Arguments() ";" - | - [ - LOOKAHEAD( PrimaryExpressionWithoutSuperSuffix() "." ) - expr = PrimaryExpressionWithoutSuperSuffix() "." - { line=expr.getBeginLine(); column=expr.getBeginColumn(); } - ] - [ typeArgs = TypeArguments() {if (line == -1) {line=((Type)typeArgs.get(0)).getBeginLine(); column=((Type)typeArgs.get(0)).getBeginColumn();}} ] - "super" {if (line == -1) {line=token.beginLine; column=token.beginColumn;}} - args = Arguments() ";" - ) - { return new ExplicitConstructorInvocationStmt(line, column, typeArgs, isThis, expr, args); } -} - -List Statements(): -{ - List ret = null; - Statement stmt; -} -{ - ( stmt = BlockStatement() { ret = add(ret, stmt); } )* - { return ret; } -} - -InitializerDeclaration InitializerDeclaration(): -{ - BlockStmt block; - int line = -1; - int column = 0; - boolean isStatic = false; -} -{ - [ "static" { isStatic = true; line=token.beginLine; column=token.beginColumn;} ] block = Block() {if(line==-1){line=block.getBeginLine(); column=block.getBeginColumn();}} - { return new InitializerDeclaration(line, column, popJavadoc(), isStatic, block); } -} - - -/* - * Type, name and expression syntax follows. - */ - -Type Type(): -{ - Type ret; -} -{ - ( - LOOKAHEAD(2) ret = ReferenceType() - | - ret = PrimitiveType() - ) - { return ret; } -} - -ReferenceType ReferenceType(): -{ - Type type; - int arrayCount = 0; -} -{ - ( - type = PrimitiveType() ( LOOKAHEAD(2) "[" "]" { arrayCount++; } )+ - | - type = ClassOrInterfaceType() ( LOOKAHEAD(2) "[" "]" { arrayCount++; } )* - ) - { return new ReferenceType(type.getBeginLine(), type.getBeginColumn(), type, arrayCount); } -} - -ClassOrInterfaceType ClassOrInterfaceType(): -{ - ClassOrInterfaceType ret; - String name; - List typeArgs = null; - int line; - int column; -} -{ - {line=token.beginLine; column=token.beginColumn;} { name = token.image; } - [ LOOKAHEAD(2) typeArgs = TypeArguments() ] - { ret = new ClassOrInterfaceType(line, column, null, name, typeArgs); } - ( - LOOKAHEAD(2) "." { name = token.image; } - [ LOOKAHEAD(2) typeArgs = TypeArguments() ] { ret = new ClassOrInterfaceType(line, column, ret, name, typeArgs); } - )* - { return ret; } -} - -List TypeArguments(): -{ - List ret = new LinkedList(); - Type type; -} -{ - "<" type = TypeArgument() { ret.add(type); } ( "," type = TypeArgument() { ret.add(type); } )* ">" - { return ret; } -} - -Type TypeArgument(): -{ - Type ret; -} -{ - ( - ret = ReferenceType() - | - ret = Wildcard() - ) - { return ret; } -} - -WildcardType Wildcard(): -{ - ReferenceType ext = null; - ReferenceType sup = null; - int line; - int column; -} -{ - "?" {line=token.beginLine; column=token.beginColumn;} - [ - "extends" ext = ReferenceType() - | - "super" sup = ReferenceType() - ] - { return new WildcardType(line, column, ext, sup); } -} - -PrimitiveType PrimitiveType(): -{ - PrimitiveType ret; -} -{ -( - "boolean" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Boolean); } -| - "char" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Char); } -| - "byte" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Byte); } -| - "short" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Short); } -| - "int" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Int); } -| - "long" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Long); } -| - "float" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Float); } -| - "double" { ret = new PrimitiveType(token.beginLine, token.beginColumn, PrimitiveType.Primitive.Double); } -) -{ return ret; } -} - -Type ResultType(): -{ - Type ret; -} -{ - ( - "void" { ret = new VoidType(token.beginLine, token.beginColumn); } - | - ret = Type() - ) - { return ret; } -} - -NameExpr Name(): -/* - * A lookahead of 2 is required below since "Name" can be followed - * by a ".*" when used in the context of an "ImportDeclaration". - */ -{ - NameExpr ret; -} -{ - { ret = new NameExpr(token.beginLine, token.beginColumn, token.image); } - ( LOOKAHEAD(2) "." { ret = new QualifiedNameExpr(token.beginLine, token.beginColumn, ret, token.image); } )* - { return ret; } -} - -List NameList(): -{ - List ret = new LinkedList(); - NameExpr name; -} -{ - name = Name() { ret.add(name); } ( "," name = Name() { ret.add(name); } )* - - { return ret; } -} - - -/* - * Expression syntax follows. - */ - -Expression Expression(): -/* - * This expansion has been written this way instead of: - * Assignment() | ConditionalExpression() - * for performance reasons. - * However, it is a weakening of the grammar for it allows the LHS of - * assignments to be any conditional expression whereas it can only be - * a primary expression. Consider adding a semantic predicate to work - * around this. - */ -{ - Expression ret; - AssignExpr.Operator op; - Expression value; -} -{ - ret = ConditionalExpression() - [ - LOOKAHEAD(2) - op = AssignmentOperator() value = Expression() { ret = new AssignExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, value, op); } - ] - { return ret; } -} - -AssignExpr.Operator AssignmentOperator(): -{ - AssignExpr.Operator ret; -} -{ - ( - "=" { ret = AssignExpr.Operator.assign; } - | "*=" { ret = AssignExpr.Operator.star; } - | "/=" { ret = AssignExpr.Operator.slash; } - | "%=" { ret = AssignExpr.Operator.rem; } - | "+=" { ret = AssignExpr.Operator.plus; } - | "-=" { ret = AssignExpr.Operator.minus; } - | "<<=" { ret = AssignExpr.Operator.lShift; } - | ">>=" { ret = AssignExpr.Operator.rSignedShift; } - | ">>>=" { ret = AssignExpr.Operator.rUnsignedShift; } - | "&=" { ret = AssignExpr.Operator.and; } - | "^=" { ret = AssignExpr.Operator.xor; } - | "|=" { ret = AssignExpr.Operator.or; } - ) - { return ret; } -} - -Expression ConditionalExpression(): -{ - Expression ret; - Expression left; - Expression right; -} -{ - ret = ConditionalOrExpression() - [ "?" left = Expression() ":" right = ConditionalExpression() { ret = new ConditionalExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, left, right); } ] - { return ret; } -} - -Expression ConditionalOrExpression(): -{ - Expression ret; - Expression right; -} -{ - ret = ConditionalAndExpression() ( "||" right = ConditionalAndExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, BinaryExpr.Operator.or); } )* - { return ret; } -} - -Expression ConditionalAndExpression(): -{ - Expression ret; - Expression right; -} -{ - ret = InclusiveOrExpression() ( "&&" right = InclusiveOrExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, BinaryExpr.Operator.and); } )* - { return ret; } -} - -Expression InclusiveOrExpression(): -{ - Expression ret; - Expression right; -} -{ - ret = ExclusiveOrExpression() ( "|" right = ExclusiveOrExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, BinaryExpr.Operator.binOr); } )* - { return ret; } -} - -Expression ExclusiveOrExpression(): -{ - Expression ret; - Expression right; -} -{ - ret = AndExpression() ( "^" right = AndExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, BinaryExpr.Operator.xor); } )* - { return ret; } -} - -Expression AndExpression(): -{ - Expression ret; - Expression right; -} -{ - ret = EqualityExpression() ( "&" right = EqualityExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, BinaryExpr.Operator.binAnd); } )* - { return ret; } -} - -Expression EqualityExpression(): -{ - Expression ret; - Expression right; - BinaryExpr.Operator op; -} -{ - ret = InstanceOfExpression() - ( - ( "==" { op = BinaryExpr.Operator.equals; } | - "!=" { op = BinaryExpr.Operator.notEquals; } - ) right = InstanceOfExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, op); } - )* - { return ret; } -} - -Expression InstanceOfExpression(): -{ - Expression ret; - Type type; -} -{ - ret = RelationalExpression() [ "instanceof" type = Type() { ret = new InstanceOfExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, type); } ] - { return ret; } -} - -Expression RelationalExpression(): -{ - Expression ret; - Expression right; - BinaryExpr.Operator op; -} -{ - ret = ShiftExpression() - ( - ( "<" { op = BinaryExpr.Operator.less; } | - ">" { op = BinaryExpr.Operator.greater; } | - "<=" { op = BinaryExpr.Operator.lessEquals; } | - ">=" { op = BinaryExpr.Operator.greaterEquals; } - ) right = ShiftExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, op); } - )* - { return ret; } -} - -Expression ShiftExpression(): -{ - Expression ret; - Expression right; - BinaryExpr.Operator op; -} -{ - ret = AdditiveExpression() - ( - ( "<<" { op = BinaryExpr.Operator.lShift; } | - RSIGNEDSHIFT() { op = BinaryExpr.Operator.rSignedShift; } | - RUNSIGNEDSHIFT() { op = BinaryExpr.Operator.rUnsignedShift; } - ) right = AdditiveExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, op); } - )* - { return ret; } -} - -Expression AdditiveExpression(): -{ - Expression ret; - Expression right; - BinaryExpr.Operator op; -} -{ - ret = MultiplicativeExpression() - ( - ( "+" { op = BinaryExpr.Operator.plus; } | - "-" { op = BinaryExpr.Operator.minus; } - ) right = MultiplicativeExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, op); } - )* - { return ret; } -} - -Expression MultiplicativeExpression(): -{ - Expression ret; - Expression right; - BinaryExpr.Operator op; -} -{ - ret = UnaryExpression() - ( - ( "*" { op = BinaryExpr.Operator.times; } | - "/" { op = BinaryExpr.Operator.divide; } | - "%" { op = BinaryExpr.Operator.remainder; } - ) right = UnaryExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), ret, right, op); } - )* - { return ret; } -} - -Expression UnaryExpression(): -{ - Expression ret; - UnaryExpr.Operator op; - int line = 0; - int column = 0; -} -{ - ( - ( "+" { op = UnaryExpr.Operator.positive; line=token.beginLine; column=token.beginColumn;} | - "-" { op = UnaryExpr.Operator.negative; line=token.beginLine; column=token.beginColumn;} - ) ret = UnaryExpression() - { - if(op == UnaryExpr.Operator.negative) { - if (ret instanceof IntegerLiteralExpr && ((IntegerLiteralExpr)ret).isMinValue()) { - ret = new IntegerLiteralMinValueExpr(ret.getBeginLine(), ret.getBeginColumn()); - } else if (ret instanceof LongLiteralExpr && ((LongLiteralExpr)ret).isMinValue()) { - ret = new LongLiteralMinValueExpr(ret.getBeginLine(), ret.getBeginColumn()); - } else { - ret = new UnaryExpr(line, column, ret, op); - } - } else { - ret = new UnaryExpr(line, column, ret, op); - } - } - | - ret = PreIncrementExpression() - | - ret = PreDecrementExpression() - | - ret = UnaryExpressionNotPlusMinus() - ) - { return ret; } -} - -Expression PreIncrementExpression(): -{ - Expression ret; - int line; - int column; -} -{ - "++" {line=token.beginLine; column=token.beginColumn;} ret = PrimaryExpression() { ret = new UnaryExpr(line, column, ret, UnaryExpr.Operator.preIncrement); } - { return ret; } -} - -Expression PreDecrementExpression(): -{ - Expression ret; - int line; - int column; -} -{ - "--" {line=token.beginLine; column=token.beginColumn;} ret = PrimaryExpression() { ret = new UnaryExpr(line, column, ret, UnaryExpr.Operator.preDecrement); } - { return ret; } -} - -Expression UnaryExpressionNotPlusMinus(): -{ - Expression ret; - UnaryExpr.Operator op; - int line = 0; - int column = 0; -} -{ - ( - ( "~" { op = UnaryExpr.Operator.inverse; line=token.beginLine; column=token.beginColumn;} | - "!" { op = UnaryExpr.Operator.not; line=token.beginLine; column=token.beginColumn;} - ) ret = UnaryExpression() { ret = new UnaryExpr(line, column, ret, op); } - | - LOOKAHEAD( CastLookahead() ) - ret = CastExpression() - | - ret = PostfixExpression() - ) - { return ret; } -} - -// This production is to determine lookahead only. The LOOKAHEAD specifications -// below are not used, but they are there just to indicate that we know about -// this. -void CastLookahead(): -{} -{ - LOOKAHEAD("(" Type() "[") - "(" Type() "[" "]" -| - "(" Type() ")" UnaryExpression() -} - -Expression PostfixExpression(): -{ - Expression ret; - UnaryExpr.Operator op; - int line = 0; - int column = 0; -} -{ - ret = PrimaryExpression() - [ - LOOKAHEAD(2) - ( "++" { op = UnaryExpr.Operator.posIncrement; line=token.beginLine; column=token.beginColumn;} | - "--" { op = UnaryExpr.Operator.posDecrement; line=token.beginLine; column=token.beginColumn;} - ) { ret = new UnaryExpr(line, column, ret, op); } - ] - { return ret; } -} - -Expression CastExpression(): -{ - Expression ret; - Type type; - int line; - int column; -} -{ - "(" {line=token.beginLine; column=token.beginColumn;} type = Type() ")" ret = UnaryExpression() { ret = new CastExpr(line, column, type, ret); } - { return ret; } -} - -Expression PrimaryExpression(): -{ - Expression ret; - Expression inner; -} -{ - ret = PrimaryPrefix() ( LOOKAHEAD(2) ret = PrimarySuffix(ret) )* - { return ret; } -} - -Expression PrimaryExpressionWithoutSuperSuffix(): -{ - Expression ret; - Expression inner; -} -{ - ret = PrimaryPrefix() ( LOOKAHEAD( PrimarySuffixWithoutSuper(null) ) ret = PrimarySuffixWithoutSuper(ret) )* - { return ret; } -} - -Expression PrimaryPrefix(): -{ - Expression ret; - String name; - List typeArgs = null; - List args = null; - boolean hasArgs = false; - Type type; - int line = -1; - int column = 0; -} -{ - ( - ret = Literal() - | - "this" { ret = new ThisExpr(token.beginLine, token.beginColumn, null); } - | - "super" { ret = new SuperExpr(token.beginLine, token.beginColumn, null); } - "." - [ typeArgs = TypeArguments() {line=((Type)typeArgs.get(0)).getBeginLine(); column=((Type)typeArgs.get(0)).getBeginColumn();} ] - { name = token.image; if (line==-1) { line=token.beginLine; column=token.beginColumn; } } - [ args = Arguments() {hasArgs=true;} ] - { - ret = hasArgs - ? new MethodCallExpr(line, column, ret, typeArgs, name, args) - : new FieldAccessExpr(line, column, ret, null, name); - } - | - "(" {line=token.beginLine; column=token.beginColumn;} ret = Expression() ")" { ret = new EnclosedExpr(line, column, ret); } - | - ret = AllocationExpression(null) - | - LOOKAHEAD( ResultType() "." "class" ) - type = ResultType() "." "class" { ret = new ClassExpr(type.getBeginLine(), type.getBeginColumn(), type); } - | - { name = token.image; line=token.beginLine; column=token.beginColumn; } - [ args = Arguments() {hasArgs=true;} ] - { - ret = hasArgs - ? new MethodCallExpr(line, column, null, null, name, args) - : new NameExpr(line, column, name); - } - ) - { return ret; } -} - -Expression PrimarySuffix(Expression scope): -{ - Expression ret; -} -{ - ( - LOOKAHEAD(2) - ret = PrimarySuffixWithoutSuper(scope) - | - "." "super" { ret = new SuperExpr(token.beginLine, token.beginColumn, scope); } - ) - { return ret; } -} - -Expression PrimarySuffixWithoutSuper(Expression scope): -{ - Expression ret; - List typeArgs = null; - List args = null; - boolean hasArgs = false; - String name; - int line = -1; - int column = 0; -} -{ - ( - "." - ( - "this" { ret = new ThisExpr(token.beginLine, token.beginColumn, scope); } - | - ret = AllocationExpression(scope) - | - LOOKAHEAD( [ TypeArguments() ] ) - [ typeArgs = TypeArguments() {line=((Type)typeArgs.get(0)).getBeginLine(); column=((Type)typeArgs.get(0)).getBeginColumn();} ] - { name = token.image; if (line==-1) { line=token.beginLine; column=token.beginColumn; } } - [ args = Arguments() {hasArgs=true;} ] - { - ret = hasArgs - ? new MethodCallExpr(line, column, scope, typeArgs, name, args) - : new FieldAccessExpr(line, column, scope, typeArgs, name); - } - ) - | - "[" {line=token.beginLine; column=token.beginColumn;} ret = Expression() "]" { ret = new ArrayAccessExpr(line, column, scope, ret); } - ) - { return ret; } -} - -Expression Literal(): -{ - Expression ret; -} -{ - ( - { - ret = new IntegerLiteralExpr(token.beginLine, token.beginColumn, token.image); - } - | - { - ret = new LongLiteralExpr(token.beginLine, token.beginColumn, token.image); - } - | - { - ret = new DoubleLiteralExpr(token.beginLine, token.beginColumn, token.image); - } - | - { - ret = new CharLiteralExpr(token.beginLine, token.beginColumn, token.image.substring(1, token.image.length()-1)); - } - | - { - ret = new StringLiteralExpr(token.beginLine, token.beginColumn, token.image.substring(1, token.image.length()-1)); - } - | - ret = BooleanLiteral() - | - ret = NullLiteral() - ) - { return ret; } -} - -Expression BooleanLiteral(): -{ - Expression ret; -} -{ - ( - "true" { ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, Boolean.TRUE); } - | - "false" { ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, Boolean.FALSE); } - ) - { return ret; } -} - -Expression NullLiteral(): -{} -{ - "null" - { return new NullLiteralExpr(token.beginLine, token.beginColumn); } -} - -List Arguments(): -{ - List ret = null; -} -{ - "(" [ ret = ArgumentList() ] ")" - { return ret; } -} - -List ArgumentList(): -{ - List ret = new LinkedList(); - Expression expr; -} -{ - expr = Expression() { ret.add(expr); } ( "," expr = Expression() { ret.add(expr); } )* - { return ret; } -} - -Expression AllocationExpression(Expression scope): -{ - Expression ret; - Type type; - Object[] arr = null; - List typeArgs = null; - List anonymousBody = null; - List args; - int line; - int column; -} -{ - "new" {line=token.beginLine; column=token.beginColumn;} - ( - type = PrimitiveType() arr = ArrayDimsAndInits() - { - if (arr[0] instanceof Integer) { - ret = new ArrayCreationExpr(line, column, type, null, ((Integer)arr[0]).intValue(), (ArrayInitializerExpr)arr[1]); - } else { - ret = new ArrayCreationExpr(line, column, type, null, (List)arr[0], ((Integer)arr[1]).intValue()); - } - } - | - [ typeArgs = TypeArguments() ] - type = ClassOrInterfaceType() - ( - arr = ArrayDimsAndInits() - { - if (arr[0] instanceof Integer) { - ret = new ArrayCreationExpr(line, column, type, typeArgs, ((Integer)arr[0]).intValue(), (ArrayInitializerExpr)arr[1]); - } else { - ret = new ArrayCreationExpr(line, column, type, typeArgs, (List)arr[0], ((Integer)arr[1]).intValue()); - } - } - | - args = Arguments() [ LOOKAHEAD(2) anonymousBody = ClassOrInterfaceBody(false) ] - { ret = new ObjectCreationExpr(line, column, scope, (ClassOrInterfaceType) type, typeArgs, args, anonymousBody); } - ) - ) - { return ret; } -} - -/* - * The third LOOKAHEAD specification below is to parse to PrimarySuffix - * if there is an expression between the "[...]". - */ -Object[] ArrayDimsAndInits(): -{ - Object[] ret = new Object[2]; - Expression expr; - List inits = null; - int i = 0; -} -{ - ( - LOOKAHEAD(2) - ( LOOKAHEAD(2) "[" expr = Expression() { inits = add(inits, expr); } "]" )+ ( LOOKAHEAD(2) "[" "]" { i++; } )* { ret[0] = inits; ret[1] = new Integer(i); } - | - ( "[" "]" { i++; } )+ expr = ArrayInitializer() { ret[0] = new Integer(i); ret[1] = expr; } - ) - { return ret; } -} - - -/* - * Statement syntax follows. - */ - -Statement Statement(): -{ - Statement ret; -} -{ - ( - LOOKAHEAD(2) - ret = LabeledStatement() - | - ret = AssertStatement() - | - ret = Block() - | - ret = EmptyStatement() - | - ret = StatementExpression() - | - ret = SwitchStatement() - | - ret = IfStatement() - | - ret = WhileStatement() - | - ret = DoStatement() - | - ret = ForStatement() - | - ret = BreakStatement() - | - ret = ContinueStatement() - | - ret = ReturnStatement() - | - ret = ThrowStatement() - | - ret = SynchronizedStatement() - | - ret = TryStatement() - ) - { return ret; } -} - -AssertStmt AssertStatement(): -{ - Expression check; - Expression msg = null; - int line; - int column; -} -{ - "assert" {line=token.beginLine; column=token.beginColumn;} check = Expression() [ ":" msg = Expression() ] ";" - { return new AssertStmt(line, column, check, msg); } -} - -LabeledStmt LabeledStatement(): -{ - String label; - Statement stmt; - int line; - int column; -} -{ - {line=token.beginLine; column=token.beginColumn;} { label = token.image; } ":" stmt = Statement() - { return new LabeledStmt(line, column, label, stmt); } -} - -BlockStmt Block(): -{ - List stmts; - int beginLine; - int beginColumn; - int endLine; - int endColumn; -} -{ - "{" {beginLine=token.beginLine; beginColumn=token.beginColumn;} - stmts = Statements() - "}" {endLine=token.beginLine; endColumn=token.beginColumn;} - { return new BlockStmt(beginLine, beginColumn, endLine, endColumn, stmts); } -} - -/* - * Classes inside block stametents can only be abstract or final. The semantic must check it. - */ -Statement BlockStatement(): -{ - Statement ret; - Expression expr; - ClassOrInterfaceDeclaration typeDecl; - Modifier modifier; -} -{ - ( - LOOKAHEAD( Modifiers() ("class" | "interface") ) - { pushJavadoc(); } - modifier = Modifiers() - typeDecl = ClassOrInterfaceDeclaration(modifier) { ret = new TypeDeclarationStmt(typeDecl.getBeginLine(), typeDecl.getBeginColumn(), typeDecl); } - | - LOOKAHEAD(VariableDeclarationExpression() ) - expr = VariableDeclarationExpression() { ret = new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), expr); } ";" - | - ret = Statement() - ) - { return ret; } -} - -VariableDeclarationExpr VariableDeclarationExpression(): -{ - Modifier modifier; - Type type; - List vars = new LinkedList(); - VariableDeclarator var; -} -{ - modifier = Modifiers() type = Type() var = VariableDeclarator() { vars.add(var); } ( "," var = VariableDeclarator() { vars.add(var); } )* - { return new VariableDeclarationExpr(type.getBeginLine(), type.getBeginColumn(), modifier.modifiers, modifier.annotations, type, vars); } -} - -EmptyStmt EmptyStatement(): -{} -{ - ";" - { return new EmptyStmt(token.beginLine, token.beginColumn); } -} - -ExpressionStmt StatementExpression(): -/* - * The last expansion of this production accepts more than the legal - * Java expansions for StatementExpression. This expansion does not - * use PostfixExpression for performance reasons. - */ -{ - Expression expr; - AssignExpr.Operator op; - Expression value; -} -{ - ( - expr = PreIncrementExpression() - | - expr = PreDecrementExpression() - | - expr = PrimaryExpression() - [ - "++" { expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), expr, UnaryExpr.Operator.posIncrement); } - | - "--" { expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), expr, UnaryExpr.Operator.posDecrement); } - | - op = AssignmentOperator() value = Expression() { expr = new AssignExpr(expr.getBeginLine(), expr.getBeginColumn(), expr, value, op); } - ] - ) - ";" - { return new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), expr); } -} - -SwitchStmt SwitchStatement(): -{ - Expression selector; - SwitchEntryStmt entry; - List entries = null; - int line; - int column; -} -{ - "switch" {line=token.beginLine; column=token.beginColumn;} "(" selector = Expression() ")" "{" - ( entry = SwitchEntry() { entries = add(entries, entry); } )* - "}" - - { return new SwitchStmt(line, column, selector, entries); } -} - -SwitchEntryStmt SwitchEntry(): -{ - Expression label = null; - List stmts; - int line; - int column; -} -{ - ( - "case" {line=token.beginLine; column=token.beginColumn;} label = Expression() - | - "default" {line=token.beginLine; column=token.beginColumn;} - ) - ":" stmts = Statements() - - { return new SwitchEntryStmt(line, column, label, stmts); } -} - -IfStmt IfStatement(): -/* - * The disambiguating algorithm of JavaCC automatically binds dangling - * else's to the innermost if statement. The LOOKAHEAD specification - * is to tell JavaCC that we know what we are doing. - */ -{ - Expression condition; - Statement thenStmt; - Statement elseStmt = null; - int line; - int column; -} -{ - "if" {line=token.beginLine; column=token.beginColumn;} "(" condition = Expression() ")" thenStmt = Statement() [ LOOKAHEAD(1) "else" elseStmt = Statement() ] - { return new IfStmt(line, column, condition, thenStmt, elseStmt); } -} - -WhileStmt WhileStatement(): -{ - Expression condition; - Statement body; - int line; - int column; -} -{ - "while" {line=token.beginLine; column=token.beginColumn;} "(" condition = Expression() ")" body = Statement() - { return new WhileStmt(line, column, condition, body); } -} - -DoStmt DoStatement(): -{ - Expression condition; - Statement body; - int line; - int column; -} -{ - "do" {line=token.beginLine; column=token.beginColumn;} body = Statement() "while" "(" condition = Expression() ")" ";" - { return new DoStmt(line, column, body, condition); } -} - -Statement ForStatement(): -{ - String id = null; - VariableDeclarationExpr varExpr = null; - Expression expr = null; - List init = null; - List update = null; - Statement body; - int line; - int column; -} -{ - "for" {line=token.beginLine; column=token.beginColumn;} "(" - - ( - LOOKAHEAD(VariableDeclarationExpression() ":") - varExpr = VariableDeclarationExpression() ":" expr = Expression() - | - [ init = ForInit() ] ";" [ expr = Expression() ] ";" [ update = ForUpdate() ] - ) - - ")" body = Statement() - - { - if (varExpr != null) { - return new ForeachStmt(line, column, varExpr, expr, body); - } - return new ForStmt(line, column, init, expr, update, body); - } -} - -List ForInit(): -{ - List ret; - Expression expr; -} -{ - ( - LOOKAHEAD( Modifiers() Type() ) - expr = VariableDeclarationExpression() { ret = new LinkedList(); ret.add(expr); } - | - ret = ExpressionList() - ) - { return ret; } -} - -List ExpressionList(): -{ - List ret = new LinkedList(); - Expression expr; -} -{ - expr = Expression() { ret.add(expr); } ( "," expr = Expression() { ret.add(expr); } )* - - { return ret; } -} - -List ForUpdate(): -{ - List ret; -} -{ - ret = ExpressionList() - - { return ret; } -} - -BreakStmt BreakStatement(): -{ - String id = null; - int line; - int column; -} -{ - "break" {line=token.beginLine; column=token.beginColumn;} [ { id = token.image; } ] ";" - { return new BreakStmt(line, column, id); } -} - -ContinueStmt ContinueStatement(): -{ - String id = null; - int line; - int column; -} -{ - "continue" {line=token.beginLine; column=token.beginColumn;} [ { id = token.image; } ] ";" - { return new ContinueStmt(line, column, id); } -} - -ReturnStmt ReturnStatement(): -{ - Expression expr = null; - int line; - int column; -} -{ - "return" {line=token.beginLine; column=token.beginColumn;} [ expr = Expression() ] ";" - { return new ReturnStmt(line, column, expr); } -} - -ThrowStmt ThrowStatement(): -{ - Expression expr; - int line; - int column; -} -{ - "throw" {line=token.beginLine; column=token.beginColumn;} expr = Expression() ";" - { return new ThrowStmt(line, column, expr); } -} - -SynchronizedStmt SynchronizedStatement(): -{ - Expression expr; - BlockStmt block; - int line; - int column; -} -{ - "synchronized" {line=token.beginLine; column=token.beginColumn;} "(" expr = Expression() ")" block = Block() - { return new SynchronizedStmt(line, column, expr, block); } -} - -TryStmt TryStatement(): -/* - * Semantic check required here to make sure that at least one - * finally/catch is present. - */ -{ - BlockStmt tryBlock; - BlockStmt finallyBlock = null; - List catchs = null; - Parameter except; - BlockStmt catchBlock; - int line; - int column; - int cLine; - int cColumn; -} -{ - "try" {line=token.beginLine; column=token.beginColumn;} tryBlock = Block() - ( - ( - "catch" {cLine=token.beginLine; cColumn=token.beginColumn;} - "(" except = FormalParameter() ")" catchBlock = Block() - { catchs = add(catchs, new CatchClause(cLine, cColumn, except, catchBlock)); } - )+ - [ "finally" finallyBlock = Block() ] - | - "finally" finallyBlock = Block() - ) - { return new TryStmt(line, column, tryBlock, catchs, finallyBlock); } -} - - - -/* We use productions to match >>>, >> and > so that we can keep the - * type declaration syntax with generics clean - */ - -void RUNSIGNEDSHIFT(): -{} -{ - ( LOOKAHEAD({ getToken(1).kind == GT && - ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) - ">" ">" ">" - ) -} - -void RSIGNEDSHIFT(): -{} -{ - ( LOOKAHEAD({ getToken(1).kind == GT && - ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) - ">" ">" - ) -} - -/* Annotation syntax follows. */ - -AnnotationExpr Annotation(): -{ - AnnotationExpr ret; -} -{ - ( - LOOKAHEAD( "@" Name() "(" ( "=" | ")" )) - ret = NormalAnnotation() - | - LOOKAHEAD( "@" Name() "(" ) - ret = SingleMemberAnnotation() - | - ret = MarkerAnnotation() - ) - { return ret; } -} - -NormalAnnotationExpr NormalAnnotation(): -{ - NameExpr name; - List pairs = null; - int line; - int column; -} -{ - "@" {line=token.beginLine; column=token.beginColumn;} name = Name() "(" [ pairs = MemberValuePairs() ] ")" - { return new NormalAnnotationExpr(line, column, name, pairs); } -} - -MarkerAnnotationExpr MarkerAnnotation(): -{ - NameExpr name; - int line; - int column; -} -{ - "@" {line=token.beginLine; column=token.beginColumn;} name = Name() - { return new MarkerAnnotationExpr(line, column, name); } -} - -SingleMemberAnnotationExpr SingleMemberAnnotation(): -{ - NameExpr name; - Expression memberVal; - int line; - int column; -} -{ - "@" {line=token.beginLine; column=token.beginColumn;} name = Name() "(" memberVal = MemberValue() ")" - { return new SingleMemberAnnotationExpr(line, column, name, memberVal); } -} - -List MemberValuePairs(): -{ - List ret = new LinkedList(); - MemberValuePair pair; -} -{ - pair = MemberValuePair() { ret.add(pair); } ( "," pair = MemberValuePair() { ret.add(pair); } )* - { return ret; } -} - -MemberValuePair MemberValuePair(): -{ - String name; - Expression value; - int line; - int column; -} -{ - { name = token.image; line=token.beginLine; column=token.beginColumn;} "=" value = MemberValue() - { return new MemberValuePair(line, column, name, value); } -} - -Expression MemberValue(): -{ - Expression ret; -} -{ - ( - ret = Annotation() - | - ret = MemberValueArrayInitializer() - | - ret = ConditionalExpression() - ) - { return ret; } -} - -Expression MemberValueArrayInitializer(): -{ - List ret = new LinkedList(); - Expression member; - int line; - int column; -} -{ - "{" {line=token.beginLine; column=token.beginColumn;} - ( member = MemberValue() { ret.add(member); } ( LOOKAHEAD(2) "," member = MemberValue() { ret.add(member); } )* )? [ "," ] - "}" - { return new ArrayInitializerExpr(line, column, ret); } -} - - -/* Annotation Types. */ - -AnnotationDeclaration AnnotationTypeDeclaration(Modifier modifier): -{ - String name; - List members; - int line; - int column; -} -{ - "@" {line=token.beginLine; column=token.beginColumn;} "interface" { name = token.image; } members = AnnotationTypeBody() - - { return new AnnotationDeclaration(line, column, popJavadoc(), modifier.modifiers, modifier.annotations, name, members); } -} - -List AnnotationTypeBody(): -{ - List ret = null; - BodyDeclaration member; -} -{ - "{" ( member = AnnotationBodyDeclaration() { ret = add(ret, member); } )* "}" - - { return ret; } -} - -BodyDeclaration AnnotationBodyDeclaration(): -{ - Modifier modifier; - BodyDeclaration ret; -} -{ - { pushJavadoc(); } - ( - ";" { ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, popJavadoc()); } - | - modifier = Modifiers() - ( - LOOKAHEAD(Type() "(") - ret = AnnotationTypeMemberDeclaration(modifier) - | - ret = ClassOrInterfaceDeclaration(modifier) - | - ret = EnumDeclaration(modifier) - | - ret = AnnotationTypeDeclaration(modifier) - | - ret = FieldDeclaration(modifier) - ) - ) - { return ret; } -} - -AnnotationMemberDeclaration AnnotationTypeMemberDeclaration(Modifier modifier): -{ - Type type; - String name; - Expression defaultVal = null; -} -{ - type = Type() { name = token.image; } "(" ")" [ defaultVal = DefaultValue() ] ";" - - { return new AnnotationMemberDeclaration(type.getBeginLine(), type.getBeginColumn(), popJavadoc(), modifier.modifiers, modifier.annotations, type, name, defaultVal); } -} - -Expression DefaultValue(): -{ - Expression ret; -} -{ - "default" ret = MemberValue() - { return ret; } -} diff --git a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/TestAdapters.java b/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/TestAdapters.java deleted file mode 100644 index 936735e..0000000 --- a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/TestAdapters.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 11/06/2008 - */ -package japa.parser.ast.test; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.test.classes.DumperTestClass; -import japa.parser.ast.visitor.GenericVisitorAdapter; -import japa.parser.ast.visitor.VoidVisitorAdapter; - -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.StringBufferInputStream; - -import junit.framework.TestCase; - -/** - * @author Julio Vilmar Gesser - */ -public class TestAdapters extends TestCase { - - private String readFile(String fileName) throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); - try { - StringBuilder ret = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - ret.append(line); - ret.append("\n"); - } - return ret.toString(); - } finally { - reader.close(); - } - } - - public void testVoidVisitorAdapter() throws Exception { - String source = readFile("./test/" + DumperTestClass.class.getName().replace('.', '/') + ".java"); - CompilationUnit cu = JavaParser.parse(new StringBufferInputStream(source)); - cu.accept(new VoidVisitorAdapter(), null); - } - - public void testGenericVisitorAdapter() throws Exception { - String source = readFile("./test/" + DumperTestClass.class.getName().replace('.', '/') + ".java"); - CompilationUnit cu = JavaParser.parse(new StringBufferInputStream(source)); - cu.accept(new GenericVisitorAdapter(), null); - } - -} diff --git a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/TestDumper.java b/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/TestDumper.java deleted file mode 100644 index ab8d77c..0000000 --- a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/TestDumper.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2007 Júlio Vilmar Gesser. - * - * This file is part of Java 1.5 parser and Abstract Syntax Tree. - * - * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Java 1.5 parser and Abstract Syntax Tree. If not, see . - */ -/* - * Created on 22/11/2006 - */ -package japa.parser.ast.test; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.test.classes.DumperTestClass; -import japa.parser.ast.test.classes.JavadocTestClass; - -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.StringBufferInputStream; - -import junit.framework.TestCase; - -/** - * @author Julio Vilmar Gesser - */ -public class TestDumper extends TestCase { - - private String readFile(String fileName) throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); - try { - StringBuilder ret = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - ret.append(line); - ret.append("\n"); - } - return ret.toString(); - } finally { - reader.close(); - } - } - - public void testDumpVisitor() throws Exception { - String source = readFile("./test/" + DumperTestClass.class.getName().replace('.', '/') + ".java"); - CompilationUnit cu = JavaParser.parse(new StringBufferInputStream(source)); - assertEquals(source, cu.toString()); - } - - public void testJavadoc() throws Exception { - String source = readFile("./test/" + JavadocTestClass.class.getName().replace('.', '/') + ".java"); - CompilationUnit cu = JavaParser.parse(new StringBufferInputStream(source)); - assertEquals(source, cu.toString()); - assertEquals(19, cu.getComments().size()); - } - - public void testComments() throws Exception { - final String source_with_comment = // - "package japa.parser.javacc;\n" + // - "public class Teste {\n" + // - "//line comment\n" + // - "int a = 0;" + // - "//line comment\r\n" + // - "int b = 0;" + // - "//line comment\r" + // - "int c = 0;" + // - "/* multi-line\n comment\n*/" + // - "int d = 0;" + // - "/** multi-line\r\n javadoc\n*/" + // - "int e = 0;" + // - "}\n" + // - "//final comment" + // - ""; - final String source_without_comment = // - "package japa.parser.javacc;\n" + // - "\n" + // - "public class Teste {\n" + // - "\n" + // - " int a = 0;\n" + // - "\n" + // - " int b = 0;\n" + // - "\n" + // - " int c = 0;\n" + // - "\n" + // - " int d = 0;\n" + // - "\n" + // - " /** multi-line\r\n javadoc\n*/\n" + // - " int e = 0;\n" + // - "}\n" + // - ""; - - CompilationUnit cu = JavaParser.parse(new StringBufferInputStream(source_with_comment)); - assertEquals(source_without_comment, cu.toString()); - assertEquals(6, cu.getComments().size()); - } -} \ No newline at end of file diff --git a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/classes/JavadocTestClass.java b/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/classes/JavadocTestClass.java deleted file mode 100644 index e8b9617..0000000 --- a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/classes/JavadocTestClass.java +++ /dev/null @@ -1,127 +0,0 @@ -package japa.parser.ast.test.classes; - -/** - * Javadoc 1 - * @author Julio Vilmar Gesser - */ -public abstract class JavadocTestClass { - - ; - - /** - * 1.1 - */ - ; - - private static int x; - - /** - * 1.2 - */ - private int y[]; - - /** - * 1.3 - */ - @Annotation(x = 10) - private int z; - - private static final int m(int x) { - return 0; - } - - /** - * 1.4 - * @param x - * @return - */ - private static final int m2(int x) { - x = 10; - /** - * 1.4.1 - * @author jgesser - */ - class Teste { - - /** - * 1.4.1.1 - */ - int x; - } - return 0; - } - - /** - * 1.5 - */ - public JavadocTestClass() { - } - - /** - * 1.5 - */ - public JavadocTestClass(int x) { - } - - /** - * 1.6 - * init - */ - { - z = 10; - } - - /** - * 1.6 - * init - */ - static { - x = 10; - } -} - -/** - * Javadoc 2 - */ -@Deprecated -@SuppressWarnings(value = "") -abstract class Class2 { -} - -/** - * Javadoc 3 - */ -; - -/** - * Javadoc 4 - */ -enum Enum { - - /** - * 4.1 - */ - item1, item2, item3, /** - * 4.2 - */ - item4 -} - -/** - * Javadoc 5 - */ -@interface Annotation { - - ; - - /** - * Javadoc 5.1 - * @return - */ - int x(); - - /** - * Javadoc 5.2 - */ - ; -} \ No newline at end of file diff --git a/Assignment-2/javaparser-1.0.0/LCA_JP3_27_0.java b/Assignment-2/javaparser-1.0.0/LCA_JP3_27_0.java new file mode 100644 index 0000000..bf606a8 --- /dev/null +++ b/Assignment-2/javaparser-1.0.0/LCA_JP3_27_0.java @@ -0,0 +1,54 @@ +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; + +import java.io.File; +import java.io.FileInputStream; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_8; + +public class LCA_JP3_27_0 { + + public static void main(String[] args) throws Exception { + if (args.length == 0) { + System.out.println("Usage: java LCA_JP3_27_0 "); + return; + } + + // Configure parser for Java 8 + ParserConfiguration config = new ParserConfiguration(); + config.setLanguageLevel(JAVA_8); + JavaParser parser = new JavaParser(config); + + // Parse the file + FileInputStream in = new FileInputStream(new File(args[0])); + CompilationUnit cu = parser.parse(in).getResult().get(); + in.close(); + + // Visit and find local classes + LocalClassVisitor visitor = new LocalClassVisitor(); + visitor.visit(cu, null); + } + + static class LocalClassVisitor extends VoidVisitorAdapter { + private boolean insideMethod = false; + + @Override + public void visit(MethodDeclaration n, Void arg) { + insideMethod = true; + super.visit(n, arg); + insideMethod = false; + } + + @Override + public void visit(ClassOrInterfaceDeclaration n, Void arg) { + if (insideMethod) { + System.out.println("Local class: " + n.getNameAsString()); + } + super.visit(n, arg); + } + } +} \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.git-blame-ignore-revs b/Assignment-2/javaparser-javaparser-parent-3.27.0/.git-blame-ignore-revs new file mode 100644 index 0000000..ebc0b49 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.git-blame-ignore-revs @@ -0,0 +1,3 @@ +# Applied automatic formatting to the entire project +# See https://github.com/javaparser/javaparser/issues/4408 for details +5106428130cd3ff052a57d37a3d192f040da5edf diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.gitattributes b/Assignment-2/javaparser-javaparser-parent-3.27.0/.gitattributes new file mode 100644 index 0000000..f7bd708 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.gitattributes @@ -0,0 +1 @@ +*.java text eol=lf diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/dependabot.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/dependabot.yml new file mode 100644 index 0000000..b76b895 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/renovate.json b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/renovate.json new file mode 100644 index 0000000..344fad4 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/renovate.json @@ -0,0 +1,17 @@ +{ + "extends": [ + "config:base" + ], + "packageRules": [ + { + "updateTypes": ["minor", "patch", "pin", "digest"], + "automerge": true + } + ], + "automergeType": "pr", + "prHourlyLimit": 0, + "semanticCommits": true, + "dependencyDashboard": true, + "configWarningReuseIssue": false, + "labels": ["dependencies"] +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/create_github_release.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/create_github_release.yml new file mode 100644 index 0000000..ec0d3af --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/create_github_release.yml @@ -0,0 +1,36 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + # - 'v[0-9]+.[0-9]+.[0-9]+' # Push events to matching pattern -- updated to use regex for a semantic versioning version number + - 'javaparser-parent-[0-9].*' # Push events to matching pattern -- loosened pattern to be v followed by at least one number, then anything else after (this allows for e.g. "-DRAFT" and "-SNAPSHOT" as a suffix, and shorter version numbers such as "v2") + +name: Create Release from semantic versioning tag push + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + + - name: Create Release + id: create_release + uses: actions/create-release@v1.1.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + ## Body content doesn't yet seem to appear in the Github UI +# body: | +# Bug Fixes: +# - TODO: Describe any bug fixes +# +# Enhancements: +# - TODO: Describe any new features or enhancements + ## Option -- trigger as a draft release, followed by the addition of any key release notes and manual approval? + ## Alternative -- replace the above body with a link to the changelog? We can always edit release after the fact to add in e.g. notes about breaking changes. + draft: true + prerelease: false diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/formatting_check.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/formatting_check.yml new file mode 100644 index 0000000..ce57ac0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/formatting_check.yml @@ -0,0 +1,63 @@ +name: Check codegen and formatting + +#on: [push, pull_request] +#on: [pull_request] +on: + # Trigger the workflow on push to master (ignoring .md only changes) + push: + branches: + - master + paths-ignore: + - '**.md' + + # Trigger the workflow on any pull_request (ignoring .md only changes) + pull_request: + paths-ignore: + - '**.md' + + # Enable manual triggering (important for contributors to enable a check on their fork) + workflow_dispatch: + +# If a build is running in the current branch, and the branch is updated, we cancel the previous build and start +# a new one with the updated changes. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + # Run checkstyle validations for pipeline + checkstyle_check: + name: Validate checkstyle + runs-on: ubuntu-latest + steps: + - name: Checkout latest code + uses: actions/checkout@v4.2.2 + with: + fetch-depth: "0" + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + - name: Validate Project Checkstyle + run: ./mvnw -B checkstyle:check + + spotless_check: + name: Spotless check + runs-on: ubuntu-latest + steps: + - name: Checkout latest code + uses: actions/checkout@v4.2.2 + with: + fetch-depth: "0" + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + - name: Generate code and format + run: | + ./run_core_metamodel_generator.sh + # ./run_core_generators.sh automatically runs ./mvnw spotless:apply + ./run_core_generators.sh + git diff --exit-code diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/maven_tests.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/maven_tests.yml new file mode 100644 index 0000000..3ac4dd8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/maven_tests.yml @@ -0,0 +1,116 @@ +name: Build and test (using maven) + +#on: [push, pull_request] +#on: [pull_request] +on: + # Trigger the workflow on push to master (ignoring .md only changes) + push: + branches: + - master + paths-ignore: + - '**.md' + + # Trigger the workflow on any pull_request (ignoring .md only changes) + pull_request: + paths-ignore: + - '**.md' + + # Enable manual triggering (important for contributors to enable a check on their fork) + workflow_dispatch: + +# If a build is running in the current branch, and the branch is updated, we cancel the previous build and start +# a new one with the updated changes. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + maven_test: + strategy: + ## Optionally cancel all other combinations if one fails + fail-fast: false + matrix: + ## Different OSs have different default line-endings -- test on all combinations. + os: [ ubuntu-latest, macos-latest, windows-latest ] + ## Different JDK versions have different implementations etc. -- test on all combinations (ideally 8 to latest). + ### exclude pre-8 (min development version jdk8) + jdk: [ 8,9,10,11,12,13,14,15,16,17,18 ] + # The below configurations are no longer available on github runners and is not supported by the + # setup-java action, nor are they available from the supported distributions. + # See https://github.com/actions/setup-java for details + exclude: + - os: macos-latest + jdk: 9 + - os: macos-latest + jdk: 10 + - os: macos-latest + jdk: 12 + - os: macos-latest + jdk: 14 + + env: + OS: ${{ matrix.os }} + JDK: ${{ matrix.jdk }} + + runs-on: ${{ matrix.os }} + + steps: + ## Checkout the current version of the code from the repo. + - name: Checkout latest code + uses: actions/checkout@v4.2.2 + with: + fetch-depth: "0" + + ## Setup the specified version of Java (includes maven/gradle). + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + distribution: 'zulu' # v2 requires explicitly stating the distribution - `zulu` and `adopt` supported at time of writing + java-version: ${{ matrix.jdk }} # Use matrix to select which JDK level to use + java-package: jdk # optional (jdk or jre) - defaults to jdk + + ## Given that the build matrix only specifies the major version (configurable), output the precise version used. + - name: Echo exact java version being used + run: java -version + + ## Use a cache to reduce the build/test times (avoids having to download dependencies on EVERY run). + ### https://help.github.com/en/actions/language-and-framework-guides/building-and-testing-java-with-maven#caching-dependencies + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + + ## Actually perform the tests. Unsuccessful tests will indicate a failed build. + ### -e, --errors : show traces where any errors occur + ### -B,--batch-mode : Run in non-interactive (batch) mode (disables output color) + ### clean : run the maven lifecycle stage `clean` + ### test : run the maven lifecycle stage `test` + ### -P,--activate-profiles : Comma-delimited list of profiles to activate + ### AlsoSlowTests : by default, only quick tests are run - the profile `AlsoSlowTests` runs the full test suite + - name: Test with Maven (incl. slow tests) + shell: bash + run: ./mvnw -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B --errors clean test --activate-profiles AlsoSlowTests + + + - name: CodeCov - JavaParser Core + uses: codecov/codecov-action@v5.4.3 + timeout-minutes: 10 + with: + files: javaparser-core-testing/target/site/jacoco/jacoco.xml,javaparser-core-testing-bdd/target/site/jacoco/jacoco.xml + fail_ci_if_error: false # optional (default = false) -- fail the build if upload to codecov.io fails + verbose: false # optional (default = false): + flags: javaparser-core,AlsoSlowTests,${{ matrix.os }},jdk-${{ matrix.jdk }} + env_vars: OS,JDK + + - name: CodeCov - JavaParser Symbol Solver + uses: codecov/codecov-action@v5.4.3 + timeout-minutes: 10 + with: + file: javaparser-symbol-solver-testing/target/site/jacoco/jacoco.xml + fail_ci_if_error: false # optional (default = false) -- fail the build if upload to codecov.io fails + verbose: false # optional (default = false): + flags: javaparser-symbol-solver,AlsoSlowTests,${{ matrix.os }},jdk-${{ matrix.jdk }} + env_vars: OS,JDK diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/prepare_release_changelog.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/prepare_release_changelog.yml new file mode 100644 index 0000000..3227396 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.github/workflows/prepare_release_changelog.yml @@ -0,0 +1,81 @@ +name: Build Snapshot +on: + push: + branches: [ master ] + + ## (testing only) Trigger the workflow on any pull request + #pull_request: + +jobs: + + generate_changelog: + name: Generate Changelog + runs-on: ubuntu-latest + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4.2.2 + + # Setup Java 11 environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 11 + + # Set environment variables + - name: Generate Changelog + id: vars + shell: bash + working-directory: ./scripts + run: | + ## By convention, the "next" milestone is named "next release" + ./run_generate_changelog_by_milestone_title.sh "next release" + + SHA_LONG=$(git rev-parse HEAD) + SHA_SHORT=$(git rev-parse --short HEAD) + CHANGELOG="$(> $GITHUB_OUTPUT + echo "sha_short=$SHA_SHORT" >> $GITHUB_OUTPUT + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "release_title=$RELEASE_TITLE" >> $GITHUB_OUTPUT + echo "release_tag_name=$RELEASE_TAG_NAME" >> $GITHUB_OUTPUT + + + - name: Output variables + run: | + echo sha_short = ${{ steps.vars.outputs.sha_short }} + echo sha_long = ${{ steps.vars.outputs.sha_long }} + echo changelog = "${{ steps.vars.outputs.changelog }}" + echo changelog = "${{ steps.vars.outputs.release_title }}" + echo changelog = "${{ steps.vars.outputs.release_tag_name }}" + + + # Remove old release drafts by using the curl request for the available releases with draft flag + - name: Remove Old Release Drafts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api repos/{owner}/{repo}/releases \ + --jq '.[] | select(.draft == true) | .id' \ + | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} + + + # Create new release draft - which is not publicly visible and requires manual acceptance + - name: Create Release Draft + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ steps.vars.outputs.release_tag_name }} \ + --target ${{ steps.vars.outputs.sha_long }} \ + --draft \ + --prerelease \ + --title "${{ steps.vars.outputs.release_title }}" \ + --notes-file ./scripts/temp_changelog.md + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.gitignore b/Assignment-2/javaparser-javaparser-parent-3.27.0/.gitignore new file mode 100644 index 0000000..94c98df --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.gitignore @@ -0,0 +1,28 @@ +/lib +bin +.manager +target +.settings +*~ +.project +.classpath +.idea/ +*.iml +release.properties +**/.DS_Store +**/pom.xml.releaseBackup + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +.gradle +*.ipr +*.iws +build-* +*.asc +build +out +.java-version diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/MavenWrapperDownloader.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/maven-wrapper.jar b/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..cb28b0e Binary files /dev/null and b/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/maven-wrapper.jar differ diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/maven-wrapper.properties b/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..2f94e61 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/CONTRIBUTING.md b/Assignment-2/javaparser-javaparser-parent-3.27.0/CONTRIBUTING.md new file mode 100644 index 0000000..574b570 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/CONTRIBUTING.md @@ -0,0 +1,79 @@ +## Getting started +Here is some information that's good to know when contributing to JavaParser: + +- There is some interesting information on the [wiki](https://github.com/javaparser/javaparser/wiki). +- We work on JavaParser because we like to, not because it earns us money. Please remember that we try to run a professional project in our spare time, on a budget of zero. +- Be sure to check [the coding guidelines](https://github.com/javaparser/javaparser/wiki/Coding-Guidelines) which are easily used by installing the formatting rules as described there. +- If you're new and like to casually contribute something, check out the [easy issues](https://github.com/javaparser/javaparser/labels/Easy). +- If you're new and would like to become a member, start your own project that uses JavaParser. +We noticed we get the best feedback from those. +Here are [some fun project ideas](https://github.com/javaparser/javaparser/labels/fun%20project%20idea). +- If you start working on an issue, please say so with a comment in the issue. +- If you know how to fix a problem, please fix it and open a pull request instead of opening an issue. +- If you would like to add new nodes, or new fields to existing nodes, check out the [Guide to Adding New Nodes and Fields](https://github.com/javaparser/javaparser/wiki/A-Detailed-Guide-to-Adding-New-Nodes-and-Fields). + +Thanks for helping! + +## Contribution Workflow + +Our development workflow is based on Pull Request. If you are not familiar with the Pull Requests, we suggest you to checkout the [Github Documentation](https://help.github.com/articles/creating-a-pull-request/) for more information. + +1. **Fork** the JavaParser project. If you already have a fork, ensure to fetch the latest commits. +2. In your forked project, **create a branch** related to the issue you are working on. This is important to ensure that your pull request will not contain unrelated work. +3. When your work in your branch is done, **push your branch to your forked repository**. +4. Go back to the [javaparser project site](https://github.com/javaparser/javaparser) and it should have a message offering to **create a pull request**. If it doesn't you can [create one manually](https://github.com/javaparser/javaparser/compare). + +### Remember: +- A pull request should include tests. You can either use BDD or JUnit. +- Every pull request will automatically be checked by a few tools. Make sure AppVeyor and Travis are green. +- Pull requests often stay open for at least a few days to give people a chance to review it. +- A pull request is merged when all comments on it have been resolved. +- If you create a pull request for an issue, mention the issue in the format #123 to make github link it automatically. +- Before creating a commit (or at least before submitting a pull request), please reformat the project with the instructions given below + to avoid any formatting-related issues during the review. + +### Note on formatting the project: + +- If you are developing on a machine with bash installed, execute `./run_core_metamodel_generator.sh && ./run_core_generators.sh`. This + will re-run all of the code generators and then re-format the entire project as a final step. This ensures that: + - All the code that needs to be generated has been generated correctly. + - None of the changes you've added will be overwritten by code generation in the future. + - All of your changes are correctly formatted (including changes made during code generation, for example whitespace changes). + + The PR check for style runs these generators and checks that the diff after doing so is empty, so if you've run this on your machine, + then that check should not fail. + +- If you are developing on a machine without bash, execute `./mvnw spotless:apply`. This will re-format the project, but without + running the code generators. This will be sufficient in many cases, but it's still possible that changes are introduced during + code generation which would cause the PR style check to fail. If this happens, some manual changes are required. + + To fix this: + 1. Go to the job output for the failed `Spotless check` job by clicking the red cross next to the job. + 2. Scroll to the bottom of the `Generate code and format` output tab. + 3. There, you will see output from the diff command showing what failed. For example, in https://github.com/javaparser/javaparser/actions/runs/10389076737/job/28766249645, + that output is: + ``` + [INFO] ------------------------------------------------------------------------ + diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/RecordPatternExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/RecordPatternExpr.java + index 7bc7f46b9..429889e35 100644 + --- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/RecordPatternExpr.java + +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/RecordPatternExpr.java + @@ -17,7 +17,6 @@ + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + - + package com.github.javaparser.ast.expr; + + import static com.github.javaparser.utils.Utils.assertNotNull; + Error: Process completed with exit code 1. + ``` + + 4. Verify that this output does not overwrite any code you wrote which would change the behaviour. If it does, you probably implemented + something manually when it should've been generated and this will be overwritten next time the code generators are run. This requires + a manual fix to your code to prevent issues in the future. + 5. If no major issues are found, copy this output, excluding the `[INFO] --...` line and the `Error: Process complete with exit code 1.` + line and paste that into a patch file (for example, `/tmp/style.patch`, but the name and location aren't important). + 6. From the javaparser project directory, run `git apply /tmp/style.patch` (substituting `/tmp/style.patch` for the path of your + patch file). `git status` should now show that all the files mentioned in the patch are modified. + 7. Add and commit the changes and push to update the PR. diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/FEATURES.md b/Assignment-2/javaparser-javaparser-parent-3.27.0/FEATURES.md new file mode 100644 index 0000000..4755a33 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/FEATURES.md @@ -0,0 +1,309 @@ + +# Features +This page describes the changes introduced within each version. + +Language-related changes should normally have a validator, used in conjunction with the grammar, as part of the parsing process. + +Where a change is not a language-related change _(e.g. JVM and garbage collection changes)_, this is marked as "Not Applicable (NA)". + +## JDK 1.0 - January 1996 +Source: https://en.wikipedia.org/wiki/Java_version_history#JDK_1.0 +## JDK 1.1 - February 1997 +Source: https://en.wikipedia.org/wiki/Java_version_history#JDK_1.1 +## JDK 1.2 - December 1998 +Source: https://en.wikipedia.org/wiki/Java_version_history#J2SE_1.2 +## JDK 1.3 - May 2000 +Source: https://en.wikipedia.org/wiki/Java_version_history#J2SE_1.3 +## JDK 1.4 - February 2002 +Source: https://en.wikipedia.org/wiki/Java_version_history#J2SE_1.4 +## JDK 5 - September 2004 +Source: https://en.wikipedia.org/wiki/Java_version_history#J2SE_5.0 +## JDK 6 - December 2006 +Source: https://en.wikipedia.org/wiki/Java_version_history#Java_SE_6 + +## JDK 7 - July 2011 +Source: https://en.wikipedia.org/wiki/Java_version_history#Java_SE_7 + + +## JDK 8 - March 2014 +Source: https://en.wikipedia.org/wiki/Java_version_history#Java_SE_8 + +- JSR 335, JEP 126: Language-level support for lambda expressions (officially, lambda expressions; unofficially, closures) under Project Lambda and default methods (virtual extension methods) which allow the addition of methods to interfaces without breaking existing implementations. There was an ongoing debate in the Java community on whether to add support for lambda expressions. Sun later declared that lambda expressions would be included in Java and asked for community input to refine the feature. Supporting lambda expressions also enables functional-style operations on streams of elements, such as MapReduce-inspired transformations on collections. Default methods allow an author of an API to add new methods to an interface without breaking the old code using it. Although it was not their primary intent, default methods also allow multiple inheritance of behavior (but not state). +- JSR 223, JEP 174: Project Nashorn, a JavaScript runtime which allows developers to embed JavaScript code within applications +- JSR 308, JEP 104: Annotation on Java types, Unsigned integer arithmetic +- JSR 337, JEP 120: Repeating annotations +- JSR 310, JEP 150: Date and time API +- JEP 178: Statically-linked JNI libraries +- JEP 153: Launch JavaFX applications (direct launching of JavaFX application JARs) +- JEP 122: Remove the permanent generation + +## JDK 9 - September 2017 +Source: https://en.wikipedia.org/wiki/Java_version_history#Java_SE_9 + +- JSR 376: Modularization of the JDK under Project Jigsaw (Java Platform Module System) +- JEP 222: JShell: The Java Shell (a Java REPL) +- JEP 295: Ahead-of-time compilation +- JEP 268: XML catalogs +- JEP 266: More concurrency updates. It includes a Java implementation of Reactive Streams, including a new Flow class that included the interfaces previously provided by Reactive Streams +- JEP 193: Variable handles: define a standard means to invoke the equivalents of various java.util.concurrent.atomic and sun.misc.Unsafe operations +- JEP 282: jlink: The Java Linker: create a tool that can assemble and optimize a set of modules and their dependencies into a custom run-time image. It effectively allows to produce a fully usable executable including the JVM to run it. JavaDB was removed from JDK +- JEP 263: HiDPI graphics: automatic scaling and sizing +- JEP 254: Compact Strings +- JEP 213: Milling Project Coin + +## JDK 10 - March 2018 +Source: https://openjdk.java.net/projects/jdk/10/ + +Java 10 support [complete on 25/Feb/2018](https://github.com/javaparser/javaparser/blob/master/changelog.md#version-3515) + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:----------------:|:---------------------------------------------------------------:|---------------------------------------------------------| +| [JEP 286](https://openjdk.java.net/jeps/286) | **Release** | **Supported Since: v3.5.15
Released on: 25/Feb/2018** | **Local-Variable Type Inference** | +| [JEP 296](https://openjdk.java.net/jeps/296) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Consolidate the JDK Forest into a Single Repository~~ | +| [JEP 304](https://openjdk.java.net/jeps/304) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Garbage-Collector Interface~~ | +| [JEP 307](https://openjdk.java.net/jeps/307) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Parallel Full GC for G1~~ | +| [JEP 310](https://openjdk.java.net/jeps/310) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Application Class-Data Sharing~~ | +| [JEP 312](https://openjdk.java.net/jeps/312) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Thread-Local Handshakes~~ | +| [JEP 313](https://openjdk.java.net/jeps/313) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Remove the Native-Header Generation Tool (javah)~~ | +| [JEP 314](https://openjdk.java.net/jeps/314) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Additional Unicode Language-Tag Extensions~~ | +| [JEP 316](https://openjdk.java.net/jeps/316) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Heap Allocation on Alternative Memory Devices~~ | +| [JEP 317](https://openjdk.java.net/jeps/317) | ~~Experimental~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Experimental Java-Based JIT Compiler~~ | +| [JEP 319](https://openjdk.java.net/jeps/319) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Root Certificates~~ | +| [JEP 322](https://openjdk.java.net/jeps/322) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Time-Based Release Versioning~~ | + +## JDK 11 - September 2018 +Source: https://openjdk.java.net/projects/jdk/11/ + +Java 11 support [complete on 19/Aug/2018](https://github.com/javaparser/javaparser/blob/master/changelog.md#version-3618) + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:----------------:|:----------------------------------------------------------------------------------------------------:|------------------------------------------------------------------| +| [JEP 323](https://openjdk.java.net/jeps/323) | **Release** | **Supported Since: v3.xx.yy
Released on: dd/mmm/yyyy** | **Local-Variable Syntax for Lambda Parameters** | +| [JEP 327](https://openjdk.java.net/jeps/327) | _Release_ | _Discussion Needed [JEP327](#f_11_JEP327)_ | _Unicode 10_ | +| [JEP 181](https://openjdk.java.net/jeps/181) | _Release_ | _Discussion Needed [JEP181](#f_11_JEP181)_ | _Nest-Based Access Control_ | +| [JEP 309](https://openjdk.java.net/jeps/309) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Dynamic Class-File Constants~~ | +| [JEP 315](https://openjdk.java.net/jeps/315) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Improve Aarch64 Intrinsics~~ | +| [JEP 318](https://openjdk.java.net/jeps/318) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Epsilon: A No-Op Garbage Collector~~ | +| [JEP 320](https://openjdk.java.net/jeps/320) | ~~_Release_~~ | ~~_Not Applicable - Not a language change (NA) [JEP320](#f_11_JEP320)_~~ | ~~Remove the Java EE and CORBA Modules~~ | +| [JEP 321](https://openjdk.java.net/jeps/321) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~HTTP Client (Standard)~~ | +| [JEP 324](https://openjdk.java.net/jeps/324) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Key Agreement with Curve25519 and Curve448~~ | +| [JEP 328](https://openjdk.java.net/jeps/328) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Flight Recorder~~ | +| [JEP 329](https://openjdk.java.net/jeps/329) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ChaCha20 and Poly1305 Cryptographic Algorithms~~ | +| [JEP 330](https://openjdk.java.net/jeps/330) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Launch Single-File Source-Code Programs~~ | +| [JEP 331](https://openjdk.java.net/jeps/331) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Low-Overhead Heap Profiling~~ | +| [JEP 332](https://openjdk.java.net/jeps/332) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Transport Layer Security (TLS) 1.3~~ | +| [JEP 333](https://openjdk.java.net/jeps/333) | ~~Experimental~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ZGC: A Scalable Low-Latency Garbage Collector (Experimental)~~ | +| [JEP 335](https://openjdk.java.net/jeps/335) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Deprecate the Nashorn JavaScript Engine~~ | +| [JEP 336](https://openjdk.java.net/jeps/336) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Deprecate the Pack200 Tools and API~~ | + +##### Footnotes: + +- JEP181 - Based on a cursory reading of this JEP, it is unclear if this is a change that affects JavaParser. + Comments/discussion on this are welcomed. [↩](#a_11_JEP181) +- JEP327 - Based on a cursory reading of this JEP, it is unclear if this is a change that affects JavaParser. + Comments/discussion on this are welcomed. [↩](#a_11_JEP327) +- JEP320 - JEP 320 is marked as NA. This is because JavaParser does not make use of classes within these packages, + and any users of JavaParser will need to provide the relevant files in order to do parsing/solving + (e.g. as source files, a jar, or via reflection). [↩](#a_11_JEP320) + + +## JDK 12 - March 2019 +Source: https://openjdk.java.net/projects/jdk/12/ + +Parsing support for Java 12 (including preview features) [complete on 03/Feb/2019](https://github.com/javaparser/javaparser/blob/master/changelog.md#version-3110) + +Resolution support for Java 12 complete on ??/??/2019 + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:----------------:|:---------------------------------------------------------------:|-------------------------------------------------------------------| +| [JEP 325](https://openjdk.java.net/jeps/325) | **_Preview_** | **Supported Since: v3.11.0
Released on: 03/Feb/2019** | Switch Expressions (Preview) | +| [JEP 189](https://openjdk.java.net/jeps/189) | ~~Experimental~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)~~ | +| [JEP 230](https://openjdk.java.net/jeps/230) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Microbenchmark Suite~~ | +| [JEP 334](https://openjdk.java.net/jeps/334) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~JVM Constants API~~ | +| [JEP 340](https://openjdk.java.net/jeps/340) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~One AArch64 Port, Not Two~~ | +| [JEP 341](https://openjdk.java.net/jeps/341) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Default CDS Archives~~ | +| [JEP 344](https://openjdk.java.net/jeps/344) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Abortable Mixed Collections for G1~~ | +| [JEP 346](https://openjdk.java.net/jeps/346) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Promptly Return Unused Committed Memory from G1~~ | + +## JDK 13 - September 2018 +Source: https://openjdk.java.net/projects/jdk/13/ + +No language specification changes in JDK 13 -- thus no "complete" date. Details of preview support is below. + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:-------------:|:---------------------------------------------------------------:|---------------------------------------| +| [JEP 354](https://openjdk.java.net/jeps/354) | **_Preview_** | **Supported Since: v3.11.0
Released on: 03/Feb/2019** | Switch Expressions (Preview) | +| [JEP 355](https://openjdk.java.net/jeps/355) | **_Preview_** | **Supported Since: v3.14.0
Released on: 05/May/2019** | Text Blocks (Preview) | +| [JEP 350](https://openjdk.java.net/jeps/350) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Dynamic CDS Archives~~ | +| [JEP 351](https://openjdk.java.net/jeps/351) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ZGC: Uncommit Unused Memory~~ | +| [JEP 353](https://openjdk.java.net/jeps/353) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Reimplement the Legacy Socket API~~ | + + + +## JDK 14 - March 2020 +Source: https://openjdk.java.net/projects/jdk/14/ + +Switch support was complete during preview status. + +The preview features of records are work-in-progress. + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:---------------:|:-----------------------------------------------------------------------------------------------------------------:|---------------------------------------------------------------| +| [JEP 361](https://openjdk.java.net/jeps/361) | **Release** | **Supported Since: v3.xx.yy
Released on: dd/mmm/yyyy** | **Switch Expressions (Standard)** | +| [JEP 368](https://openjdk.java.net/jeps/368) | **2nd Preview** | **Supported Since: v3.14.0
Released on: 05/May/2019** | **Text Blocks (Second Preview)** | +| [JEP 305](https://openjdk.java.net/jeps/305) | **_Preview_** | **Supported Since: v3.18.0
Released on: 01/Dec/2020** | **Pattern Matching for `instanceof` (Preview)** | +| [JEP 359](https://openjdk.java.net/jeps/359) | **_Preview_** | **Partial Support Since: v3.22.0
Released on: 11/May/2021 [JEP343](#f_14_JEP359)** | **Records (Preview)** | +| [JEP 343](https://openjdk.java.net/jeps/343) | ~~_Incubator_~~ | ~~_Not Applicable (NA)[JEP343](#f_14_JEP343)_~~ | ~~Packaging Tool (Incubator)~~ | +| [JEP 345](https://openjdk.java.net/jeps/345) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~NUMA-Aware Memory Allocation for G1~~ | +| [JEP 349](https://openjdk.java.net/jeps/349) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~JFR Event Streaming~~ | +| [JEP 352](https://openjdk.java.net/jeps/352) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Non-Volatile Mapped Byte Buffers~~ | +| [JEP 358](https://openjdk.java.net/jeps/358) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Helpful NullPointerExceptions~~ | +| [JEP 362](https://openjdk.java.net/jeps/362) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Deprecate the Solaris and SPARC Ports~~ | +| [JEP 363](https://openjdk.java.net/jeps/363) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Remove the Concurrent Mark Sweep (CMS) Garbage Collector~~ | +| [JEP 364](https://openjdk.java.net/jeps/364) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ZGC on macOS~~ | +| [JEP 365](https://openjdk.java.net/jeps/365) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ZGC on Windows~~ | +| [JEP 366](https://openjdk.java.net/jeps/366) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Deprecate the ParallelScavenge + SerialOld GC Combination~~ | +| [JEP 367](https://openjdk.java.net/jeps/367) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Remove the Pack200 Tools and API~~ | +| [JEP 370](https://openjdk.java.net/jeps/370) | ~~_Release_~~ | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Foreign-Memory Access API (Incubator)~~ | + +##### Footnotes: + +- JEP343 - JEP 343 is marked as not applicable, as it relates to packaging of apps - e.g. as `.exe`/`.msi`/`.deb`/`.rpm`/`.pkg`/`.dmg`. + The JEP describes the layout/structure of the output file, suggesting that _maybe_ in the future the files may be examined, and _potentially_ used similarly to a `.jar` or set of `.class` files. + This is not going to be actively pursued (_especially_ since this is still in the incubator stage), though tested PRs are always welcome. + [↩](#a_14_JEP343) + + +- JEP359 - The behaviour of records changed between preview/2nd preview/release. + Unless otherwise stated, the JavaParser implementation follows the released behaviour. + Additionally, note that "partial" support refers to javaparser-core being complete since 3.21.0, and javaparser-symbol-solver-core support is TBC. + [↩](#a_14_JEP359) + + + +## JDK 15 - September 2020 +Source: https://openjdk.java.net/projects/jdk/15/ + +Note: Unless otherwise stated, the JavaParser implementations of features follows the released behaviour. + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:---------------:|:-----------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------| +| [JEP 378](https://openjdk.java.net/jeps/378) | **_Release_** | **Supported Since: v3.14.0
Released on: 05/May/2019** | **Text Blocks** | +| [JEP 384](https://openjdk.java.net/jeps/384) | **_Release_** | **Partial Support Since: v3.22.0
Released on: 11/May/2021 [JEP384](#f_15_JEP384)** | **Records (Second Preview)** | +| [JEP 375](https://openjdk.java.net/jeps/375) | **_Release_** | **Supported Since: v3.18.0
Released on: 01/Dec/2020** | **Pattern Matching for `instanceof` (Second Preview)** | +| [JEP 360](https://openjdk.java.net/jeps/360) | **_Preview_** | | **Sealed Classes (Preview)** | +| [JEP 339](https://openjdk.java.net/jeps/339) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Edwards-Curve Digital Signature Algorithm (EdDSA)~~ | +| [JEP 371](https://openjdk.java.net/jeps/371) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Hidden Classes~~ | +| [JEP 372](https://openjdk.java.net/jeps/372) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Remove the Nashorn JavaScript Engine~~ | +| [JEP 373](https://openjdk.java.net/jeps/373) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Reimplement the Legacy DatagramSocket API~~ | +| [JEP 374](https://openjdk.java.net/jeps/374) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Disable and Deprecate Biased Locking~~ | +| [JEP 377](https://openjdk.java.net/jeps/377) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ZGC: A Scalable Low-Latency Garbage Collector~~ | +| [JEP 379](https://openjdk.java.net/jeps/379) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Shenandoah: A Low-Pause-Time Garbage Collector~~ | +| [JEP 381](https://openjdk.java.net/jeps/381) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Remove the Solaris and SPARC Ports~~ | +| [JEP 383](https://openjdk.java.net/jeps/383) | **_Incubator_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Foreign-Memory Access API (Second Incubator)~~ | +| [JEP 385](https://openjdk.java.net/jeps/385) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Deprecate RMI Activation for Removal~~ | + +- JEP384 - The behaviour of records changed between preview/2nd preview/release. + Unless otherwise stated, the JavaParser implementation follows the released behaviour. + Additionally, note that "partial" support refers to javaparser-core being complete since 3.21.0, and javaparser-symbol-solver-core support is TBC. + [↩](#a_15_JEP384) + + + +## JDK 16 - March 2021 +Source: https://openjdk.java.net/projects/jdk/16/ + +Note: Unless otherwise stated, the JavaParser implementations of features follows the released behaviour. + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------:|---------------------------------------------------| +| [JEP 395](https://openjdk.java.net/jeps/395) | **_Release_** | **Parser Support Since: v3.22.0
Released on: 11/May/2021, Solving TBC [JEP395](#f_16_JEP395)** | **Records** | +| [JEP 394](https://openjdk.java.net/jeps/394) | **_Release_** | **Supported Since: v3.18.0
Released on: 01/Dec/2020** | **Pattern Matching for `instanceof`** | +| [JEP 397](https://openjdk.java.net/jeps/397) | **2nd Preview** | | **Sealed Classes (Second Preview)** | +| [JEP 338](https://openjdk.java.net/jeps/338) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Vector API (Incubator)~~ | +| [JEP 347](https://openjdk.java.net/jeps/347) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Enable C++14 Language Features~~ | +| [JEP 357](https://openjdk.java.net/jeps/357) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Migrate from Mercurial to Git~~ | +| [JEP 369](https://openjdk.java.net/jeps/369) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Migrate to GitHub~~ | +| [JEP 376](https://openjdk.java.net/jeps/376) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~ZGC: Concurrent Thread-Stack Processing~~ | +| [JEP 380](https://openjdk.java.net/jeps/380) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Unix-Domain Socket Channels~~ | +| [JEP 386](https://openjdk.java.net/jeps/386) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Alpine Linux Port~~ | +| [JEP 387](https://openjdk.java.net/jeps/387) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Elastic Metaspace~~ | +| [JEP 388](https://openjdk.java.net/jeps/388) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Windows/AArch64 Port~~ | +| [JEP 389](https://openjdk.java.net/jeps/389) | **_Incubator_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Foreign Linker API (Incubator)~~ | +| [JEP 390](https://openjdk.java.net/jeps/390) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Warnings for Value-Based Classes~~ | +| [JEP 392](https://openjdk.java.net/jeps/392) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Packaging Tool~~ | +| [JEP 393](https://openjdk.java.net/jeps/393) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Foreign-Memory Access API (Third Incubator)~~ | +| [JEP 396](https://openjdk.java.net/jeps/396) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | ~~Strongly Encapsulate JDK Internals by Default~~ | + +- JEP395 - The behaviour of records changed between preview/2nd preview/release. + Unless otherwise stated, the JavaParser implementation follows the released behaviour. + Additionally, note that "partial" support refers to javaparser-core being complete since 3.21.0, and javaparser-symbol-solver-core support is TBC. + [↩](#a_16_JEP395) + + +## JDK 17 - September 2021 +Source: https://openjdk.java.net/projects/jdk/17/ + +Note: Unless otherwise stated, the JavaParser implementations of features follows the released behaviour. + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:-------------------:|:---------------------------------------------------------------:|------------------------------------------------| +| [JEP 306](https://openjdk.java.net/jeps/306) | **_Release_** | | Restore Always-Strict Floating-Point Semantics | +| [JEP 409](https://openjdk.java.net/jeps/409) | **_Release_** | | Sealed Classes | +| [JEP 406](https://openjdk.java.net/jeps/406) | **_Preview_** | | Pattern Matching for `switch` (Preview) | +| [JEP 356](https://openjdk.java.net/jeps/356) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Enhanced Pseudo-Random Number Generators | +| [JEP 382](https://openjdk.java.net/jeps/382) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | New macOS Rendering Pipeline | +| [JEP 391](https://openjdk.java.net/jeps/391) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | macOS/AArch64 Port | +| [JEP 398](https://openjdk.java.net/jeps/398) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Deprecate the Applet API for Removal | +| [JEP 403](https://openjdk.java.net/jeps/403) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Strongly Encapsulate JDK Internals | +| [JEP 407](https://openjdk.java.net/jeps/407) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Remove RMI Activation | +| [JEP 410](https://openjdk.java.net/jeps/410) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Remove the Experimental AOT and JIT Compiler | +| [JEP 411](https://openjdk.java.net/jeps/411) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Deprecate the Security Manager for Removal | +| [JEP 412](https://openjdk.java.net/jeps/412) | **_Incubator_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Foreign Function & Memory API (Incubator) | +| [JEP 414](https://openjdk.java.net/jeps/414) | **_2nd Incubator_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Vector API (Second Incubator) | +| [JEP 415](https://openjdk.java.net/jeps/415) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Context-Specific Deserialization Filters | + + + +## JDK 18 - March 2022 +Source: https://openjdk.java.net/projects/jdk/18/ + +Note: Unless otherwise stated, the JavaParser implementations of features follows the released behaviour. + +### Schedule + + 2021/12/09 Rampdown Phase One (fork from main line) + 2022/01/20 Rampdown Phase Two + 2022/02/10 Initial Release Candidate + 2022/02/24 Final Release Candidate + 2022/03/22 General Availability + + +### Features + +| JEP | Status | JavaParser Since | Description | +|:--------------------------------------------:|:-------------------:|:---------------------------------------------------------------:|--------------------------------------------------| +| [JEP 413](https://openjdk.java.net/jeps/413) | **_Release_** | | Code Snippets in Java API Documentation | +| [JEP 420](https://openjdk.java.net/jeps/420) | **_Preview_** | | Pattern Matching for `switch` (Second Preview) | +| [JEP 400](https://openjdk.java.net/jeps/400) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | UTF-8 by Default | +| [JEP 408](https://openjdk.java.net/jeps/408) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Simple Web Server | +| [JEP 416](https://openjdk.java.net/jeps/416) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Reimplement Core Reflection with Method Handles | +| [JEP 417](https://openjdk.java.net/jeps/417) | **_3rd Incubator_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Vector API (Third Incubator) | +| [JEP 418](https://openjdk.java.net/jeps/418) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Internet-Address Resolution SPI | +| [JEP 419](https://openjdk.java.net/jeps/419) | **_2nd Incubator_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Foreign Function & Memory API (Second Incubator) | +| [JEP 421](https://openjdk.java.net/jeps/421) | **_Release_** | ~~_Not Applicable - Not a language specification change (NA)_~~ | Deprecate Finalization for Removal | + + + +## JDK 19 - _targeted for September 2022_ +Source: https://openjdk.java.net/projects/jdk/18/ + +Note: Unless otherwise stated, the JavaParser implementations of features follows the released behaviour. + +### Features + + JEPs targeted to JDK 19, so far + 422: Linux/RISC-V Port + + Last update: 2022/3/18 16:38 UTC + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE new file mode 100644 index 0000000..012ddda --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE @@ -0,0 +1,6 @@ +JavaParser is available either under the terms of the LGPL License or the Apache License. You as the user are entitled to choose the terms under which to adopt JavaParser. + +For details about the LGPL License please refer to LICENSE.LGPL. Please note +that LGPL is just an extension to GPL, located in LICENSE.GPL. + +For details about the Apache License please refer to LICENSE.APACHE diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.APACHE b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.APACHE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Assignment-2/javaparser-1.0.0-src/COPYING b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.GPL similarity index 97% rename from Assignment-2/javaparser-1.0.0-src/COPYING rename to Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.GPL index 35e363e..fb1a1b0 100644 --- a/Assignment-2/javaparser-1.0.0-src/COPYING +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.GPL @@ -1,674 +1,674 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - Java 1.5 parser and Abstract Syntax Tree - Copyright (C) 2007 Júlio Vilmar Gesser - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Java 1.5 parser and Abstract Syntax Tree Copyright (C) 2007 Júlio Vilmar Gesser - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + Java 1.5 japa.parser and Abstract Syntax Tree + Copyright (C) 2007 J�lio Vilmar Gesser + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Java 1.5 japa.parser and Abstract Syntax Tree Copyright (C) 2007 J�lio Vilmar Gesser + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Assignment-2/javaparser-1.0.0-src/COPYING.LESSER b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.LGPL similarity index 97% rename from Assignment-2/javaparser-1.0.0-src/COPYING.LESSER rename to Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.LGPL index fc8a5de..b87303c 100644 --- a/Assignment-2/javaparser-1.0.0-src/COPYING.LESSER +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/LICENSE.LGPL @@ -1,165 +1,165 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/PULL_REQUEST_TEMPLATE.md b/Assignment-2/javaparser-javaparser-parent-3.27.0/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1548fdd --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +Fixes #9999. diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/appveyor.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/appveyor.yml new file mode 100644 index 0000000..9008921 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/appveyor.yml @@ -0,0 +1,42 @@ +version: '{build}' +os: Windows Server 2012 + +environment: + appveyor_build_worker_cloud: gce + +init: + # Setup autocrlf -- by default, appveyor uses autocrlf input + # ... This affects tests which expect resource files to have the systems's line separator. + - git config --global core.autocrlf true + +install: + # Download maven + - ps: | + Add-Type -AssemblyName System.IO.Compression.FileSystem + if (!(Test-Path -Path "C:\maven" )) { + (new-object System.Net.WebClient).DownloadFile( + 'http://www.us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip', + 'C:\maven-bin.zip' + ) + [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven") + } + # Setup environment variables for Maven and Java + - cmd: SET JAVA_HOME=C:\Program Files\Java\jdk10 + - cmd: SET M2_HOME=C:\maven\apache-maven-3.6.3 + - cmd: SET MAVEN_OPTS=-Xmx1g + - cmd: SET JAVA_OPTS=-Xmx1g + - cmd: SET PATH=C:\maven\apache-maven-3.6.3\bin;%JAVA_HOME%\bin;%PATH% + # Output the git config re: autocrlf to verify the "current" setting + - cmd: git config core.autocrlf + +# Appveyor is used for testing only -- the build script is not required. +build_script: + - echo ignore this + +test_script: + - mvn -B clean install --batch-mode + +# Use of the cache speeds up future tests, meaning that dependencies do not need to be re-downloaded on every run. +cache: + - C:\maven\ + - C:\Users\appveyor\.m2 diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/changelog.md b/Assignment-2/javaparser-javaparser-parent-3.27.0/changelog.md new file mode 100644 index 0000000..840f92a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/changelog.md @@ -0,0 +1,3133 @@ + +Next Release (Version 3.27.1-snapshot) +-------------------------------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/213?closed=1) + +### Added +### Changed +### Deprecated +### Removed +### Fixed +### Security + +Version 3.27.0 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/212?closed=1) + +### Developer Changes + +* fix(deps): update dependency org.junit:junit-bom to v5.13.1 (PR [#4775](https://github.com/javaparser/javaparser/pull/4775) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency maven to v3.9.10 (PR [#4774](https://github.com/javaparser/javaparser/pull/4774) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency org.checkerframework:checker-qual to v3.49.4 (PR [#4770](https://github.com/javaparser/javaparser/pull/4770) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency org.junit:junit-bom to v5.13.0 (PR [#4766](https://github.com/javaparser/javaparser/pull/4766) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v5.4.3 (PR [#4755](https://github.com/javaparser/javaparser/pull/4755) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency org.checkerframework:checker-qual to v3.49.3 (PR [#4745](https://github.com/javaparser/javaparser/pull/4745) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v5.4.2 (PR [#4731](https://github.com/javaparser/javaparser/pull/4731) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency org.junit:junit-bom to v5.12.2 (PR [#4728](https://github.com/javaparser/javaparser/pull/4728) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency com.google.guava:guava to v33.4.7-jre (PR [#4719](https://github.com/javaparser/javaparser/pull/4719) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Fix resolution for method refs used as varargs (PR [#4759](https://github.com/javaparser/javaparser/pull/4759) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix IndexOutOfBoundsException resulting from empty varargs call as method usage (PR [#4754](https://github.com/javaparser/javaparser/pull/4754) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix resolution of lambdas used as varargs (PR [#4752](https://github.com/javaparser/javaparser/pull/4752) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix: issue 4747 Lexical preserving fails after replacing MarkerAnnotationExpr name (PR [#4748](https://github.com/javaparser/javaparser/pull/4748) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4503 Unable to find the method declaration corresponding to a method reference (PR [#4739](https://github.com/javaparser/javaparser/pull/4739) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue 4724 Duplicate fields returned by JavaParserEnumDeclaration.getAllFields() (PR [#4735](https://github.com/javaparser/javaparser/pull/4735) by [@jlerbsc](https://github.com/jlerbsc)) +* Make some helper methods protected in DefaultPrettyPrinterVisitor (PR [#4729](https://github.com/javaparser/javaparser/pull/4729) by [@johanneskloos](https://github.com/johanneskloos)) +* Fix constructor resolution issue 4703 (PR [#4727](https://github.com/javaparser/javaparser/pull/4727) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix MethodAmbiguityException for methods with varargs (PR [#4725](https://github.com/javaparser/javaparser/pull/4725) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix range for cast expression with lambda child (PR [#4721](https://github.com/javaparser/javaparser/pull/4721) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Add Javadoc to the various parts of the DefaultPrettyPrinterVisitor (PR [#4718](https://github.com/javaparser/javaparser/pull/4718) by [@johanneskloos](https://github.com/johanneskloos)) +* Make JarTypeSolver and ReflectionTypeSolver a bit more versatile. (PR [#4716](https://github.com/javaparser/javaparser/pull/4716) by [@johanneskloos](https://github.com/johanneskloos)) +* Fix formatting issues (PR [#4715](https://github.com/javaparser/javaparser/pull/4715) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix Switch toString to LexicalPreservingPrinter when configured (PR [#4712](https://github.com/javaparser/javaparser/pull/4712) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4697 Updating the com.google.guava:guava dependency to v334.5-jre fails. (PR [#4711](https://github.com/javaparser/javaparser/pull/4711) by [@jlerbsc](https://github.com/jlerbsc)) +* Implement MethodResolutionCapability in JavassistRecordDeclaration (PR [#4709](https://github.com/javaparser/javaparser/pull/4709) by [@johanneskloos](https://github.com/johanneskloos)) +* Fix: issue 4707 Upgrading from junit 5.11.4 -> 5.12.1 causes junit exception (PR [#4708](https://github.com/javaparser/javaparser/pull/4708) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix for #3710 by cutting off resolution loops involving object creation steps. (PR [#4704](https://github.com/javaparser/javaparser/pull/4704) by [@johanneskloos](https://github.com/johanneskloos)) +* [SECURITY] Fix Zip Slip Vulnerability (PR [#3684](https://github.com/javaparser/javaparser/pull/3684) by [@JLLeitschuh](https://github.com/JLLeitschuh)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@johanneskloos](https://github.com/johanneskloos) +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@jlerbsc](https://github.com/jlerbsc) +* [@JLLeitschuh](https://github.com/JLLeitschuh) + +Version 3.26.4 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/211?closed=1) + +### Developer Changes + +* fix(deps): update byte-buddy.version to v1.17.5 (PR [#4702](https://github.com/javaparser/javaparser/pull/4702) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.puppycrawl.tools:checkstyle to v10.22.0 (PR [#4700](https://github.com/javaparser/javaparser/pull/4700) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-install-plugin to v3.1.4 (PR [#4689](https://github.com/javaparser/javaparser/pull/4689) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v5.4.0 (PR [#4688](https://github.com/javaparser/javaparser/pull/4688) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-deploy-plugin to v3.1.4 (PR [#4687](https://github.com/javaparser/javaparser/pull/4687) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.diffplug.spotless:spotless-maven-plugin to v2.44.3 (PR [#4682](https://github.com/javaparser/javaparser/pull/4682) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3.4.1 (PR [#4681](https://github.com/javaparser/javaparser/pull/4681) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.27.2 (PR [#4644](https://github.com/javaparser/javaparser/pull/4644) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency com.google.guava:guava to v33.4.0-jre (PR [#4637](https://github.com/javaparser/javaparser/pull/4637) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Fix: issue 4554 Import added through CompilationUnit.addImport should not have a range (PR [#4693](https://github.com/javaparser/javaparser/pull/4693) by [@jlerbsc](https://github.com/jlerbsc)) +* Improving documentation on SwithEntry (PR [#4685](https://github.com/javaparser/javaparser/pull/4685) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue 4670 LexicalPreservingPrinter removed incorect token when removing modifier of a Parameter with annotations (PR [#4674](https://github.com/javaparser/javaparser/pull/4674) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4668 Issue with FieldAccessExpr resolving for custom class (PR [#4671](https://github.com/javaparser/javaparser/pull/4671) by [@jlerbsc](https://github.com/jlerbsc)) +* #4664 remove misleading javadoc (PR [#4666](https://github.com/javaparser/javaparser/pull/4666) by [@verhasi](https://github.com/verhasi)) +* #4653 use report-aggregate of jacoco instead of report to use the dep… (PR [#4658](https://github.com/javaparser/javaparser/pull/4658) by [@verhasi](https://github.com/verhasi)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@jlerbsc](https://github.com/jlerbsc) +* [@verhasi](https://github.com/verhasi) + +Version 3.26.3 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/210?closed=1) + +### Changed + +* Fixes #4599 making B.class for testing non-empty (PR [#4600](https://github.com/javaparser/javaparser/pull/4600) by [@JiriOndrusek](https://github.com/JiriOndrusek)) + +### Fixed + +* Fix: issue 3990 Local Enum and Interface (Java 16) (PR [#4626](https://github.com/javaparser/javaparser/pull/4626) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix bug in `VisitorSet.toString()` (PR [#4615](https://github.com/javaparser/javaparser/pull/4615) by [@Laughh](https://github.com/Laughh)) +* Fix issue #4607: don't forget to clone guard when cloning stmt.SwitchEntry (PR [#4608](https://github.com/javaparser/javaparser/pull/4608) by [@DaniilSuchkov](https://github.com/DaniilSuchkov)) +* Fixed return within void method (PR [#4587](https://github.com/javaparser/javaparser/pull/4587) by [@Universe-E](https://github.com/Universe-E)) +* Fix: issue 4579 Switch expr and var incompatibility (PR [#4581](https://github.com/javaparser/javaparser/pull/4581) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4568 Resolution of ObjectCreationExprs broken (PR [#4577](https://github.com/javaparser/javaparser/pull/4577) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue 4560 Does not solve String.format on multiline strings (PR [#4561](https://github.com/javaparser/javaparser/pull/4561) by [@jlerbsc](https://github.com/jlerbsc)) + + +### Developer Changes + +* fix(deps): update byte-buddy.version to v1.15.11 (PR [#4635](https://github.com/javaparser/javaparser/pull/4635) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v5.1.0 (PR [#4629](https://github.com/javaparser/javaparser/pull/4629) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.1 (PR [#4605](https://github.com/javaparser/javaparser/pull/4605) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.2 (PR [#4604](https://github.com/javaparser/javaparser/pull/4604) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v4.2.2 (PR [#4594](https://github.com/javaparser/javaparser/pull/4594) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.11.3 (PR [#4589](https://github.com/javaparser/javaparser/pull/4589) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency net.bytebuddy:byte-buddy-agent to v1.15.5 (PR [#4586](https://github.com/javaparser/javaparser/pull/4586) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency com.google.guava:guava to v33.3.1-jre (PR [#4558](https://github.com/javaparser/javaparser/pull/4558) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.hamcrest:hamcrest to v3 (PR [#4510](https://github.com/javaparser/javaparser/pull/4510) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@DaniilSuchkov](https://github.com/DaniilSuchkov) +* [@JiriOndrusek](https://github.com/JiriOndrusek) +* [@jlerbsc](https://github.com/jlerbsc) +* [@Universe-E](https://github.com/Universe-E) +* [@Laughh](https://github.com/Laughh) + + +Version 3.26.2 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/209?closed=1) + + +### Changed + +* Move formatting workflows into separate file (PR [#4480](https://github.com/javaparser/javaparser/pull/4480) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Exclude unavailable macos <-> java version combinations from github tests (PR [#4479](https://github.com/javaparser/javaparser/pull/4479) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### Fixed + +* Fixes #4526. Fix Node.PostOrderIterator for roots without children (PR [#4538](https://github.com/javaparser/javaparser/pull/4538) by [@ktul](https://github.com/ktul)) +* Add missing copyright notice to RecordPatternExpr.java (PR [#4527](https://github.com/javaparser/javaparser/pull/4527) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Add missing type erasure in ClassOrInterfaceType.toDescriptor (PR [#4522](https://github.com/javaparser/javaparser/pull/4522) by [@johanneskloos](https://github.com/johanneskloos)) +* Allow primitive types for patterns (PR [#4506](https://github.com/javaparser/javaparser/pull/4506) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix project formatting (PR [#4499](https://github.com/javaparser/javaparser/pull/4499) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix: issue 4492 resolve LambdaExpr has NullPointException (PR [#4497](https://github.com/javaparser/javaparser/pull/4497) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 2738 UnsolvedSymbolException while trying to ResolvedMethodDeclaration from MethodCallExpr (PR [#4482](https://github.com/javaparser/javaparser/pull/4482) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* fix(deps): update byte-buddy.version to v1.15.1 (PR [#4547](https://github.com/javaparser/javaparser/pull/4547) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update byte-buddy.version to v1.15.0 (PR [#4543](https://github.com/javaparser/javaparser/pull/4543) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency com.google.guava:guava to v33.3.0-jre (PR [#4532](https://github.com/javaparser/javaparser/pull/4532) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency net.bytebuddy:byte-buddy-agent to v1.14.19 (PR [#4531](https://github.com/javaparser/javaparser/pull/4531) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.11.0 (PR [#4528](https://github.com/javaparser/javaparser/pull/4528) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update byte-buddy.version to v1.14.18 (PR [#4493](https://github.com/javaparser/javaparser/pull/4493) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v4.1.7 (PR [#4486](https://github.com/javaparser/javaparser/pull/4486) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v4.0.0 (PR [#4485](https://github.com/javaparser/javaparser/pull/4485) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.10.3 (PR [#4483](https://github.com/javaparser/javaparser/pull/4483) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Add better instructions for re-formatting the project (PR [#4540](https://github.com/javaparser/javaparser/pull/4540) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@johanneskloos](https://github.com/johanneskloos) +* [@ktul](https://github.com/ktul) +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@kamilkrzywanski](https://github.com/kamilkrzywanski) +* [@jlerbsc](https://github.com/jlerbsc) + + +Version 3.26.1 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/208?closed=1) + +### Added + +* Fix record declarations nested in annotation declarations (PR [#4460](https://github.com/javaparser/javaparser/pull/4460) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### Changed + +* Format code with spotless (PR [#4465](https://github.com/javaparser/javaparser/pull/4465) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Simplifying the search for types in compilation unit (PR [#4459](https://github.com/javaparser/javaparser/pull/4459) by [@jlerbsc](https://github.com/jlerbsc)) +* Add spotless plugin configuration (PR [#4409](https://github.com/javaparser/javaparser/pull/4409) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### Fixed + +* Disable spotless ratcheting and fix formatting (PR [#4478](https://github.com/javaparser/javaparser/pull/4478) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix: issue 4450 Endless recursion (-> StackOverflow) with cyclic static references (PR [#4477](https://github.com/javaparser/javaparser/pull/4477) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4399 MethodCallExpr inside lambda in assignment expression cannot be resolved (PR [#4462](https://github.com/javaparser/javaparser/pull/4462) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix crash on SwitchExpr entries if tokens are not stored (PR [#4461](https://github.com/javaparser/javaparser/pull/4461) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix lookahead for pattern expression in switch entries [Issue 4455] (PR [#4458](https://github.com/javaparser/javaparser/pull/4458) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### Developer Changes + +* Automatically format code after codegen and validate with a github action (PR [#4468](https://github.com/javaparser/javaparser/pull/4468) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Add git-blame-ignore-revs file to ignore the reformatting commit in git blame (PR [#4466](https://github.com/javaparser/javaparser/pull/4466) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### Uncategorised + +* Add link to the guide to adding nodes in CONTRIBUTING.md (PR [#4453](https://github.com/javaparser/javaparser/pull/4453) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@jlerbsc](https://github.com/jlerbsc) + + + +Version 3.26.0 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/207?closed=1) + +### Added + +* [JEP 440] Add support for record patterns (PR [#4432](https://github.com/javaparser/javaparser/pull/4432) by [@johannescoetzee](https://github.com/johannescoetzee)) +* PatternExpr -> TypePatternExpr refactor in preparation for record pattern implementation (PR [#4387](https://github.com/javaparser/javaparser/pull/4387) by [@johannescoetzee](https://github.com/johannescoetzee)) +* [JEP441] Add support for switch pattern matching (PR [#4375](https://github.com/javaparser/javaparser/pull/4375) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Add support for `case null, default` in switch and fix concrete syntax model for new switch syntax (PR [#4364](https://github.com/javaparser/javaparser/pull/4364) by [@johannescoetzee](https://github.com/johannescoetzee)) + +### Changed + +* Fixes SYSTEM_EOL warnings (PR [#4412](https://github.com/javaparser/javaparser/pull/4412) by [@matthieu-vergne](https://github.com/matthieu-vergne)) +* Refact: Adds a find node by range method in Node class (PR [#4377](https://github.com/javaparser/javaparser/pull/4377) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix: issue 3277 StackOverflow issue while parse MethodCallExpr/FieldAccessExpr, their ancestor/child node is ObjectCreation expression which contain .new (PR [#4447](https://github.com/javaparser/javaparser/pull/4447) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix expressions in the body of switch expression entries (Issue 4440) (PR [#4446](https://github.com/javaparser/javaparser/pull/4446) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix: issue 4442 LexicalPreservingPrinter does not support unexpected token (PR [#4444](https://github.com/javaparser/javaparser/pull/4444) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3100 JavaSymbolSolver unable to resolve an inner class defined in a base class (PR [#4441](https://github.com/javaparser/javaparser/pull/4441) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: 4330 Method 'forEach' cannot be resolved in certain context (PR [#4436](https://github.com/javaparser/javaparser/pull/4436) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: 'permits' and 'sealed' Contextual keyworlds usage (PR [#4434](https://github.com/javaparser/javaparser/pull/4434) by [@jlerbsc](https://github.com/jlerbsc)) +* Fixes an error in jbehave tests when they are run in a Windows os (PR [#4433](https://github.com/javaparser/javaparser/pull/4433) by [@jlerbsc](https://github.com/jlerbsc)) +* Make resolution of implements and extends types start with the parent… (PR [#4430](https://github.com/javaparser/javaparser/pull/4430) by [@eldapiiro](https://github.com/eldapiiro)) +* Fix: solveMethodAsUsage() for implicit method ::values() (PR [#4424](https://github.com/javaparser/javaparser/pull/4424) by [@Kimmmey](https://github.com/Kimmmey)) +* Fix: ::values() is a static method, was not static (PR [#4417](https://github.com/javaparser/javaparser/pull/4417) by [@Kimmmey](https://github.com/Kimmmey)) +* Fix missed generated code from PatternExpr refactor (PR [#4414](https://github.com/javaparser/javaparser/pull/4414) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fixes #4410 (PR [#4411](https://github.com/javaparser/javaparser/pull/4411) by [@matthieu-vergne](https://github.com/matthieu-vergne)) +* Fix issue 2368 Unable to calculate the type of a varargs parameter (PR [#4402](https://github.com/javaparser/javaparser/pull/4402) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Fixes the version currently supported by Javaparser. (PR [#4393](https://github.com/javaparser/javaparser/pull/4393) by [@jlerbsc](https://github.com/jlerbsc)) +* ?? make mvnw command runnable by copy-pasting (PR [#4382](https://github.com/javaparser/javaparser/pull/4382) by [@cravingPixels](https://github.com/cravingPixels)) + +### Developer Changes + +* chore(deps): bump actions/checkout from 4.1.4 to 4.1.5 (PR [#4415](https://github.com/javaparser/javaparser/pull/4415) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Minor refactoring on Concrete syntax model (PR [#4405](https://github.com/javaparser/javaparser/pull/4405) by [@jlerbsc](https://github.com/jlerbsc)) +* chore(deps): bump actions/checkout from 4.1.2 to 4.1.3 (PR [#4381](https://github.com/javaparser/javaparser/pull/4381) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Uncategorised + +* Improve unit test on generic (PR [#4407](https://github.com/javaparser/javaparser/pull/4407) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@eldapiiro](https://github.com/eldapiiro) +* [@cravingPixels](https://github.com/cravingPixels) +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@matthieu-vergne](https://github.com/matthieu-vergne) +* [@jlerbsc](https://github.com/jlerbsc) +* [@Kimmmey](https://github.com/Kimmmey) + + +Version 3.25.10 +--------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/206?closed=1) + +### Fixed + +* Fix issue 4345 Strange error when trying to find erasure of generic t… (PR [#4362](https://github.com/javaparser/javaparser/pull/4362) by [@jlerbsc](https://github.com/jlerbsc)) +* fix: issue 4358 prevent infinite cycles with static imports (PR [#4359](https://github.com/javaparser/javaparser/pull/4359) by [@kdunee](https://github.com/kdunee)) +* Refactor `ResolvedReferenceType#equals` (PR [#4351](https://github.com/javaparser/javaparser/pull/4351) by [@freya022](https://github.com/freya022)) +* fix: issue 4331 Cannot be 'abstract' and also 'private'. for a private method in an interface (PR [#4332](https://github.com/javaparser/javaparser/pull/4332) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump actions/checkout from 4.1.1 to 4.1.2 (PR [#4341](https://github.com/javaparser/javaparser/pull/4341) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@kdunee](https://github.com/kdunee) +* [@freya022](https://github.com/freya022) +* [@jlerbsc](https://github.com/jlerbsc) + + + +Version 3.25.9 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/205?closed=1) + +### Added + +* Fix: issue #3878 resolve MethodReference in ObjectCreationExpr (PR [#4296](https://github.com/javaparser/javaparser/pull/4296) by [@fishautumn](https://github.com/fishautumn)) + +### Changed + +* Switch order of literals to prevent NullPointerException (PR [#4322](https://github.com/javaparser/javaparser/pull/4322) by [@citizenjosh](https://github.com/citizenjosh)) +* Minor refactoring to use the existing getArgumentPosition method (PR [#4306](https://github.com/javaparser/javaparser/pull/4306) by [@jlerbsc](https://github.com/jlerbsc)) +* Optimize find ancestor (PR [#4294](https://github.com/javaparser/javaparser/pull/4294) by [@magicwerk](https://github.com/magicwerk)) +* refac: Removes useless ExpressionHelper utility class and replaces some explicit casts by using the javaparser API (PR [#4291](https://github.com/javaparser/javaparser/pull/4291) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* fix: Dead stores should be removed (sonar rule) (PR [#4329](https://github.com/javaparser/javaparser/pull/4329) by [@jlerbsc](https://github.com/jlerbsc)) +* fix: Replace this if-then-else statement by a single return statement (sonar rule) (PR [#4328](https://github.com/javaparser/javaparser/pull/4328) by [@jlerbsc](https://github.com/jlerbsc)) +* fix: issue 2043 getAccessSpecifier should return public for interface methods (PR [#4317](https://github.com/javaparser/javaparser/pull/4317) by [@jlerbsc](https://github.com/jlerbsc)) +* Further improve correction of whitespace during difference application (PR [#4316](https://github.com/javaparser/javaparser/pull/4316) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue #3946 Symbol solver is unable to resolve inherited inner classes (PR [#4314](https://github.com/javaparser/javaparser/pull/4314) by [@jlerbsc](https://github.com/jlerbsc)) +* fix: issue 4311 IllegalStateException when removing all comments with LexicalPreservingPrinter (PR [#4313](https://github.com/javaparser/javaparser/pull/4313) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3939 SymbolResolver.calculateType(Expression) may fails on first try, then succeed on later tries (PR [#4290](https://github.com/javaparser/javaparser/pull/4290) by [@jlerbsc](https://github.com/jlerbsc)) +* Adds unit test for issue 4284 "ClassCastException when resolving MethodCallExpr inside an enhanced switch statement" (PR [#4285](https://github.com/javaparser/javaparser/pull/4285) by [@jlerbsc](https://github.com/jlerbsc)) +* Change `SwitchStmt` to `SwitchNode` in `SwitchEntryContext` to avoid `ClassCastException` (PR [#4283](https://github.com/javaparser/javaparser/pull/4283) by [@PalashSharma20](https://github.com/PalashSharma20)) + +### Developer Changes + +* chore(deps): bump org.codehaus.mojo:exec-maven-plugin from 3.1.1 to 3.2.0 (PR [#4323](https://github.com/javaparser/javaparser/pull/4323) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update junit5 monorepo to v5.10.2 (PR [#4307](https://github.com/javaparser/javaparser/pull/4307) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v4 (PR [#4304](https://github.com/javaparser/javaparser/pull/4304) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/cache action to v4 (PR [#4293](https://github.com/javaparser/javaparser/pull/4293) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@citizenjosh](https://github.com/citizenjosh) +* [@magicwerk](https://github.com/magicwerk) +* [@PalashSharma20](https://github.com/PalashSharma20) +* [@jlerbsc](https://github.com/jlerbsc) +* [@fishautumn](https://github.com/fishautumn) + + +Version 3.25.8 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/204?closed=1) + +### Added + +* feat: creates cache statistics and moves Cache interface to javaparser-core (PR [#4278](https://github.com/javaparser/javaparser/pull/4278) by [@jlerbsc](https://github.com/jlerbsc)) +* feat: Add parseArrayInitializerExpr to JavaParser API (PR [#4276](https://github.com/javaparser/javaparser/pull/4276) by [@iMashtak](https://github.com/iMashtak)) +* feat: A visitor looking for a node by its position in an AST (PR [#4258](https://github.com/javaparser/javaparser/pull/4258) by [@jlerbsc](https://github.com/jlerbsc)) + +### Changed + +* fix: Partial removal of the use of instanceof in favour of the use of the API (PR [#4280](https://github.com/javaparser/javaparser/pull/4280) by [@jlerbsc](https://github.com/jlerbsc)) +* [GHA] Run on java 18 (PR [#4252](https://github.com/javaparser/javaparser/pull/4252) by [@hazendaz](https://github.com/hazendaz)) + +### Fixed + +* fix: issue 4240 Calling resolve on catch block parameter throws exception (PR [#4279](https://github.com/javaparser/javaparser/pull/4279) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4270 Exception when resolving ObjectCreationExpr with nested varargs (PR [#4273](https://github.com/javaparser/javaparser/pull/4273) by [@jlerbsc](https://github.com/jlerbsc)) +* add Java_18 to yieldSupport (PR [#4262](https://github.com/javaparser/javaparser/pull/4262) by [@Kimmmey](https://github.com/Kimmmey)) +* fix: issue #4245 UnsupportedOperationException with LexicalPreservingPrinter when removing a sealed modified (PR [#4253](https://github.com/javaparser/javaparser/pull/4253) by [@jlerbsc](https://github.com/jlerbsc)) +* [ci] Fix change log released version as 3.25.7 (PR [#4251](https://github.com/javaparser/javaparser/pull/4251) by [@hazendaz](https://github.com/hazendaz)) +* Fix: issue 3278 Lazy types cause stack overflow when trying to find the least upper bound type (PR [#4246](https://github.com/javaparser/javaparser/pull/4246) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump com.google.guava:guava from 32.1.3-jre to 33.0.0-jre (PR [#4264](https://github.com/javaparser/javaparser/pull/4264) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Uncategorised + +* Revert "Refactoring: Move cache features to javaparser-core" (PR [#4274](https://github.com/javaparser/javaparser/pull/4274) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@hazendaz](https://github.com/hazendaz) +* [@iMashtak](https://github.com/iMashtak) +* [@jlerbsc](https://github.com/jlerbsc) +* [@Kimmmey](https://github.com/Kimmmey) + +Version 3.25.7 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/203?closed=1) + +### Added + +* [GHA] Remove old comment that is no longer valid around jdks and add jdk 17 (PR [#4226](https://github.com/javaparser/javaparser/pull/4226) by [@hazendaz](https://github.com/hazendaz)) +* Fix: issue 3833 No enum constant com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_18 (PR [#4221](https://github.com/javaparser/javaparser/pull/4221) by [@jlerbsc](https://github.com/jlerbsc)) + +### Changed + +* Refactoring: Move cache features to javaparser-core (PR [#4238](https://github.com/javaparser/javaparser/pull/4238) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: removes reference to coveralls plugin which is not useful because codecov is used to track code coverage (PR [#4235](https://github.com/javaparser/javaparser/pull/4235) by [@jlerbsc](https://github.com/jlerbsc)) +* Uses jakarta.json api, upgrades jakarta.json-api to the latest version & uses new default Eclipse Parsson (PR [#4234](https://github.com/javaparser/javaparser/pull/4234) by [@jlerbsc](https://github.com/jlerbsc)) +* Move mockito to 4.11.0 and handle byte buddy consistently as well as properly define its agent in argLine for surefire (PR [#4228](https://github.com/javaparser/javaparser/pull/4228) by [@hazendaz](https://github.com/hazendaz)) +* Cleanup poms, use jakarta provided (javax namespace), hamcrest follow up, and switch coveralls plugin - Fixes #4111 (PR [#4225](https://github.com/javaparser/javaparser/pull/4225) by [@hazendaz](https://github.com/hazendaz)) +* [pom] Switch from hamcrest-library (deprecated) to hamcrest (PR [#4200](https://github.com/javaparser/javaparser/pull/4200) by [@hazendaz](https://github.com/hazendaz)) +* Putting code in the .orElse that has a side effect that can affect performance (PR [#4199](https://github.com/javaparser/javaparser/pull/4199) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix: issue 3650 unreproducible MAVEN_BUILD_TIMESTAMP (PR [#4243](https://github.com/javaparser/javaparser/pull/4243) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3972 StackOverflowError when resolving type of scope of a MethodCall (PR [#4236](https://github.com/javaparser/javaparser/pull/4236) by [@jlerbsc](https://github.com/jlerbsc)) +* [fix] Jdk 18 enum stub was extended off java 16 post processor not java17 (PR [#4227](https://github.com/javaparser/javaparser/pull/4227) by [@hazendaz](https://github.com/hazendaz)) +* Fix: issue #4047 Symbol Solver mixes name with type (PR [#4206](https://github.com/javaparser/javaparser/pull/4206) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix grammar (PR [#4203](https://github.com/javaparser/javaparser/pull/4203) by [@mernst](https://github.com/mernst)) +* Minor changes : corrupted format, useless cast, javadoc (PR [#4198](https://github.com/javaparser/javaparser/pull/4198) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): update actions/setup-java action to v4 (PR [#4241](https://github.com/javaparser/javaparser/pull/4241) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump org.codehaus.mojo:build-helper-maven-plugin from 3.4.0 to 3.5.0 (PR [#4223](https://github.com/javaparser/javaparser/pull/4223) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Adds sponsor link to help the project live and grow (PR [#4204](https://github.com/javaparser/javaparser/pull/4204) by [@jlerbsc](https://github.com/jlerbsc)) +* chore(deps): bump org.codehaus.mojo:templating-maven-plugin from 1.0.0 to 3.0.0 (PR [#4195](https://github.com/javaparser/javaparser/pull/4195) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update junit5 monorepo to v5.10.1 (PR [#4193](https://github.com/javaparser/javaparser/pull/4193) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Added unit tests for visitors (PR [#4239](https://github.com/javaparser/javaparser/pull/4239) by [@4everTheOne](https://github.com/4everTheOne)) +* Unit tests for class GenericListVisitorAdapter (PR [#4237](https://github.com/javaparser/javaparser/pull/4237) by [@4everTheOne](https://github.com/4everTheOne)) +* Update readme.md (PR [#4222](https://github.com/javaparser/javaparser/pull/4222) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@hazendaz](https://github.com/hazendaz) +* [@jlerbsc](https://github.com/jlerbsc) +* [@mernst](https://github.com/mernst) +* [@4everTheOne](https://github.com/4everTheOne) + + +Version 3.25.6 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/202?closed=1) + +### Changed + +* reformat javaconcept take 2 (PR [#4167](https://github.com/javaparser/javaparser/pull/4167) by [@JimmyGan437](https://github.com/JimmyGan437)) +* Using JAXP on XMLPrinter implementation (PR [#4166](https://github.com/javaparser/javaparser/pull/4166) by [@lcbarcellos](https://github.com/lcbarcellos)) +* replace deprecated methond calls to their replacements (PR [#4157](https://github.com/javaparser/javaparser/pull/4157) by [@JimmyGan437](https://github.com/JimmyGan437)) +* feat(#4075): Improve the validation error messages (PR [#4116](https://github.com/javaparser/javaparser/pull/4116) by [@volodya-lombrozo](https://github.com/volodya-lombrozo)) + +### Fixed + +* Fix: issue #2751 new HashSet()" != "new HashSet<>() (PR [#4183](https://github.com/javaparser/javaparser/pull/4183) by [@lcbarcellos](https://github.com/lcbarcellos)) +* Fixes #2625 Add messages to thrown exceptions (PR [#4177](https://github.com/javaparser/javaparser/pull/4177) by [@oannhpham](https://github.com/oannhpham)) +* Fix: issue 4163 Calling MethodDeclaration.getDeclarationAsString leads to MethodDelaration.getComment returning no comment (PR [#4165](https://github.com/javaparser/javaparser/pull/4165) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3673 isAssignableBy method StackOverflowError (PR [#4156](https://github.com/javaparser/javaparser/pull/4156) by [@jlerbsc](https://github.com/jlerbsc)) +* fix: issue 3184 Unable to get the resolved type of class ResolvedReferenceType from T (PR [#4147](https://github.com/javaparser/javaparser/pull/4147) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue #3269 Test resources containing included interfaces do not compile (PR [#4139](https://github.com/javaparser/javaparser/pull/4139) by [@jlerbsc](https://github.com/jlerbsc)) +* CalculateResolvedType Type error (PR [#4138](https://github.com/javaparser/javaparser/pull/4138) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue #4036 LeastUpperBoundLogic.lub returns null when matches ConditionalExpr (PR [#4137](https://github.com/javaparser/javaparser/pull/4137) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue #2484 SymbolResolver on MethodCallExpr fails if method parameter is of kind Class (PR [#4136](https://github.com/javaparser/javaparser/pull/4136) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump com.google.guava:guava from 32.1.2-jre to 32.1.3-jre (PR [#4154](https://github.com/javaparser/javaparser/pull/4154) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update actions/checkout action to v4 (PR [#4141](https://github.com/javaparser/javaparser/pull/4141) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@lcbarcellos](https://github.com/lcbarcellos) +* [@volodya-lombrozo](https://github.com/volodya-lombrozo) +* [@JimmyGan437](https://github.com/JimmyGan437) +* [@jlerbsc](https://github.com/jlerbsc) +* [@oannhpham](https://github.com/oannhpham) + + + +Version 3.25.5 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/201?closed=1) + +### Added + +* fix: issue 4115 ResolvedUnionType should give access to a list of resolved types (PR [#4119](https://github.com/javaparser/javaparser/pull/4119) by [@jlerbsc](https://github.com/jlerbsc)) +* Support getting more annotation default values using reflection (PR [#4103](https://github.com/javaparser/javaparser/pull/4103) by [@freya022](https://github.com/freya022)) + +### Changed + +* Minor refactoring: Simplifies how to group deleted tokens by extracting a method into an independent class (PR [#4134](https://github.com/javaparser/javaparser/pull/4134) by [@jlerbsc](https://github.com/jlerbsc)) +* Replace deprecated command with environment file (PR [#4122](https://github.com/javaparser/javaparser/pull/4122) by [@70825](https://github.com/70825)) +* Fixes missing named constructor in Modifier.java (PR [#4092](https://github.com/javaparser/javaparser/pull/4092) by [@Auties00](https://github.com/Auties00)) + +### Fixed + +* Fix: issue 4133 Top-level class containerType() throws an exception instead of Optional.empty() (PR [#4135](https://github.com/javaparser/javaparser/pull/4135) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: apply multiline strings (PR [#4130](https://github.com/javaparser/javaparser/pull/4130) by [@70825](https://github.com/70825)) +* Fix: issue 3976 Issue resolving implicit generic types (PR [#4128](https://github.com/javaparser/javaparser/pull/4128) by [@jlerbsc](https://github.com/jlerbsc)) +* Add unit test for PR 4091 Fixed missing permits in pretty printer (PR [#4126](https://github.com/javaparser/javaparser/pull/4126) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4124 UnsupportedOperationException: 'T' is thrown in MethodCallExpr resolve (PR [#4125](https://github.com/javaparser/javaparser/pull/4125) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4051 Switched upperBounds and lowerBounds on ResolvedTypeP… (PR [#4123](https://github.com/javaparser/javaparser/pull/4123) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix failing test on JDK 17 (PR [#4121](https://github.com/javaparser/javaparser/pull/4121) by [@mahesh-hegde](https://github.com/mahesh-hegde)) +* Fix: issue 3673 isAssignableBy method StackOverflowError (PR [#4118](https://github.com/javaparser/javaparser/pull/4118) by [@jlerbsc](https://github.com/jlerbsc)) +* Orphan comment added when using lexical preservation is not printed (PR [#4114](https://github.com/javaparser/javaparser/pull/4114) by [@jlerbsc](https://github.com/jlerbsc)) +* Fixed missing permits in pretty printer (PR [#4091](https://github.com/javaparser/javaparser/pull/4091) by [@Auties00](https://github.com/Auties00)) + +### Developer Changes + +* chore(deps): update actions/checkout action to v3.6.0 (PR [#4127](https://github.com/javaparser/javaparser/pull/4127) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump com.google.guava:guava from 32.1.1-jre to 32.1.2-jre (PR [#4109](https://github.com/javaparser/javaparser/pull/4109) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Uncategorised + +* Fix: issue 4104 LPP doesn't handle new switch entries well (PR [#4106](https://github.com/javaparser/javaparser/pull/4106) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@freya022](https://github.com/freya022) +* [@Auties00](https://github.com/Auties00) +* [@mahesh-hegde](https://github.com/mahesh-hegde) +* [@jlerbsc](https://github.com/jlerbsc) +* [@70825](https://github.com/70825) + + +Version 3.25.4 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/200?closed=1) + +### Changed + +* Nested 'if' statements should be simplified (PR [#4085](https://github.com/javaparser/javaparser/pull/4085) by [@jlerbsc](https://github.com/jlerbsc)) +* BDD tests: migarte to JBehave 5 (PR [#4028](https://github.com/javaparser/javaparser/pull/4028) by [@valfirst](https://github.com/valfirst)) + +### Fixed + +* Fix: issue 4077 After building JavaParser (with tests) on MacOS multi… (PR [#4086](https://github.com/javaparser/javaparser/pull/4086) by [@jlerbsc](https://github.com/jlerbsc)) +* fix line separators of selected test files (PR [#4083](https://github.com/javaparser/javaparser/pull/4083) by [@abego](https://github.com/abego)) +* Fix: issue 3978 typesolver can't parse in parallel (PR [#4073](https://github.com/javaparser/javaparser/pull/4073) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix #4056 isDeclaredInInterface() returns true for fields declared inside enumerations contained in an interface (PR [#4057](https://github.com/javaparser/javaparser/pull/4057) by [@Elewyth](https://github.com/Elewyth)) +* Fix: issue 4037 ArrayIndexOutOfBoundsException throws when method param is variadic (PR [#4046](https://github.com/javaparser/javaparser/pull/4046) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 4016 Failed to parse variable with name 'sealed' or 'permits' (PR [#4039](https://github.com/javaparser/javaparser/pull/4039) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump guava from 32.1.0-jre to 32.1.1-jre (PR [#4089](https://github.com/javaparser/javaparser/pull/4089) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump guava from 32.0.0-jre to 32.1.0-jre (PR [#4087](https://github.com/javaparser/javaparser/pull/4087) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump checkstyle from 10.12.0 to 10.12.1 (PR [#4084](https://github.com/javaparser/javaparser/pull/4084) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump versions-maven-plugin from 2.15.0 to 2.16.0 (PR [#4055](https://github.com/javaparser/javaparser/pull/4055) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-release-plugin from 3.0.0 to 3.0.1 (PR [#4053](https://github.com/javaparser/javaparser/pull/4053) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump guava from 31.1-jre to 32.0.0-jre (PR [#4042](https://github.com/javaparser/javaparser/pull/4042) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-dependency-plugin from 3.5.0 to 3.6.0 (PR [#4035](https://github.com/javaparser/javaparser/pull/4035) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-checkstyle-plugin from 3.2.2 to 3.3.0 (PR [#4033](https://github.com/javaparser/javaparser/pull/4033) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-scm-plugin from 2.0.0 to 2.0.1 (PR [#4031](https://github.com/javaparser/javaparser/pull/4031) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump codecov/codecov-action from 3.1.3 to 3.1.4 (PR [#4030](https://github.com/javaparser/javaparser/pull/4030) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump build-helper-maven-plugin from 3.3.0 to 3.4.0 (PR [#4026](https://github.com/javaparser/javaparser/pull/4026) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency maven to v3.9.2 (PR [#4024](https://github.com/javaparser/javaparser/pull/4024) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@valfirst](https://github.com/valfirst) +* [@abego](https://github.com/abego) +* [@Elewyth](https://github.com/Elewyth) +* [@jlerbsc](https://github.com/jlerbsc) + + +Version 3.25.3 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/199?closed=1) + + +### Added + +* add Java 17 sealed/non-sealed classes (PR [#3997](https://github.com/javaparser/javaparser/pull/3997) by [@kris-scheibe](https://github.com/kris-scheibe)) + +### Changed + +* Minor simplification of the Difference class (PR [#4008](https://github.com/javaparser/javaparser/pull/4008) by [@jlerbsc](https://github.com/jlerbsc)) +* Perf: Remove unnecessary methods and quickly return to the Range.cont… (PR [#3996](https://github.com/javaparser/javaparser/pull/3996) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix: issue 1843 Problems with hasAnnotation() and hasDirectlyAnnotati… (PR [#4015](https://github.com/javaparser/javaparser/pull/4015) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Issue 3995 resolving a method call with a variadic argument of p… (PR [#3998](https://github.com/javaparser/javaparser/pull/3998) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3983 why FieldDeclaration in an interface calling isStatic… (PR [#3986](https://github.com/javaparser/javaparser/pull/3986) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump checkstyle from 10.9.3 to 10.10.0 (PR [#4014](https://github.com/javaparser/javaparser/pull/4014) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update junit5 monorepo to v5.9.3 (PR [#4012](https://github.com/javaparser/javaparser/pull/4012) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump jacoco-maven-plugin from 0.8.9 to 0.8.10 (PR [#4011](https://github.com/javaparser/javaparser/pull/4011) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps-dev): bump okhttp from 4.10.0 to 4.11.0 (PR [#4009](https://github.com/javaparser/javaparser/pull/4009) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump codecov/codecov-action from 3.1.2 to 3.1.3 (PR [#4006](https://github.com/javaparser/javaparser/pull/4006) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-checkstyle-plugin from 3.2.1 to 3.2.2 (PR [#4005](https://github.com/javaparser/javaparser/pull/4005) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump actions/checkout from 3.5.1 to 3.5.2 (PR [#3994](https://github.com/javaparser/javaparser/pull/3994) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump actions/checkout from 3.5.0 to 3.5.1 (PR [#3992](https://github.com/javaparser/javaparser/pull/3992) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump codecov/codecov-action from 3.1.1 to 3.1.2 (PR [#3988](https://github.com/javaparser/javaparser/pull/3988) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-deploy-plugin from 3.1.0 to 3.1.1 (PR [#3985](https://github.com/javaparser/javaparser/pull/3985) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump jacoco-maven-plugin from 0.8.8 to 0.8.9 (PR [#3981](https://github.com/javaparser/javaparser/pull/3981) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump checkstyle from 10.9.1 to 10.9.3 (PR [#3980](https://github.com/javaparser/javaparser/pull/3980) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-resources-plugin from 3.3.0 to 3.3.1 (PR [#3979](https://github.com/javaparser/javaparser/pull/3979) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-install-plugin from 3.1.0 to 3.1.1 (PR [#3975](https://github.com/javaparser/javaparser/pull/3975) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-release-plugin from 2.5.3 to 3.0.0 (PR [#3965](https://github.com/javaparser/javaparser/pull/3965) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Uncategorised + +* add test for showing interface field shall be static & final (PR [#3984](https://github.com/javaparser/javaparser/pull/3984) by [@XenoAmess](https://github.com/XenoAmess)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@kris-scheibe](https://github.com/kris-scheibe) +* [@jlerbsc](https://github.com/jlerbsc) +* [@XenoAmess](https://github.com/XenoAmess) + + +Version 3.25.2 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/198?closed=1) + +### Changed + +* chore(deps): bump maven-scm-plugin from 1.13.0 to 2.0.0 (PR [#3961](https://github.com/javaparser/javaparser/pull/3961) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump checkstyle from 10.8.1 to 10.9.1 (PR [#3958](https://github.com/javaparser/javaparser/pull/3958) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump actions/checkout from 3.3.0 to 3.4.0 (PR [#3954](https://github.com/javaparser/javaparser/pull/3954) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Fixed + +* Fix: issue 3947 MANIFEST.MF points to non-existent URL (PR [#3966](https://github.com/javaparser/javaparser/pull/3966) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3951 ConfilictingGenericTypesException is thrown when an Object type is expected as a parameter and an interface is provided as the actual parameter (PR [#3963](https://github.com/javaparser/javaparser/pull/3963) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3949 LexicalPreservingPrinter Ignores Changes to LambdaExp… (PR [#3959](https://github.com/javaparser/javaparser/pull/3959) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Unit test since Return-Type-Substituable is fully implemented on reference type (PR [#3943](https://github.com/javaparser/javaparser/pull/3943) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue on FunctionalInterfaceLogic but waiting for Return-Type-Su… (PR [#3941](https://github.com/javaparser/javaparser/pull/3941) by [@jlerbsc](https://github.com/jlerbsc)) +* Suggested fix: hardcoded specific LambdaExpr case in LexicalDifferenc… (PR [#3938](https://github.com/javaparser/javaparser/pull/3938) by [@blacelle](https://github.com/blacelle)) +* Fix TextBlockLiteralExpr in LexicalDifferenceCalculator (PR [#3937](https://github.com/javaparser/javaparser/pull/3937) by [@blacelle](https://github.com/blacelle)) +* Fix: issue 3919 An array of primitive type cannot be assigned to an array of object (PR [#3933](https://github.com/javaparser/javaparser/pull/3933) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): update actions/checkout action to v3.5.0 (PR [#3953](https://github.com/javaparser/javaparser/pull/3953) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@blacelle](https://github.com/blacelle) +* [@jlerbsc](https://github.com/jlerbsc) + + +Version 3.25.1 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/197?closed=1) + +### API or Behaviour Change + +* Fix: Issue 3045 Unexpected exception when solving type inside an Anonymous class (PR [#3896](https://github.com/javaparser/javaparser/pull/3896) by [@jlerbsc](https://github.com/jlerbsc)) + +### Added + +* Improved search for functional interfaces (PR [#3894](https://github.com/javaparser/javaparser/pull/3894) by [@jlerbsc](https://github.com/jlerbsc)) + +### Changed + +* chore(deps): bump maven-compiler-plugin from 3.10.1 to 3.11.0 (PR [#3928](https://github.com/javaparser/javaparser/pull/3928) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump checkstyle from 10.7.0 to 10.8.0 (PR [#3927](https://github.com/javaparser/javaparser/pull/3927) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump versions-maven-plugin from 2.14.2 to 2.15.0 (PR [#3914](https://github.com/javaparser/javaparser/pull/3914) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-javadoc-plugin from 3.4.1 to 3.5.0 (PR [#3906](https://github.com/javaparser/javaparser/pull/3906) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Refactor: cleanup/refactor code after fixing #3859 (PR [#3886](https://github.com/javaparser/javaparser/pull/3886) by [@abego](https://github.com/abego)) + +### Fixed + +* Fix: issue 3924 Removing ImportDeclaration with Annotated package thr… (PR [#3926](https://github.com/javaparser/javaparser/pull/3926) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3918 JavaParserTypeDeclarationAdapter resolving wrong Type via Ancestor (PR [#3921](https://github.com/javaparser/javaparser/pull/3921) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3919 ResolvedType::isAssignableBy(ResolvedType) is wrong f… (PR [#3920](https://github.com/javaparser/javaparser/pull/3920) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3911 java.lang.UnsupportedOperationException: T[] while resolving generic method with type parameter with arrays like List (PR [#3917](https://github.com/javaparser/javaparser/pull/3917) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: \s escape gives lexical error but should be valid since Java 15 (PR [#3903](https://github.com/javaparser/javaparser/pull/3903) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Issue 3045 Unexpected exception when solving type inside an Anonymous class (PR [#3896](https://github.com/javaparser/javaparser/pull/3896) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue 1883 Finding lambda return type (PR [#3890](https://github.com/javaparser/javaparser/pull/3890) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 1815 ArrayIndexOutOfBoundsException when resolving lambda parameter. This fix is offered by Blackgen (PR [#3888](https://github.com/javaparser/javaparser/pull/3888) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump checkstyle from 10.6.0 to 10.7.0 (PR [#3885](https://github.com/javaparser/javaparser/pull/3885) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@abego](https://github.com/abego) +* [@jlerbsc](https://github.com/jlerbsc) + + +Version 3.25.0 +-------------- + +[issues resolved](https://github.com/javaparser/javaparser/milestone/196?closed=1) + +### Added + +* First part of the implementation of least upper bound logic (PR [#3880](https://github.com/javaparser/javaparser/pull/3880) by [@jlerbsc](https://github.com/jlerbsc)) +* feat: Improved support for calculating the type of an object creation… (PR [#3877](https://github.com/javaparser/javaparser/pull/3877) by [@jlerbsc](https://github.com/jlerbsc)) +* feat: Implement addRecord & getRecordByName for CompilationUnit (PR [#3836](https://github.com/javaparser/javaparser/pull/3836) by [@marcluque](https://github.com/marcluque)) +* Support Jigsaw requires static (PR [#3826](https://github.com/javaparser/javaparser/pull/3826) by [@jlerbsc](https://github.com/jlerbsc)) +* Add toDescriptor to ResolvedMethodDeclaration (PR [#3819](https://github.com/javaparser/javaparser/pull/3819) by [@vanHekthor](https://github.com/vanHekthor)) +* Refactoring context (WIP) (PR [#3792](https://github.com/javaparser/javaparser/pull/3792) by [@jlerbsc](https://github.com/jlerbsc)) +* Refactoring context (WIP) (PR [#3782](https://github.com/javaparser/javaparser/pull/3782) by [@jlerbsc](https://github.com/jlerbsc)) +* Refactoring convert to usage (PR [#3774](https://github.com/javaparser/javaparser/pull/3774) by [@jlerbsc](https://github.com/jlerbsc)) +* Simplified usage of class AssociableToAST (PR [#3063](https://github.com/javaparser/javaparser/pull/3063) by [@4everTheOne](https://github.com/4everTheOne)) + +### Changed + +* Revert import related checkstyle rule from error to warning (PR [#3881](https://github.com/javaparser/javaparser/pull/3881) by [@jlerbsc](https://github.com/jlerbsc)) +* Minor refactoring for example to get all parameter types (PR [#3879](https://github.com/javaparser/javaparser/pull/3879) by [@jlerbsc](https://github.com/jlerbsc)) +* Add header and footer methods in comments instead of using literal st… (PR [#3876](https://github.com/javaparser/javaparser/pull/3876) by [@jlerbsc](https://github.com/jlerbsc)) +* In the context of lexical preservation, the CSM token must be added m… (PR [#3874](https://github.com/javaparser/javaparser/pull/3874) by [@jlerbsc](https://github.com/jlerbsc)) +* Refactoring: remove useless code that is already implemented (PR [#3869](https://github.com/javaparser/javaparser/pull/3869) by [@jlerbsc](https://github.com/jlerbsc)) +* Memory usage improvement when printing a node from the LexicalPreserv… (PR [#3858](https://github.com/javaparser/javaparser/pull/3858) by [@jlerbsc](https://github.com/jlerbsc)) +* chore(deps-dev): bump assertj-core from 3.24.1 to 3.24.2 (PR [#3852](https://github.com/javaparser/javaparser/pull/3852) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-checkstyle-plugin from 3.2.0 to 3.2.1 (PR [#3846](https://github.com/javaparser/javaparser/pull/3846) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-dependency-plugin from 3.4.0 to 3.5.0 (PR [#3845](https://github.com/javaparser/javaparser/pull/3845) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update junit5 monorepo to v5.9.2 (PR [#3840](https://github.com/javaparser/javaparser/pull/3840) by [@renovate[bot]](https://github.com/apps/renovate)) +* Minor refactoring on Difference class (PR [#3839](https://github.com/javaparser/javaparser/pull/3839) by [@jlerbsc](https://github.com/jlerbsc)) +* chore(deps-dev): bump assertj-core from 3.23.1 to 3.24.1 (PR [#3837](https://github.com/javaparser/javaparser/pull/3837) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump actions/checkout from 3.2.0 to 3.3.0 (PR [#3834](https://github.com/javaparser/javaparser/pull/3834) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump checkstyle from 10.5.0 to 10.6.0 (PR [#3829](https://github.com/javaparser/javaparser/pull/3829) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Fixed + +* Fix: Method hasScope must return true on NodeWithOptionalScope and No… (PR [#3875](https://github.com/javaparser/javaparser/pull/3875) by [@jlerbsc](https://github.com/jlerbsc)) +* fix #3859 UnsupportedOperationException when trying to resolve a type… (PR [#3873](https://github.com/javaparser/javaparser/pull/3873) by [@abego](https://github.com/abego)) +* Fix: issue 3866 Symbol solver is unable to resolve inner classes of ancestors when they are prefixed with a subclass (PR [#3868](https://github.com/javaparser/javaparser/pull/3868) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: issue 3703 Allow removing empty parentheses after removing all pairs from an annotation (PR [#3865](https://github.com/javaparser/javaparser/pull/3865) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: One must be able to know if any resolved type is a boxed primiti… (PR [#3864](https://github.com/javaparser/javaparser/pull/3864) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Issue 2374 Comments of added Nodes are ignored in LexicalPreserv… (PR [#3856](https://github.com/javaparser/javaparser/pull/3856) by [@jlerbsc](https://github.com/jlerbsc)) +* Checkstyle for unused import (PR [#3841](https://github.com/javaparser/javaparser/pull/3841) by [@4everTheOne](https://github.com/4everTheOne)) +* Update bnd file (PR [#3783](https://github.com/javaparser/javaparser/pull/3783) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* Update javaparser copyright headers (PR [#3862](https://github.com/javaparser/javaparser/pull/3862) by [@jlerbsc](https://github.com/jlerbsc)) + +### Uncategorised + +* Add test case to verify range calculation on ArrayType (PR [#3828](https://github.com/javaparser/javaparser/pull/3828) by [@jlerbsc](https://github.com/jlerbsc)) +* Add test case to verify that LexicalPreservation supports TextBlock (PR [#3827](https://github.com/javaparser/javaparser/pull/3827) by [@jlerbsc](https://github.com/jlerbsc)) +* Refactoring: Removing useless method convertToUsage in JavaParserFacade (PR [#3780](https://github.com/javaparser/javaparser/pull/3780) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@vanHekthor](https://github.com/vanHekthor) +* [@abego](https://github.com/abego) +* [@jlerbsc](https://github.com/jlerbsc) +* [@marcluque](https://github.com/marcluque) +* [@4everTheOne](https://github.com/4everTheOne) + + +Version 3.24.10 +--------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/194?closed=1) + +### Added + +* Add a method in LexicalPreservingPrinter to know if LPP is available/activated on the specified node (PR [#3823](https://github.com/javaparser/javaparser/pull/3823) by [@jlerbsc](https://github.com/jlerbsc)) +* Handle nested records (PR [#3814](https://github.com/javaparser/javaparser/pull/3814) by [@mernst](https://github.com/mernst)) +* Source printer import ordering strategy (PR [#3807](https://github.com/javaparser/javaparser/pull/3807) by [@4everTheOne](https://github.com/4everTheOne)) + +### Changed + +* chore(deps): bump versions-maven-plugin from 2.14.1 to 2.14.2 (PR [#3817](https://github.com/javaparser/javaparser/pull/3817) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Enabled import validation (PR [#3812](https://github.com/javaparser/javaparser/pull/3812) by [@4everTheOne](https://github.com/4everTheOne)) +* Part 5 | Import organization (PR [#3805](https://github.com/javaparser/javaparser/pull/3805) by [@4everTheOne](https://github.com/4everTheOne)) +* Part 4 | Import organization (PR [#3804](https://github.com/javaparser/javaparser/pull/3804) by [@4everTheOne](https://github.com/4everTheOne)) +* Part 3 | Import organization (PR [#3803](https://github.com/javaparser/javaparser/pull/3803) by [@4everTheOne](https://github.com/4everTheOne)) +* Part 2 | Import organization (PR [#3802](https://github.com/javaparser/javaparser/pull/3802) by [@4everTheOne](https://github.com/4everTheOne)) +* Part 1 | Import organization (PR [#3801](https://github.com/javaparser/javaparser/pull/3801) by [@4everTheOne](https://github.com/4everTheOne)) +* Checkstyle configuration tweaks (PR [#3799](https://github.com/javaparser/javaparser/pull/3799) by [@4everTheOne](https://github.com/4everTheOne)) +* chore(deps): bump versions-maven-plugin from 2.13.0 to 2.14.1 (PR [#3797](https://github.com/javaparser/javaparser/pull/3797) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump actions/checkout from 3.1.0 to 3.2.0 (PR [#3789](https://github.com/javaparser/javaparser/pull/3789) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump checkstyle from 8.45.1 to 10.5.0 (PR [#3788](https://github.com/javaparser/javaparser/pull/3788) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Fixed + +* explicit use asString for performance (PR [#3821](https://github.com/javaparser/javaparser/pull/3821) by [@dencat](https://github.com/dencat)) +* Fix: issue #3818 Wrong range calculation on ArrayType with multiple d… (PR [#3820](https://github.com/javaparser/javaparser/pull/3820) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Lexical Preserving Fails To Remove Comment (PR [#3810](https://github.com/javaparser/javaparser/pull/3810) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): bump versions-maven-plugin from 2.13.0 to 2.14.0 (PR [#3794](https://github.com/javaparser/javaparser/pull/3794) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Basic CheckStyle validation (PR [#3781](https://github.com/javaparser/javaparser/pull/3781) by [@4everTheOne](https://github.com/4everTheOne)) + +### Uncategorised + +* Fix: 3412 Remove walkmod again (PR [#3806](https://github.com/javaparser/javaparser/pull/3806) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@dencat](https://github.com/dencat) +* [@jlerbsc](https://github.com/jlerbsc) +* [@mernst](https://github.com/mernst) +* [@4everTheOne](https://github.com/4everTheOne) + + +Version 3.24.9 +--------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/193?closed=1) + +### Highlights + +* Remove "executable" bit from code files (PR [#3755](https://github.com/javaparser/javaparser/pull/3755) by [@icmdaf](https://github.com/icmdaf)) + +### Added + +* Created TypeSolverBuilder (PR [#3421](https://github.com/javaparser/javaparser/pull/3421) by [@4everTheOne](https://github.com/4everTheOne)) + +### Changed + +* Changing, in test classes, the initialization of the lexical preserva… (PR [#3779](https://github.com/javaparser/javaparser/pull/3779) by [@jlerbsc](https://github.com/jlerbsc)) +* chore(deps): bump maven-dependency-plugin from 3.3.0 to 3.4.0 (PR [#3770](https://github.com/javaparser/javaparser/pull/3770) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): bump maven-install-plugin from 3.0.1 to 3.1.0 (PR [#3756](https://github.com/javaparser/javaparser/pull/3756) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Fixed + +* Fix: #3195 Resolved methods in outer classes not inferred correcly (PR [#3778](https://github.com/javaparser/javaparser/pull/3778) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3681 LineComment alwaysing trimming content (PR [#3777](https://github.com/javaparser/javaparser/pull/3777) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3773 Replacing nodes causes error in lexical preserving printer… (PR [#3776](https://github.com/javaparser/javaparser/pull/3776) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #2517 Modifying some nodes with the lexicalPreservation enabled … (PR [#3775](https://github.com/javaparser/javaparser/pull/3775) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3725 JavaParserFacade var type in for-each loop cannot be resolved (PR [#3768](https://github.com/javaparser/javaparser/pull/3768) by [@abego](https://github.com/abego)) +* Fix: #3216 LexicalPreservingPrinter add Wrong indentation when removing comments (PR [#3766](https://github.com/javaparser/javaparser/pull/3766) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3472 Line comment removal causes IllegalStateException with LexicalPreservingPrinter (PR [#3765](https://github.com/javaparser/javaparser/pull/3765) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3441 LexicalPreservingPrinter prints wrong output with line com… (PR [#3764](https://github.com/javaparser/javaparser/pull/3764) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #2137 ClassOrInterfaceDeclaration addMember using index (PR [#3763](https://github.com/javaparser/javaparser/pull/3763) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3761 Lexical preserving corrupts source when adding a modifier in first position (PR [#3762](https://github.com/javaparser/javaparser/pull/3762) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3693 Removing modifiers from method declaration results in loss… (PR [#3760](https://github.com/javaparser/javaparser/pull/3760) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: #3750 Lexical preserving corrupts source (PR [#3759](https://github.com/javaparser/javaparser/pull/3759) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix: Fix the indentation generated by the LexicalPreservingPrinter wh… (PR [#3758](https://github.com/javaparser/javaparser/pull/3758) by [@jlerbsc](https://github.com/jlerbsc)) + +### Security + +* Remove "executable" bit from code files (PR [#3755](https://github.com/javaparser/javaparser/pull/3755) by [@icmdaf](https://github.com/icmdaf)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@abego](https://github.com/abego) +* [@jlerbsc](https://github.com/jlerbsc) +* [@icmdaf](https://github.com/icmdaf) +* [@4everTheOne](https://github.com/4everTheOne) + + +Version 3.24.8 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/192?closed=1) + +### Added + +* [Fixes #3099] Added ability to solve type with a list of expected type arguments (PR [#3213](https://github.com/javaparser/javaparser/pull/3213) by [@4everTheOne](https://github.com/4everTheOne)) +* [Suggestion] NonNull generator for parameters (PR [#3127](https://github.com/javaparser/javaparser/pull/3127) by [@4everTheOne](https://github.com/4everTheOne)) + +### Changed + +* Updated workflow to only run one job per PR (PR [#3744](https://github.com/javaparser/javaparser/pull/3744) by [@4everTheOne](https://github.com/4everTheOne)) +* Remove or comment system.out.println statement in unit tests (PR [#3741](https://github.com/javaparser/javaparser/pull/3741) by [@jlerbsc](https://github.com/jlerbsc)) +* Added Optional method in SymbolReference (PR [#3740](https://github.com/javaparser/javaparser/pull/3740) by [@4everTheOne](https://github.com/4everTheOne)) +* Centralized management of symbol solver exceptions to prevent exception type Erasion (PR [#3731](https://github.com/javaparser/javaparser/pull/3731) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix issue #1827 Issue resolving a constructor of a class using generics (PR [#3752](https://github.com/javaparser/javaparser/pull/3752) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3728 ParseProblemException (PR [#3743](https://github.com/javaparser/javaparser/pull/3743) by [@jlerbsc](https://github.com/jlerbsc)) +* Updated Badge for Build and Coverage (PR [#3742](https://github.com/javaparser/javaparser/pull/3742) by [@4everTheOne](https://github.com/4everTheOne)) +* Position (PR [#3734](https://github.com/javaparser/javaparser/pull/3734) by [@ameliagenova](https://github.com/ameliagenova)) +* Fix part of issue #3721 UnsupportedOperationException while trying to modify the type of a variable (PR [#3726](https://github.com/javaparser/javaparser/pull/3726) by [@jlerbsc](https://github.com/jlerbsc)) +* Implemented isReferenceType in `ResolvedTypeDeclaration` and isTypeParameter in `ResolvedTypeParameterDeclaration` (PR [#3206](https://github.com/javaparser/javaparser/pull/3206) by [@4everTheOne](https://github.com/4everTheOne)) + +### Developer Changes + +* chore(deps): bump versions-maven-plugin from 2.12.0 to 2.13.0 (PR [#3727](https://github.com/javaparser/javaparser/pull/3727) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Fix maven wrapper not found in generator scripts (PR [#3717](https://github.com/javaparser/javaparser/pull/3717) by [@PPazderski](https://github.com/PPazderski)) +* chore(deps): bump actions/checkout from 3.0.2 to 3.1.0 (PR [#3716](https://github.com/javaparser/javaparser/pull/3716) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### Uncategorised + +* Change issue 1945 test to paramaterized (PR [#3739](https://github.com/javaparser/javaparser/pull/3739) by [@flanbino](https://github.com/flanbino)) +* More unit tests for JavaToken and CodeGenerationUtils (PR [#3736](https://github.com/javaparser/javaparser/pull/3736) by [@ameliagenova](https://github.com/ameliagenova)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@flanbino](https://github.com/flanbino) +* [@PPazderski](https://github.com/PPazderski) +* [@ameliagenova](https://github.com/ameliagenova) +* [@jlerbsc](https://github.com/jlerbsc) +* [@4everTheOne](https://github.com/4everTheOne) + + + +Version 3.24.7 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/191?closed=1) + +### Highlights + +* Issue #3415 (PR [#3722](https://github.com/javaparser/javaparser/pull/3722) by [@nelson-ng-96](https://github.com/nelson-ng-96)) + +### Changed + +* Refactoring - use of existing methods (PR [#3697](https://github.com/javaparser/javaparser/pull/3697) by [@jlerbsc](https://github.com/jlerbsc)) +* Refactoring adding convenient methods to know if a DifferenceElement is added, removed or kept (PR [#3695](https://github.com/javaparser/javaparser/pull/3695) by [@jlerbsc](https://github.com/jlerbsc)) + +### Deprecated + +* Issue #3415 (PR [#3722](https://github.com/javaparser/javaparser/pull/3722) by [@nelson-ng-96](https://github.com/nelson-ng-96)) + +### Fixed + +* Fix for ReflectionAnnotationDeclaration getClassName() (PR [#3723](https://github.com/javaparser/javaparser/pull/3723) by [@Blackgen](https://github.com/Blackgen)) +* Fix some yield expressions not recognized (PR [#3714](https://github.com/javaparser/javaparser/pull/3714) by [@PPazderski](https://github.com/PPazderski)) +* Accept final in instanceof pattern (PR [#3713](https://github.com/javaparser/javaparser/pull/3713) by [@PPazderski](https://github.com/PPazderski)) +* [Fix] Avoid test failure due to line separator differences on windows host (PR [#3711](https://github.com/javaparser/javaparser/pull/3711) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3700 Removing last statement with LexicalPreservingPrinter results in loss of indendation (PR [#3704](https://github.com/javaparser/javaparser/pull/3704) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3678 Function accepts a configuration but it does not do anything (PR [#3692](https://github.com/javaparser/javaparser/pull/3692) by [@jlerbsc](https://github.com/jlerbsc)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@PPazderski](https://github.com/PPazderski) +* [@nelson-ng-96](https://github.com/nelson-ng-96) +* [@Blackgen](https://github.com/Blackgen) +* [@jlerbsc](https://github.com/jlerbsc) + + +Version 3.24.6 +-------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/190?closed=1) + +### API or Behaviour Change + +* Issue #3405 thread safety of pre/postprocessors (incl. breaking change to `Processor` with pre/post processor methods). (PR [#3515](https://github.com/javaparser/javaparser/pull/3515) by [@matozoid](https://github.com/matozoid)) + +### Changed + +* chore(deps): bump javassist from 3.29.0-GA to 3.29.1-GA (PR [#3661](https://github.com/javaparser/javaparser/pull/3661) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update junit5 monorepo to v5.9.0 (PR [#3645](https://github.com/javaparser/javaparser/pull/3645) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump maven-resources-plugin from 3.2.0 to 3.3.0 (PR [#3644](https://github.com/javaparser/javaparser/pull/3644) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Flexible symbol resolution for declaration types (PR [#3634](https://github.com/javaparser/javaparser/pull/3634) by [@Col-E](https://github.com/Col-E)) +* Minor refactoring to manage check in range and use hasRange method in class CommentsInserter (PR [#3587](https://github.com/javaparser/javaparser/pull/3587) by [@jlerbsc](https://github.com/jlerbsc)) +* Renaming PACKAGE_PRIVATE to NONE (this refers to the discussion in the issue #2242) (PR [#3573](https://github.com/javaparser/javaparser/pull/3573) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix typos (PR [#3675](https://github.com/javaparser/javaparser/pull/3675) by [@mernst](https://github.com/mernst)) +* Fix issue #3614 UnsolvedSymbolException when package declaration contains comment (PR [#3671](https://github.com/javaparser/javaparser/pull/3671) by [@jlerbsc](https://github.com/jlerbsc)) +* chore(deps): update dependency org.apache.maven.plugins:maven-install-plugin to v3.0.0 (PR [#3640](https://github.com/javaparser/javaparser/pull/3640) by [@renovate[bot]](https://github.com/apps/renovate)) +* Fix documentation of `JAVA_17` (PR [#3623](https://github.com/javaparser/javaparser/pull/3623) by [@mernst](https://github.com/mernst)) +* Fix issue 3631 NameExpr.resolve() does not take end of inner block scopes into account (PR [#3613](https://github.com/javaparser/javaparser/pull/3613) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3588 Modifier is removed when removing an annotation (PR [#3600](https://github.com/javaparser/javaparser/pull/3600) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix lambda generic types that are always resolved to the first type param (PR [#3595](https://github.com/javaparser/javaparser/pull/3595) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix issue #3489 SourceRoot.tryToParse() fails if the root path ends with a directory that is not a java identifier (PR [#3551](https://github.com/javaparser/javaparser/pull/3551) by [@jlerbsc](https://github.com/jlerbsc)) +* Default pretty printer should print inner-class receiver parameters on constructors (PR [#3527](https://github.com/javaparser/javaparser/pull/3527) by [@kelloggm](https://github.com/kelloggm)) +* Issue #3405 thread safety of pre/postprocessors (incl. breaking change to `Processor` with pre/post processor methods). (PR [#3515](https://github.com/javaparser/javaparser/pull/3515) by [@matozoid](https://github.com/matozoid)) + +### Developer Changes + +* chore(deps): update dependency org.apache.maven.plugins:maven-install-plugin to v3.0.1 (PR [#3641](https://github.com/javaparser/javaparser/pull/3641) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-deploy-plugin to v3.0.0 (PR [#3639](https://github.com/javaparser/javaparser/pull/3639) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump exec-maven-plugin from 3.0.0 to 3.1.0 (PR [#3637](https://github.com/javaparser/javaparser/pull/3637) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency com.squareup.okhttp3:okhttp to v4.10.0 (PR [#3612](https://github.com/javaparser/javaparser/pull/3612) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6.3.1 (PR [#3607](https://github.com/javaparser/javaparser/pull/3607) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.0.0-m7 (PR [#3605](https://github.com/javaparser/javaparser/pull/3605) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.6.1 (PR [#3601](https://github.com/javaparser/javaparser/pull/3601) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6.3.0 (PR [#3598](https://github.com/javaparser/javaparser/pull/3598) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.23.1 (PR [#3596](https://github.com/javaparser/javaparser/pull/3596) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.23.0 (PR [#3594](https://github.com/javaparser/javaparser/pull/3594) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-scm-plugin to v1.13.0 (PR [#3593](https://github.com/javaparser/javaparser/pull/3593) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.6.0 (PR [#3589](https://github.com/javaparser/javaparser/pull/3589) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.codehaus.mojo:versions-maven-plugin to v2.11.0 (PR [#3585](https://github.com/javaparser/javaparser/pull/3585) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency org.javassist:javassist to v3.29.0-ga (PR [#3581](https://github.com/javaparser/javaparser/pull/3581) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.jbehave:jbehave-core to v4.8.3 (PR [#3574](https://github.com/javaparser/javaparser/pull/3574) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump codecov/codecov-action from 3.0.0 to 3.1.0 (PR [#3567](https://github.com/javaparser/javaparser/pull/3567) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update actions/checkout action to v3.0.2 (PR [#3565](https://github.com/javaparser/javaparser/pull/3565) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.5.1 (PR [#3564](https://github.com/javaparser/javaparser/pull/3564) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-site-plugin to v3.12.0 (PR [#3561](https://github.com/javaparser/javaparser/pull/3561) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.4.0 (PR [#3560](https://github.com/javaparser/javaparser/pull/3560) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.5.0 (PR [#3557](https://github.com/javaparser/javaparser/pull/3557) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v3.0.1 (PR [#3555](https://github.com/javaparser/javaparser/pull/3555) by [@renovate[bot]](https://github.com/apps/renovate)) +* official Apache Maven wrapper (PR [#3552](https://github.com/javaparser/javaparser/pull/3552) by [@sullis](https://github.com/sullis)) +* chore(deps): update codecov/codecov-action action to v3 (PR [#3545](https://github.com/javaparser/javaparser/pull/3545) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.jacoco:jacoco-maven-plugin to v0.8.8 (PR [#3544](https://github.com/javaparser/javaparser/pull/3544) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3.2.0 (PR [#3542](https://github.com/javaparser/javaparser/pull/3542) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.0.0-m6 (PR [#3541](https://github.com/javaparser/javaparser/pull/3541) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Implemented JavaParserTypeVariableDeclaration getAncestors method (PR [#3060](https://github.com/javaparser/javaparser/pull/3060) by [@4everTheOne](https://github.com/4everTheOne)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@sullis](https://github.com/sullis) +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@kelloggm](https://github.com/kelloggm) +* [@jlerbsc](https://github.com/jlerbsc) +* [@mernst](https://github.com/mernst) +* [@Col-E](https://github.com/Col-E) +* [@matozoid](https://github.com/matozoid) +* [@4everTheOne](https://github.com/4everTheOne) + + +Version 3.24.4 - Repeat of 3.24.3 +--------------------------------- +[issues resolved](https://github.com/javaparser/javaparser/milestone/190?closed=1) + +GPG Fingerprint: `253E8E4C6FB28D11748115C1249DEE8E2C07A0A2` + +### API or Behaviour Change + +* Issue #3405 thread safety of pre/postprocessors (incl. breaking change to `Processor` with pre/post processor methods). (PR [#3515](https://github.com/javaparser/javaparser/pull/3515) by [@matozoid](https://github.com/matozoid)) + +### Changed + +* chore(deps): update junit5 monorepo to v5.9.0 (PR [#3645](https://github.com/javaparser/javaparser/pull/3645) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump maven-resources-plugin from 3.2.0 to 3.3.0 (PR [#3644](https://github.com/javaparser/javaparser/pull/3644) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Flexible symbol resolution for declaration types (PR [#3634](https://github.com/javaparser/javaparser/pull/3634) by [@Col-E](https://github.com/Col-E)) +* Minor refactoring to manage check in range and use hasRange method in class CommentsInserter (PR [#3587](https://github.com/javaparser/javaparser/pull/3587) by [@jlerbsc](https://github.com/jlerbsc)) +* Renaming PACKAGE_PRIVATE to NONE (this refers to the discussion in the issue #2242) (PR [#3573](https://github.com/javaparser/javaparser/pull/3573) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* chore(deps): update dependency org.apache.maven.plugins:maven-install-plugin to v3.0.0 (PR [#3640](https://github.com/javaparser/javaparser/pull/3640) by [@renovate[bot]](https://github.com/apps/renovate)) +* Fix documentation of `JAVA_17` (PR [#3623](https://github.com/javaparser/javaparser/pull/3623) by [@mernst](https://github.com/mernst)) +* Fix issue 3631 NameExpr.resolve() does not take end of inner block scopes into account (PR [#3613](https://github.com/javaparser/javaparser/pull/3613) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3588 Modifier is removed when removing an annotation (PR [#3600](https://github.com/javaparser/javaparser/pull/3600) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix lambda generic types that are always resolved to the first type param (PR [#3595](https://github.com/javaparser/javaparser/pull/3595) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix issue #3489 SourceRoot.tryToParse() fails if the root path ends with a directory that is not a java identifier (PR [#3551](https://github.com/javaparser/javaparser/pull/3551) by [@jlerbsc](https://github.com/jlerbsc)) +* Default pretty printer should print inner-class receiver parameters on constructors (PR [#3527](https://github.com/javaparser/javaparser/pull/3527) by [@kelloggm](https://github.com/kelloggm)) +* Issue #3405 thread safety of pre/postprocessors (incl. breaking change to `Processor` with pre/post processor methods). (PR [#3515](https://github.com/javaparser/javaparser/pull/3515) by [@matozoid](https://github.com/matozoid)) + +### Developer Changes + +* chore(deps): update dependency org.apache.maven.plugins:maven-install-plugin to v3.0.1 (PR [#3641](https://github.com/javaparser/javaparser/pull/3641) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-deploy-plugin to v3.0.0 (PR [#3639](https://github.com/javaparser/javaparser/pull/3639) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump exec-maven-plugin from 3.0.0 to 3.1.0 (PR [#3637](https://github.com/javaparser/javaparser/pull/3637) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency com.squareup.okhttp3:okhttp to v4.10.0 (PR [#3612](https://github.com/javaparser/javaparser/pull/3612) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6.3.1 (PR [#3607](https://github.com/javaparser/javaparser/pull/3607) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.0.0-m7 (PR [#3605](https://github.com/javaparser/javaparser/pull/3605) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.6.1 (PR [#3601](https://github.com/javaparser/javaparser/pull/3601) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6.3.0 (PR [#3598](https://github.com/javaparser/javaparser/pull/3598) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.23.1 (PR [#3596](https://github.com/javaparser/javaparser/pull/3596) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.23.0 (PR [#3594](https://github.com/javaparser/javaparser/pull/3594) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-scm-plugin to v1.13.0 (PR [#3593](https://github.com/javaparser/javaparser/pull/3593) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.6.0 (PR [#3589](https://github.com/javaparser/javaparser/pull/3589) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.codehaus.mojo:versions-maven-plugin to v2.11.0 (PR [#3585](https://github.com/javaparser/javaparser/pull/3585) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency org.javassist:javassist to v3.29.0-ga (PR [#3581](https://github.com/javaparser/javaparser/pull/3581) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.jbehave:jbehave-core to v4.8.3 (PR [#3574](https://github.com/javaparser/javaparser/pull/3574) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): bump codecov/codecov-action from 3.0.0 to 3.1.0 (PR [#3567](https://github.com/javaparser/javaparser/pull/3567) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update actions/checkout action to v3.0.2 (PR [#3565](https://github.com/javaparser/javaparser/pull/3565) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.5.1 (PR [#3564](https://github.com/javaparser/javaparser/pull/3564) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-site-plugin to v3.12.0 (PR [#3561](https://github.com/javaparser/javaparser/pull/3561) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.4.0 (PR [#3560](https://github.com/javaparser/javaparser/pull/3560) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-inline to v4.5.0 (PR [#3557](https://github.com/javaparser/javaparser/pull/3557) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v3.0.1 (PR [#3555](https://github.com/javaparser/javaparser/pull/3555) by [@renovate[bot]](https://github.com/apps/renovate)) +* official Apache Maven wrapper (PR [#3552](https://github.com/javaparser/javaparser/pull/3552) by [@sullis](https://github.com/sullis)) +* chore(deps): update codecov/codecov-action action to v3 (PR [#3545](https://github.com/javaparser/javaparser/pull/3545) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.jacoco:jacoco-maven-plugin to v0.8.8 (PR [#3544](https://github.com/javaparser/javaparser/pull/3544) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3.2.0 (PR [#3542](https://github.com/javaparser/javaparser/pull/3542) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.0.0-m6 (PR [#3541](https://github.com/javaparser/javaparser/pull/3541) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Implemented JavaParserTypeVariableDeclaration getAncestors method (PR [#3060](https://github.com/javaparser/javaparser/pull/3060) by [@4everTheOne](https://github.com/4everTheOne)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@sullis](https://github.com/sullis) +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@kelloggm](https://github.com/kelloggm) +* [@jlerbsc](https://github.com/jlerbsc) +* [@mernst](https://github.com/mernst) +* [@Col-E](https://github.com/Col-E) +* [@matozoid](https://github.com/matozoid) +* [@4everTheOne](https://github.com/4everTheOne) + + +Version 3.24.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/190?closed=1) + +### API or Behaviour Change + +* Issue #3405 thread safety of pre/postprocessors (incl. breaking change to `Processor` with pre/post processor methods). (PR [#3515](https://github.com/javaparser/javaparser/pull/3515) by [@matozoid](https://github.com/matozoid)) + +### Changed + +* Minor refactoring to manage check in range and use hasRange method in class CommentsInserter (PR [#3587](https://github.com/javaparser/javaparser/pull/3587) by [@jlerbsc](https://github.com/jlerbsc)) +* Renaming PACKAGE_PRIVATE to NONE (this refers to the discussion in the issue #2242) (PR [#3573](https://github.com/javaparser/javaparser/pull/3573) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix documentation of `JAVA_17` (PR [#3623](https://github.com/javaparser/javaparser/pull/3623) by [@mernst](https://github.com/mernst)) +* Fix issue 3631 NameExpr.resolve() does not take end of inner block scopes into account (PR [#3613](https://github.com/javaparser/javaparser/pull/3613) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3588 Modifier is removed when removing an annotation (PR [#3600](https://github.com/javaparser/javaparser/pull/3600) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix lambda generic types that are always resolved to the first type param (PR [#3595](https://github.com/javaparser/javaparser/pull/3595) by [@johannescoetzee](https://github.com/johannescoetzee)) +* Fix issue #3489 SourceRoot.tryToParse() fails if the root path ends with a directory that is not a java identifier (PR [#3551](https://github.com/javaparser/javaparser/pull/3551) by [@jlerbsc](https://github.com/jlerbsc)) +* Default pretty printer should print inner-class receiver parameters on constructors (PR [#3527](https://github.com/javaparser/javaparser/pull/3527) by [@kelloggm](https://github.com/kelloggm)) +* Issue #3405 thread safety of pre/postprocessors (incl. breaking change to `Processor` with pre/post processor methods). (PR [#3515](https://github.com/javaparser/javaparser/pull/3515) by [@matozoid](https://github.com/matozoid)) + +### Developer Changes + +* chore(deps): update actions/checkout action to v3.0.1 (PR [#3555](https://github.com/javaparser/javaparser/pull/3555) by [@renovate[bot]](https://github.com/apps/renovate)) +* official Apache Maven wrapper (PR [#3552](https://github.com/javaparser/javaparser/pull/3552) by [@sullis](https://github.com/sullis)) +* chore(deps): update codecov/codecov-action action to v3 (PR [#3545](https://github.com/javaparser/javaparser/pull/3545) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.jacoco:jacoco-maven-plugin to v0.8.8 (PR [#3544](https://github.com/javaparser/javaparser/pull/3544) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3.2.0 (PR [#3542](https://github.com/javaparser/javaparser/pull/3542) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.0.0-m6 (PR [#3541](https://github.com/javaparser/javaparser/pull/3541) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@sullis](https://github.com/sullis) +* [@johannescoetzee](https://github.com/johannescoetzee) +* [@kelloggm](https://github.com/kelloggm) +* [@jlerbsc](https://github.com/jlerbsc) +* [@mernst](https://github.com/mernst) +* [@matozoid](https://github.com/matozoid) + +Version 3.24.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/188?closed=1) + +GPG Fingerprint: `253E8E4C6FB28D11748115C1249DEE8E2C07A0A2` + +### Added + +* Improve unit test for BlockStmtContextResolutionTest (PR [#3530](https://github.com/javaparser/javaparser/pull/3530) by [@jlerbsc](https://github.com/jlerbsc)) + +### Changed + +* Improve Conditional Operator resolution [JLS 15.25] (PR [#3522](https://github.com/javaparser/javaparser/pull/3522) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix issue #3526 Variable or FieldDeclaration is not resolved correctl… (PR [#3529](https://github.com/javaparser/javaparser/pull/3529) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* Bump jbehave-junit-runner from 2.3.0 to 2.3.1 (PR [#3531](https://github.com/javaparser/javaparser/pull/3531) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Bump actions/cache from 2.1.7 to 3 (PR [#3525](https://github.com/javaparser/javaparser/pull/3525) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Update JDK 18 and add JDK 19 feature details to FEATURES.md (PR [#3521](https://github.com/javaparser/javaparser/pull/3521) by [@MysterAitch](https://github.com/MysterAitch)) +* Bump maven-dependency-plugin from 3.2.0 to 3.3.0 (PR [#3514](https://github.com/javaparser/javaparser/pull/3514) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency org.apache.maven.plugins:maven-dependency-plugin to v3.3.0 (PR [#3512](https://github.com/javaparser/javaparser/pull/3512) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.10.1 (PR [#3511](https://github.com/javaparser/javaparser/pull/3511) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action (PR [#3508](https://github.com/javaparser/javaparser/pull/3508) by [@renovate[bot]](https://github.com/apps/renovate)) +* Bump bnd-maven-plugin from 6.1.0 to 6.2.0 (PR [#3505](https://github.com/javaparser/javaparser/pull/3505) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6.2.0 (PR [#3503](https://github.com/javaparser/javaparser/pull/3503) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/setup-java action to v3 (PR [#3502](https://github.com/javaparser/javaparser/pull/3502) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@MysterAitch](https://github.com/MysterAitch) +* [@jlerbsc](https://github.com/jlerbsc) + + +Version 3.24.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/189?closed=1) + +### Fixed + +* Adding constructor descriptor (PR [#3499](https://github.com/javaparser/javaparser/pull/3499) by [@kanghj](https://github.com/kanghj)) +* Fix issue #3491 Method has a multidimensional arrays argument in jar … (PR [#3493](https://github.com/javaparser/javaparser/pull/3493) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3218 GetSourceRoots() does not return all source roots (PR [#3485](https://github.com/javaparser/javaparser/pull/3485) by [@jlerbsc](https://github.com/jlerbsc)) +* Bug in ArrayCreationExpr constructors (PR [#3473](https://github.com/javaparser/javaparser/pull/3473) by [@sergekukharev](https://github.com/sergekukharev)) +* Fix issue 3440 Removing a node with LexicalPreservingPrinter causes UnsupportedOperationException (PR [#3449](https://github.com/javaparser/javaparser/pull/3449) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* chore(deps): update dependency org.codehaus.mojo:versions-maven-plugin to v2.10.0 (PR [#3517](https://github.com/javaparser/javaparser/pull/3517) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v4.4.0 (PR [#3510](https://github.com/javaparser/javaparser/pull/3510) by [@renovate[bot]](https://github.com/apps/renovate)) +* fix(deps): update dependency com.google.guava:guava to v31.1-jre (PR [#3507](https://github.com/javaparser/javaparser/pull/3507) by [@renovate[bot]](https://github.com/apps/renovate)) +* Bump guava from 31.0.1-jre to 31.1-jre (PR [#3506](https://github.com/javaparser/javaparser/pull/3506) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency org.apache.maven.plugins:maven-site-plugin to v3.11.0 (PR [#3496](https://github.com/javaparser/javaparser/pull/3496) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.10.0 (PR [#3494](https://github.com/javaparser/javaparser/pull/3494) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.3.2 (PR [#3492](https://github.com/javaparser/javaparser/pull/3492) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v4.3.1 (PR [#3481](https://github.com/javaparser/javaparser/pull/3481) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v4.3.0 (PR [#3479](https://github.com/javaparser/javaparser/pull/3479) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.codehaus.mojo:versions-maven-plugin to v2.9.0 (PR [#3477](https://github.com/javaparser/javaparser/pull/3477) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.2.2 (PR [#3470](https://github.com/javaparser/javaparser/pull/3470) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.9.0 (PR [#3469](https://github.com/javaparser/javaparser/pull/3469) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.helger.maven:ph-javacc-maven-plugin to v4.1.5 (PR [#3468](https://github.com/javaparser/javaparser/pull/3468) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.github.javaparser:javaparser-parent to v3 (PR [#3465](https://github.com/javaparser/javaparser/pull/3465) by [@renovate[bot]](https://github.com/apps/renovate)) +* Partial revert of #3462 (removed GitHub Action) (PR [#3464](https://github.com/javaparser/javaparser/pull/3464) by [@MysterAitch](https://github.com/MysterAitch)) +* Updated release script to be non-interactive, and added option to use a manually-triggered GitHub Action to build a release (PR [#3462](https://github.com/javaparser/javaparser/pull/3462) by [@MysterAitch](https://github.com/MysterAitch)) +* chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.2.1 (PR [#3459](https://github.com/javaparser/javaparser/pull/3459) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.3.0 (PR [#3458](https://github.com/javaparser/javaparser/pull/3458) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.22.0 (PR [#3457](https://github.com/javaparser/javaparser/pull/3457) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-scm-plugin to v1.12.2 (PR [#3456](https://github.com/javaparser/javaparser/pull/3456) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-deploy-plugin to v3.0.0-m2 (PR [#3453](https://github.com/javaparser/javaparser/pull/3453) by [@renovate[bot]](https://github.com/apps/renovate)) + +### Uncategorised + +* Fix the release gha, originally submitted in #3462 (PR [#3463](https://github.com/javaparser/javaparser/pull/3463) by [@MysterAitch](https://github.com/MysterAitch)) +* Update changelog.md to contain 3.24.0 changes, and prepare for 3.24.1 (PR [#3461](https://github.com/javaparser/javaparser/pull/3461) by [@MysterAitch](https://github.com/MysterAitch)) +* Update changelog.md (PR [#3460](https://github.com/javaparser/javaparser/pull/3460) by [@MysterAitch](https://github.com/MysterAitch)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@MysterAitch](https://github.com/MysterAitch) +* [@jlerbsc](https://github.com/jlerbsc) +* [@kanghj](https://github.com/kanghj) +* [@sergekukharev](https://github.com/sergekukharev) + + +Version 3.24.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/187?closed=1) + +### Added + +* Add erasure on parametrized type (PR [#3438](https://github.com/javaparser/javaparser/pull/3438) by [@jlerbsc](https://github.com/jlerbsc)) +* Add test cases for `NoChange` API (PR [#3431](https://github.com/javaparser/javaparser/pull/3431) by [@jlerbsc](https://github.com/jlerbsc)) + +### Changed + +* Minor refactoring on `LexicalreservingPrinter` especially in the class `Difference` (PR [#3424](https://github.com/javaparser/javaparser/pull/3424) by [@jlerbsc](https://github.com/jlerbsc)) +* Update the readme with `@pedrombmachado` 's suggestions (#3357), and also to switch from `mvn` to `mvnw` within some sample instructions (PR [#3420](https://github.com/javaparser/javaparser/pull/3420) by [@MysterAitch](https://github.com/MysterAitch)) +* Reducing deeply nested logic in `MethodResolutionLogic` (work in progress) (PR [#3411](https://github.com/javaparser/javaparser/pull/3411) by [@jlerbsc](https://github.com/jlerbsc)) +* Reducing deeply nested logic in `MethodResolutionLogic` (PR [#3409](https://github.com/javaparser/javaparser/pull/3409) by [@jlerbsc](https://github.com/jlerbsc)) +* Improved `RemoveMethodGenerator` and `ReplaceMethodGenerator` to only override super when needed. (PR [#3248](https://github.com/javaparser/javaparser/pull/3248) by [@4everTheOne](https://github.com/4everTheOne)) +* Reduced complexity for methods in `JavaParserFacade` (PR [#3204](https://github.com/javaparser/javaparser/pull/3204) by [@4everTheOne](https://github.com/4everTheOne)) + +### Fixed + +* Fix issue #3436 `getAncestors()`/`getAllAncestors()` does not work if base class starts with the same name (PR [#3437](https://github.com/javaparser/javaparser/pull/3437) by [@jlerbsc](https://github.com/jlerbsc)) +* Add a missing `hashCode()` method (PR [#3432](https://github.com/javaparser/javaparser/pull/3432) by [@msridhar](https://github.com/msridhar)) +* Call `orElse()` instead of `orElseGet()` (PR [#3430](https://github.com/javaparser/javaparser/pull/3430) by [@msridhar](https://github.com/msridhar)) +* Fix issue #3408 `LexicalPreservationPrinter` fails to add annotation to a class field decalared with fully qualified name (PR [#3429](https://github.com/javaparser/javaparser/pull/3429) by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3419 - Fixed bug in `Difference.java` (PR [#3428](https://github.com/javaparser/javaparser/pull/3428) by [@4everTheOne](https://github.com/4everTheOne)) +* Issue #3406 `ParseProblemException` when parsing char `\u005cn` (PR [#3407](https://github.com/javaparser/javaparser/pull/3407) by [@apixandru](https://github.com/apixandru)) +* Fix issue #3399 Failed to resolve methods that evaluate as argument (PR [#3401](https://github.com/javaparser/javaparser/pull/3401) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix resoure leak due to `File.walk` (PR [#3398](https://github.com/javaparser/javaparser/pull/3398) by [@lujiefsi](https://github.com/lujiefsi)) +* Fix issue #2259 Type resolution issue when type of formal parameter is Object (PR [#3397](https://github.com/javaparser/javaparser/pull/3397) by [@jlerbsc](https://github.com/jlerbsc)) +* Fixes an issue where `JavaParserTypeSolver` ignores the character encoding configuration. (PR [#3396](https://github.com/javaparser/javaparser/pull/3396) by [@crucoba](https://github.com/crucoba)) +* Issue #3272 resolve lambda exp type (PR [#3273](https://github.com/javaparser/javaparser/pull/3273) by [@si-e](https://github.com/si-e)) +* Issue #3200 `this` exp in anonymous class (PR [#3268](https://github.com/javaparser/javaparser/pull/3268) by [@si-e](https://github.com/si-e)) + +### Developer Changes + +* Partial revert of #3462 (removed GitHub Action) (PR [#3464](https://github.com/javaparser/javaparser/pull/3462) by [@MysterAitch](https://github.com/MysterAitch)) +* Updated release script to be non-interactive, and added option to use a manually-triggered GitHub Action to build a release (PR [#3462](https://github.com/javaparser/javaparser/pull/3462) by [@MysterAitch](https://github.com/MysterAitch)) +* chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.2.1 (PR [#3459](https://github.com/javaparser/javaparser/pull/3459) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.3.0 (PR [#3458](https://github.com/javaparser/javaparser/pull/3458) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.22.0 (PR [#3457](https://github.com/javaparser/javaparser/pull/3457) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-scm-plugin to v1.12.2 (PR [#3456](https://github.com/javaparser/javaparser/pull/3456) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-deploy-plugin to v3.0.0-m2 (PR [#3453](https://github.com/javaparser/javaparser/pull/3453) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-site-plugin to v3.10.0 (PR [#3448](https://github.com/javaparser/javaparser/pull/3448) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v4.2.0 (PR [#3442](https://github.com/javaparser/javaparser/pull/3442) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.8.2 (PR [#3425](https://github.com/javaparser/javaparser/pull/3425) by [@renovate[bot]](https://github.com/apps/renovate)) +* Update / document `codecov.yml` (PR [#3418](https://github.com/javaparser/javaparser/pull/3418) by [@MysterAitch](https://github.com/MysterAitch)) +* chore(deps): update actions/cache action to v2.1.7 (PR [#3417](https://github.com/javaparser/javaparser/pull/3417) by [@renovate[bot]](https://github.com/apps/renovate)) +* Bump bnd-maven-plugin from 6.0.0 to 6.1.0 (PR [#3416](https://github.com/javaparser/javaparser/pull/3416) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6.1.0 (PR [#3414](https://github.com/javaparser/javaparser/pull/3414) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.squareup.okhttp3:okhttp to v4.9.3 (PR [#3413](https://github.com/javaparser/javaparser/pull/3413) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v2.4.0 (PR [#3402](https://github.com/javaparser/javaparser/pull/3402) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/checkout action to v2.3.5 (PR [#3395](https://github.com/javaparser/javaparser/pull/3395) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v4 (PR [#3393](https://github.com/javaparser/javaparser/pull/3393) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@crucoba](https://github.com/crucoba) +* [@msridhar](https://github.com/msridhar) +* [@MysterAitch](https://github.com/MysterAitch) +* [@lujiefsi](https://github.com/lujiefsi) +* [@apixandru](https://github.com/apixandru) +* [@si-e](https://github.com/si-e) +* [@jlerbsc](https://github.com/jlerbsc) +* [@4everTheOne](https://github.com/4everTheOne) + + + +Version 3.23.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/186?closed=1) + +### Fixed + +* `record` may be used as variable name in Java 16 (PR [#3362](https://github.com/javaparser/javaparser/pull/3362) by [@koppor](github.com/koppor/)) + +### API or Behaviour Change + +* Java 11 is now the most used version (PR [#3301](https://github.com/javaparser/javaparser/pull/3301) by [@matozoid](https://github.com/matozoid)) + +### Added + +* Manage `@Inherited` annotation to prepare the fix on the issue 1843 (PR [#3383](https://github.com/javaparser/javaparser/pull/3383) by [@jlerbsc](https://github.com/jlerbsc)) + +### Changed + +* Configurable caching system for type solvers (PR [#3343](https://github.com/javaparser/javaparser/pull/3343) by [@4everTheOne](https://github.com/4everTheOne)) +* Java 11 is now the most used version (PR [#3301](https://github.com/javaparser/javaparser/pull/3301) by [@matozoid](https://github.com/matozoid)) + +### Fixed + +* Fix issue 3387 LexicalPreservingPrinter adds wrong indentation when adding new comments (PR [#3392](https://github.com/javaparser/javaparser/pull/3392) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue 2360 Symbol Solver is missing promotion of byte, char, and short in unary expressions (PR [#3384](https://github.com/javaparser/javaparser/pull/3384) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix "record" as non-type identifier in Java 16 (PR [#3362](https://github.com/javaparser/javaparser/pull/3362) by [@koppor](https://github.com/koppor)) +* Fix issue 3358 LexicalPreservingPrinter error on ArrayType (PR [#3359](https://github.com/javaparser/javaparser/pull/3359) by [@jlerbsc](https://github.com/jlerbsc)) + +### Developer Changes + +* generate changelog for milestones - scripts included to do this by milestone id, milestone title, and a github action to add the output to a draft snapshot release (PR [#3391](https://github.com/javaparser/javaparser/pull/3391) by [@MysterAitch](https://github.com/MysterAitch)) +* Bump bnd-maven-plugin from 5.3.0 to 6.0.0 (PR [#3390](https://github.com/javaparser/javaparser/pull/3390) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency biz.aqute.bnd:bnd-maven-plugin to v6 (PR [#3389](https://github.com/javaparser/javaparser/pull/3389) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.squareup.okhttp3:okhttp to v4.9.2 (PR [#3388](https://github.com/javaparser/javaparser/pull/3388) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.google.guava:guava to v31.0.1-jre (PR [#3385](https://github.com/javaparser/javaparser/pull/3385) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency com.google.guava:guava to v31 (PR [#3381](https://github.com/javaparser/javaparser/pull/3381) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.8.1 (PR [#3380](https://github.com/javaparser/javaparser/pull/3380) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.21.0 (PR [#3378](https://github.com/javaparser/javaparser/pull/3378) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-scm-plugin to v1.12.0 (PR [#3376](https://github.com/javaparser/javaparser/pull/3376) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v2.1.0 (PR [#3373](https://github.com/javaparser/javaparser/pull/3373) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.8.0 (PR [#3372](https://github.com/javaparser/javaparser/pull/3372) by [@renovate[bot]](https://github.com/apps/renovate)) +* remove accidentally-added pom release backup files, and added it to gitignore to prevent them being re-added (PR [#3370](https://github.com/javaparser/javaparser/pull/3370) by [@MysterAitch](https://github.com/MysterAitch)) +* chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.3.1 (PR [#3368](https://github.com/javaparser/javaparser/pull/3368) by [@renovate[bot]](https://github.com/apps/renovate)) +* Reduce mvn verbosity on GitHub actions (and switch to mvnw) (PR [#3363](https://github.com/javaparser/javaparser/pull/3363) by [@koppor](https://github.com/koppor)) + +### Uncategorised + +* Prepare changelog for next version (PR [#3354](https://github.com/javaparser/javaparser/pull/3354) by [@MysterAitch](https://github.com/MysterAitch)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@MysterAitch](https://github.com/MysterAitch) +* [@jlerbsc](https://github.com/jlerbsc) +* [@koppor](https://github.com/koppor) +* [@4everTheOne](https://github.com/4everTheOne) +* [@matozoid](https://github.com/matozoid) + + +Version 3.23.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/185?closed=1) + +### Added + +* Improving `toString` on CSM classes (PR [#3315](https://github.com/javaparser/javaparser/pull/3315) by [@jlerbsc](https://github.com/jlerbsc)) +* Add test case for issue #2210 Resolution of Method References (PR [#3310](https://github.com/javaparser/javaparser/pull/3310) by [@jlerbsc](https://github.com/jlerbsc)) +* Implemented method reference resolution on expressions (PR [#3307](https://github.com/javaparser/javaparser/pull/3307) by [@maartenc](https://github.com/maartenc)) +* Define if a field is volatile through the ResolvedFieldDeclaration interface - from issue #3240 (PR [#3276](https://github.com/javaparser/javaparser/pull/3276) by [@jlerbsc](https://github.com/jlerbsc)) +* Implemented logic for internalTypes in `JavaParserAnnotationDeclaration` and `JavassistAnnotationDeclaration` (PR [#3215](https://github.com/javaparser/javaparser/pull/3215) by [@4everTheOne](https://github.com/4everTheOne)) + +### Changed + +* Check if ancestor also for super class (PR [#3324](https://github.com/javaparser/javaparser/pull/3324) by [@ReallyLiri](https://github.com/ReallyLiri)) +* Remove useless instanceof usage in Type (PR [#3311](https://github.com/javaparser/javaparser/pull/3311) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix Java 11+ AST postprocessing (PR [#3302](https://github.com/javaparser/javaparser/pull/3302) by [@matozoid](https://github.com/matozoid)) +* Move duplicate code to JavaParserTypeAdapter (PR [#3267](https://github.com/javaparser/javaparser/pull/3267) by [@maartenc](https://github.com/maartenc)) +* Improved performance when resolving types for big source files (PR [#3265](https://github.com/javaparser/javaparser/pull/3265) by [@maartenc](https://github.com/maartenc)) +* Optimizations for Node class (CPU time and Memory usage) (PR [#3233](https://github.com/javaparser/javaparser/pull/3233) by [@4everTheOne](https://github.com/4everTheOne)) +* Fix Javadoc comment * escaping problem. (PR [#3221](https://github.com/javaparser/javaparser/pull/3221) by [@matozoid](https://github.com/matozoid)) +* Remove broken link (PR [#2912](https://github.com/javaparser/javaparser/pull/2912) by [@mernst](https://github.com/mernst)) + +### Fixed + +* Preserving field order when getting the fields declared from a ReferenceType (PR [#3342](https://github.com/javaparser/javaparser/pull/3342) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix String Index out of range in TextBlockLiteralExpr (PR [#3337](https://github.com/javaparser/javaparser/pull/3337) by [@134ARG](https://github.com/134ARG)) +* Fixed prettyprinting new switch-statements (and switch-expressions). (PR [#3335](https://github.com/javaparser/javaparser/pull/3335) by [@kozsik](https://github.com/kozsik)) +* Fix pretty printing of generic records (PR [#3334](https://github.com/javaparser/javaparser/pull/3334) by [@twistedsquare](https://github.com/twistedsquare)) +* Fix issue #3317 Comment in the middle of a multi-line single statement (PR [#3318](https://github.com/javaparser/javaparser/pull/3318) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue 3296 LexicalPreservation bug for array brackets (PR [#3316](https://github.com/javaparser/javaparser/pull/3316) by [@jlerbsc](https://github.com/jlerbsc)) +* Fixes Issue #3308 -- stackoverflow when resolving the `FieldAccessExpr` of an `ArrayAccessExpr` (PR [#3312](https://github.com/javaparser/javaparser/pull/3312) by [@MysterAitch](https://github.com/MysterAitch)) +* Fix StackOverflow when resolving ClassOrInterfaceType of nested ObjectCreationExpr (PR [#3279](https://github.com/javaparser/javaparser/pull/3279) by [@maartenc](https://github.com/maartenc)) +* ResolvedMethods from javassist never had exceptions (PR [#3264](https://github.com/javaparser/javaparser/pull/3264) by [@maartenc](https://github.com/maartenc)) +* Issue 3064 conditional nested lambda (PR [#3238](https://github.com/javaparser/javaparser/pull/3238) by [@si-e](https://github.com/si-e)) +* Further optimization in resolving in StatementContext (PR [#3185](https://github.com/javaparser/javaparser/pull/3185) by [@Col-E](https://github.com/Col-E)) +* Improve type resolution for duplicate names (PR [#3012](https://github.com/javaparser/javaparser/pull/3012) by [@thejk](https://github.com/thejk)) + +### Developer Changes + +* chore(deps): update dependency org.mockito:mockito-core to v3.12.4 (PR [#3350](https://github.com/javaparser/javaparser/pull/3350) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.12.3 (PR [#3349](https://github.com/javaparser/javaparser/pull/3349) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v2.0.3 (PR [#3348](https://github.com/javaparser/javaparser/pull/3348) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.12.2 (PR [#3347](https://github.com/javaparser/javaparser/pull/3347) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.12.1 (PR [#3345](https://github.com/javaparser/javaparser/pull/3345) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.12.0 (PR [#3344](https://github.com/javaparser/javaparser/pull/3344) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-scm-plugin to v1.11.3 (PR [#3339](https://github.com/javaparser/javaparser/pull/3339) by [@renovate[bot]](https://github.com/apps/renovate)) +* Bump codecov/codecov-action from 1.5.2 to 2.0.2 (PR [#3326](https://github.com/javaparser/javaparser/pull/3326) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* chore(deps): update dependency org.mockito:mockito-core to v3.11.2 (PR [#3305](https://github.com/javaparser/javaparser/pull/3305) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.20.2 (PR [#3297](https://github.com/javaparser/javaparser/pull/3297) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.assertj:assertj-core to v3.20.0 (PR [#3295](https://github.com/javaparser/javaparser/pull/3295) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-dependency-plugin to v3.2.0 (PR [#3294](https://github.com/javaparser/javaparser/pull/3294) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.11.1 (PR [#3293](https://github.com/javaparser/javaparser/pull/3293) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update codecov/codecov-action action to v1.5.2 (PR [#3287](https://github.com/javaparser/javaparser/pull/3287) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.11.0 (PR [#3285](https://github.com/javaparser/javaparser/pull/3285) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/cache action to v2.1.6 (PR [#3280](https://github.com/javaparser/javaparser/pull/3280) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.3.0 (PR [#3270](https://github.com/javaparser/javaparser/pull/3270) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update junit5 monorepo to v5.7.2 (PR [#3262](https://github.com/javaparser/javaparser/pull/3262) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.apache.maven.plugins:maven-gpg-plugin to v3 (PR [#3250](https://github.com/javaparser/javaparser/pull/3250) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@maartenc](https://github.com/maartenc) +* [@kozsik](https://github.com/kozsik) +* [@ReallyLiri](https://github.com/ReallyLiri) +* [@mernst](https://github.com/mernst) +* [@matozoid](https://github.com/matozoid) +* [@Col-E](https://github.com/Col-E) +* [@134ARG](https://github.com/134ARG) +* [@MysterAitch](https://github.com/MysterAitch) +* [@si-e](https://github.com/si-e) +* [@thejk](https://github.com/thejk) +* [@twistedsquare](https://github.com/twistedsquare) +* [@jlerbsc](https://github.com/jlerbsc) +* [@4everTheOne](https://github.com/4everTheOne) + + + +Version 3.22.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/184?closed=1) + +### Added + +* Recover wrong statements no only to ';', but to '}' (not including) as well (PR [#3247](https://github.com/javaparser/javaparser/pull/3247) by [@32kda](https://github.com/32kda)) + +### Fixed + +* update features.md -- fixed release version and date of records support, status of java 16 sealed classes to 2nd preview, and java 17 features (PR [#3263](https://github.com/javaparser/javaparser/pull/3263) by [@MysterAitch](https://github.com/MysterAitch)) +* fixes #3255 -- bugfix grammar case when using `record` to as an identifier (PR [#3256](https://github.com/javaparser/javaparser/pull/3256) by [@MysterAitch](https://github.com/MysterAitch)) +* Fixes issue #3113 -- Arrow missing in Switch Expression + jumbled up in LexicalPreservingPrinter (PR [#3235](https://github.com/javaparser/javaparser/pull/3235) by [@Zoom1111](https://github.com/Zoom1111)) +* Handle possibility of tokens not being available (PR [#3231](https://github.com/javaparser/javaparser/pull/3231) by [@mernst](https://github.com/mernst)) + +### Developer Changes + +* chore(deps): update dependency org.mockito:mockito-core to v3.10.0 (PR [#3259](https://github.com/javaparser/javaparser/pull/3259) by [@renovate[bot]](https://github.com/apps/renovate)) +* Bump codecov/codecov-action from 1 to 1.5.0 (PR [#3258](https://github.com/javaparser/javaparser/pull/3258) by [@dependabot[bot]](https://github.com/apps/dependabot)) +* Bump actions/create-release from 1 to 1.1.4 (PR [#3257](https://github.com/javaparser/javaparser/pull/3257) by [@dependabot[bot]](https://github.com/apps/dependabot)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@32kda](https://github.com/32kda) +* [@MysterAitch](https://github.com/MysterAitch) +* [@Zoom1111](https://github.com/Zoom1111) +* [@mernst](https://github.com/mernst) + + + +Version 3.22.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/183?closed=1) + + +### API or Behaviour Change + +* Implemented isAssignableBy for VoidType - now return `false` instead of throwing `UnsupportedOperationException` (PR [#3197](https://github.com/javaparser/javaparser/pull/3197) by [@4everTheOne](https://github.com/4everTheOne)) +* fixed ellipsis and doublecolon to be categorised as separators not operators (fixes #2897) (PR [#2924](https://github.com/javaparser/javaparser/pull/2924) by [@MysterAitch](https://github.com/MysterAitch)) + +### Added + +* Update parser configuration and validators to include the release of java 16, and java 17 being in development (PR [#3222](https://github.com/javaparser/javaparser/pull/3222) by [@MysterAitch](https://github.com/MysterAitch)) +* Adding convenient methods to find out if a method is a variable/fixed arity method (PR [#3196](https://github.com/javaparser/javaparser/pull/3196) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix issue #3173: Add isAnnotation() and asAnnotation() methods for ResolvedTypeDeclaration (PR [#3187](https://github.com/javaparser/javaparser/pull/3187) by [@deadlocklogic](https://github.com/deadlocklogic)) +* Record support (compilation / parsing only, solving to follow separately) (PR [#3022](https://github.com/javaparser/javaparser/pull/3022) by [@MysterAitch](https://github.com/MysterAitch)) + +### Changed + +* Implemented isAssignableBy for VoidType - now return `false` instead of throwing `UnsupportedOperationException` (PR [#3197](https://github.com/javaparser/javaparser/pull/3197) by [@4everTheOne](https://github.com/4everTheOne)) +* Simplify how to find the package name from AstResolutionUtils (PR [#3193](https://github.com/javaparser/javaparser/pull/3193) by [@jlerbsc](https://github.com/jlerbsc)) +* Type resolution improvment (PR [#3189](https://github.com/javaparser/javaparser/pull/3189) by [@jlerbsc](https://github.com/jlerbsc)) +* Memory optimization for JarTypeSolver (Up to 42% less memory) (PR [#3188](https://github.com/javaparser/javaparser/pull/3188) by [@4everTheOne](https://github.com/4everTheOne)) +* Fixes #3048 (`JavaParserSymbolDeclaration#localVar` returning old declaration) and adds tests for `JavaParserSymbolDeclaration` (PR [#3049](https://github.com/javaparser/javaparser/pull/3049) by [@4everTheOne](https://github.com/4everTheOne)) + +### Fixed + +* Fix issue #3244 OrphanComment in BlockStmt not appearing (PR [#3245](https://github.com/javaparser/javaparser/pull/3245) by [@jlerbsc](https://github.com/jlerbsc)) +* fix Log.error() throwing NullPointerException (PR [#3243](https://github.com/javaparser/javaparser/pull/3243) by [@CD4017BE](https://github.com/CD4017BE)) +* fixed ellipsis and doublecolon to be categorised as separators not operators (fixes #2897) (PR [#2924](https://github.com/javaparser/javaparser/pull/2924) by [@MysterAitch](https://github.com/MysterAitch)) + +### Developer Changes + +* Include and use a Maven wrapper (PR [#3254](https://github.com/javaparser/javaparser/pull/3254) by [@MysterAitch](https://github.com/MysterAitch)) +* chore(deps): update dependency org.javassist:javassist to v3.28.0-ga (PR [#3249](https://github.com/javaparser/javaparser/pull/3249) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.jacoco:jacoco-maven-plugin to v0.8.7 (PR [#3246](https://github.com/javaparser/javaparser/pull/3246) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/cache action to v2.1.5 (PR [#3226](https://github.com/javaparser/javaparser/pull/3226) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update dependency org.mockito:mockito-core to v3.9.0 (PR [#3224](https://github.com/javaparser/javaparser/pull/3224) by [@renovate[bot]](https://github.com/apps/renovate)) +* chore(deps): update actions/setup-java action to v2 (PR [#3220](https://github.com/javaparser/javaparser/pull/3220) by [@renovate[bot]](https://github.com/apps/renovate)) +* Update javaparser copyright headers (PR [#3212](https://github.com/javaparser/javaparser/pull/3212) by [@jlerbsc](https://github.com/jlerbsc)) +* Update readme template so that #3096 becomes permanent (PR [#3210](https://github.com/javaparser/javaparser/pull/3210) by [@MysterAitch](https://github.com/MysterAitch)) +* Improve tests on `getAllAncestors` method (PR [#3209](https://github.com/javaparser/javaparser/pull/3209) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix surefire configuration to allow jacoco to run correctly on JSS tests (PR [#3208](https://github.com/javaparser/javaparser/pull/3208) by [@MysterAitch](https://github.com/MysterAitch)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@MysterAitch](https://github.com/MysterAitch) +* [@CD4017BE](https://github.com/CD4017BE) +* [@jlerbsc](https://github.com/jlerbsc) +* [@deadlocklogic](https://github.com/deadlocklogic) +* [@4everTheOne](https://github.com/4everTheOne) + +Version 3.21.2 +------------------ +**v3.21.1 released as 3.21.2 without change** + +Version 3.21.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/182?closed=1) + +### Added + +* Implemented logic for isAssignableBy in JavassistInterfaceDeclaration (PR [#3170](https://github.com/javaparser/javaparser/pull/3170) by [@4everTheOne](https://github.com/4everTheOne)) +* Added additional tests to cover isAssignableBy method in JavassistClassDeclaration (PR [#3169](https://github.com/javaparser/javaparser/pull/3169) by [@4everTheOne](https://github.com/4everTheOne)) + +### Changed + +* Update changelog (PR [#3178](https://github.com/javaparser/javaparser/pull/3178) by [@MysterAitch](https://github.com/MysterAitch)) +* Minor performance improvement on getCanonicalName method call (PR [#3166](https://github.com/javaparser/javaparser/pull/3166) by [@jlerbsc](https://github.com/jlerbsc)) + +### Fixed + +* Fix Issue #1950 Unambigous ambiguity call with generics and lambda's (PR [#3168](https://github.com/javaparser/javaparser/pull/3168) by [@jlerbsc](https://github.com/jlerbsc)) +* Refactor the javassist implementation to delegate to the typesolver instead of using its own classpool (PR [#3167](https://github.com/javaparser/javaparser/pull/3167) by [@maartenc](https://github.com/maartenc)) +* Fixed name resolution in casted lambda expressions (PR [#3165](https://github.com/javaparser/javaparser/pull/3165) by [@maartenc](https://github.com/maartenc)) +* Fix issue #3159 JavaParserSymbolDeclaration is used to represent variables, but #isVariable() always returns false (PR [#3160](https://github.com/javaparser/javaparser/pull/3160) by [@jlerbsc](https://github.com/jlerbsc)) +* Fix wrong author attribution in changelog for #3072 (PR [#3155](https://github.com/javaparser/javaparser/pull/3155) by [@Col-E](https://github.com/Col-E)) +* Fixed #3136 - ThisExpr isn't resolved correctly when it is in the scope of an ObjectCreationExpr (PR [#3137](https://github.com/javaparser/javaparser/pull/3137) by [@deadlocklogic](https://github.com/deadlocklogic)) +* Fix race condition in JavaParserTypeSolver (PR [#3091](https://github.com/javaparser/javaparser/pull/3091) by [@4everTheOne](https://github.com/4everTheOne)) + +### Developer Changes + +* Publish to OSSRH rather than Bintray (PR [#3180](https://github.com/javaparser/javaparser/pull/3180) by [@MysterAitch](https://github.com/MysterAitch)) +* Remove unused JUnit Pioneer dependency (PR [#3179](https://github.com/javaparser/javaparser/pull/3179) by [@MysterAitch](https://github.com/MysterAitch)) +* Verify builds test correctly under JDK16 (PR [#3175](https://github.com/javaparser/javaparser/pull/3175) by [@MysterAitch](https://github.com/MysterAitch)) +* update renovate to include "dependencies" label on PRs (PR [#3174](https://github.com/javaparser/javaparser/pull/3174) by [@MysterAitch](https://github.com/MysterAitch)) +* chore(deps): update dependency com.google.guava:guava to v30.1.1-jre (PR [#3172](https://github.com/javaparser/javaparser/pull/3172) by [@renovate[bot]](https://github.com/apps/renovate)) + +### :heart: Contributors + +Thank You to all contributors who worked on this release! + +* [@maartenc](https://github.com/maartenc) +* [@MysterAitch](https://github.com/MysterAitch) +* [@jlerbsc](https://github.com/jlerbsc) +* [@deadlocklogic](https://github.com/deadlocklogic) +* [@4everTheOne](https://github.com/4everTheOne) +* [@Col-E](https://github.com/Col-E) + + + +Version 3.20.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/181?closed=1) + +### Added +* Issue #2991 - Added support for Iterables in CombinedTypeSolver + (PR [#3033](https://github.com/javaparser/javaparser/pull/3033), by [@4everTheOne](https://github.com/4everTheOne)) +* Implemented logic for getAllFields in Annotations + (PR [#3097](https://github.com/javaparser/javaparser/pull/3097), by [@4everTheOne](https://github.com/4everTheOne)) +### Changed +* Issue #2717 - Removed "empty" label from break statement and added additional test for BreakStmt + (PR [#3109](https://github.com/javaparser/javaparser/pull/3109), by [@4everTheOne](https://github.com/4everTheOne)) +* Issue #2708 - Improvement to the generated code (removal of redundant casts, and additions of `@Override`) + (PR [#3124](https://github.com/javaparser/javaparser/pull/3124), by [@4everTheOne](https://github.com/4everTheOne)) +* Performance improvement on ResolvedReferenceTypeDeclaration.isJavaLangObject() + (PR [#3125](https://github.com/javaparser/javaparser/pull/3125), by [@jlerbsc](https://github.com/jlerbsc)) +* Optimization to avoid systematically creating a class from javassist when the class has already been created + (PR [#3126](https://github.com/javaparser/javaparser/pull/3126), by [@jlerbsc](https://github.com/jlerbsc)) +* Bump jbehave-core from 4.8.1 to 4.8.2 + (PR [#3043](https://github.com/javaparser/javaparser/pull/3043), by [@dependabot](https://github.com/dependabot)) +* Bump assertj-core from 3.18.1 to 3.19.0 + (PR [#3047](https://github.com/javaparser/javaparser/pull/3047), by [@dependabot](https://github.com/dependabot)) +* Bump okhttp from 4.9.0 to 4.9.1 + (PR [#3054](https://github.com/javaparser/javaparser/pull/3054), by [@dependabot](https://github.com/dependabot)) +* Bump actions/cache from v2 to v2.1.4 + (PR [#3070](https://github.com/javaparser/javaparser/pull/3070), by [@dependabot](https://github.com/dependabot)) +* Bump mockito-core from 3.6.28 to 3.8.0 + (PR [#3110](https://github.com/javaparser/javaparser/pull/3110), by [@dependabot](https://github.com/dependabot)) +* Bump junit from 4.13.1 to 4.13.2 + (PR [#3129](https://github.com/javaparser/javaparser/pull/3129), by [@dependabot](https://github.com/dependabot)) +### Fixed +* Issue #3038 and Issue #3071 - Hanging when certain names are resolved + (PR [#3072](https://github.com/javaparser/javaparser/pull/3072), by [@col-e](https://github.com/Col-E)) +* Javadoc fixes + (PR [#3082](https://github.com/javaparser/javaparser/pull/3082), by [@mernst](https://github.com/mernst)) +* Update readme with correct Java support versions + (PR [#3096](https://github.com/javaparser/javaparser/pull/3096), by [@MaartenGDev](https://github.com/MaartenGDev)) +* Issue #3106 - Wrong descriptor for primitive type long + (PR [#3107](https://github.com/javaparser/javaparser/pull/3107), by [@jlerbsc](https://github.com/jlerbsc)) + + +Version 3.19.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/180?closed=1) + +### Added +* Adding test case on PrettyPrinter indentation + (PR [#2950](https://github.com/javaparser/javaparser/pull/2950), by [@jlerbsc](https://github.com/jlerbsc)) +* Adding interface Printable for printer + (PR [#2971](https://github.com/javaparser/javaparser/pull/2971), by [@jlerbsc](https://github.com/jlerbsc)) +* Major update for pretty print, adding interfaces for printer configuration, printer, ... and deprecated old PrettyPrinter API + (PR [#2974](https://github.com/javaparser/javaparser/pull/2974), by [@jlerbsc](https://github.com/jlerbsc)) +* Adding method descriptor resolution closes #2059 + (PR [#2976](https://github.com/javaparser/javaparser/pull/2976), by [@jlerbsc](https://github.com/jlerbsc)) +* Adding management of the poly and standalone expression + (PR [#2994](https://github.com/javaparser/javaparser/pull/2994), by [@jlerbsc](https://github.com/jlerbsc)) +* Add test case for issue #1770 UnaryExpr failing to resolve BITWISE_COMPLEMENT operator + (PR [#3005](https://github.com/javaparser/javaparser/pull/3005), by [@jlerbsc](https://github.com/jlerbsc)) +* Created additional validators to differentiate between enabling standard and preview features + (PR [#3015](https://github.com/javaparser/javaparser/pull/3015), by [@MysterAitch](https://github.com/MysterAitch)) +* Added additional tests to TypeSolvers + (PR [#3046](https://github.com/javaparser/javaparser/pull/3046), by [@4everTheOne](https://github.com/4everTheOne)) +* Improved JavaParserTypeVariableDeclaration tests + (PR [#3059](https://github.com/javaparser/javaparser/pull/3059), by [@4everTheOne](https://github.com/4everTheOne)) +* Improved coverage for resolved declarations and fixed inconsistencies between them + (PR [#3062](https://github.com/javaparser/javaparser/pull/3062), by [@4everTheOne](https://github.com/4everTheOne)) +* Additional GenericVisitorWithDefaults and VoidVisitorWithDefaults tests + (PR [#3067](https://github.com/javaparser/javaparser/pull/3067), by [@4everTheOne](https://github.com/4everTheOne)) +* Additional tests for hash code visitors + (PR [#3068](https://github.com/javaparser/javaparser/pull/3068), by [@4everTheOne](https://github.com/4everTheOne)) +* Add unit tests to issue #3074 Unable to delete .jar files after parsing and using symbol solver (re: #3074) + (PR [#3076](https://github.com/javaparser/javaparser/pull/3076), by [@jlerbsc](https://github.com/jlerbsc)) +### Changed +* Minor refactoring regarding indentation management + (PR [#2969](https://github.com/javaparser/javaparser/pull/2969), by [@jlerbsc](https://github.com/jlerbsc)) +* Minor refactoring regarding indentation management (part2) + (PR [#2970](https://github.com/javaparser/javaparser/pull/2970), by [@jlerbsc](https://github.com/jlerbsc)) +* Minor refactoring moving Indentation class to configuration package - preparation for other refactoring on Printer + (PR [#2972](https://github.com/javaparser/javaparser/pull/2972), by [@jlerbsc](https://github.com/jlerbsc)) +* Bump guava from 30.0-jre to 30.1-jre + (PR [#2977](https://github.com/javaparser/javaparser/pull/2977), by [@dependabot](https://github.com/dependabot)) +* Refactoring: relocation of boxing/unboxing methods + (PR [#2983](https://github.com/javaparser/javaparser/pull/2983), by [@jlerbsc](https://github.com/jlerbsc)) +* Improve boxing/unboxing unit tests and remove useless code in isUnbox... + (PR [#2984](https://github.com/javaparser/javaparser/pull/2984), by [@jlerbsc](https://github.com/jlerbsc)) +* Bump jbehave-core from 4.7 to 4.8.1 + (PR [#2989](https://github.com/javaparser/javaparser/pull/2989), by [@dependabot](https://github.com/dependabot)) +* Add JVM memory settings for surefire (seems that forked mode is the default running mode) + (PR [#2999](https://github.com/javaparser/javaparser/pull/2999), by [@jlerbsc](https://github.com/jlerbsc)) +* Move unit test Issue2592Test because it's not related to symbol solver + (PR [#3000](https://github.com/javaparser/javaparser/pull/3000), by [@jlerbsc](https://github.com/jlerbsc)) +* Manage memory on test suite (clear internal cache to release memory) + (PR [#3001](https://github.com/javaparser/javaparser/pull/3001), by [@jlerbsc](https://github.com/jlerbsc)) +* Remove the PhantomNodeLogic that generates memory issues when LexicalPreservingPrinter is used. Phantom node is now an attribut of each node. This is an optimization of the JP memory usage. + (PR [#3002](https://github.com/javaparser/javaparser/pull/3002), by [@jlerbsc](https://github.com/jlerbsc)) +* Make the visit order of ModifierVisitor more consistent. + (PR [#3011](https://github.com/javaparser/javaparser/pull/3011), by [@mernst](https://github.com/mernst)) +* Link to the specification, not to a random blog. + (PR [#3013](https://github.com/javaparser/javaparser/pull/3013), by [@mernst](https://github.com/mernst)) +* Minor refactoring change call to getScope().isPresent() to hasScope() + (PR [#3026](https://github.com/javaparser/javaparser/pull/3026), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3050 - Minor improvement to thread safety + (PR [#3052](https://github.com/javaparser/javaparser/pull/3052), by [@jlerbsc](https://github.com/jlerbsc)) +### Deprecated +* `PhantomNodeLogic` is now deprecated, with the logic now being handled by the node itself. + (PR [#3002](https://github.com/javaparser/javaparser/pull/3002), by [@jlerbsc](https://github.com/jlerbsc)) +### Fixed +* Fix issue on pretty configuration change + (PR [#2979](https://github.com/javaparser/javaparser/pull/2979), by [@jlerbsc](https://github.com/jlerbsc)) +* Fix trivial poly expression lambda, method reference, and parenthesized expressions + (PR [#2981](https://github.com/javaparser/javaparser/pull/2981), by [@jlerbsc](https://github.com/jlerbsc)) +* Partially fix the issue #1743 ConditionalExpr resolves to wrong type + (PR [#2982](https://github.com/javaparser/javaparser/pull/2982), by [@jlerbsc](https://github.com/jlerbsc)) +* Partially fix issue #1743 ConditionalExpr resolves to wrong type - trying to manage reference condition expression but lub (least upper bound) function is not yet implemented + (PR [#3004](https://github.com/javaparser/javaparser/pull/3004), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #2987 StackOverflow error + (PR [#3006](https://github.com/javaparser/javaparser/pull/3006), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #1774 Ensure the correct type is calculated for all binary expressions and add unary primitive promotion + (PR [#3007](https://github.com/javaparser/javaparser/pull/3007), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #2995 Cannot resolve ClassOrInterfaceType of nested ObjectCreationExpr + (PR [#3019](https://github.com/javaparser/javaparser/pull/3019), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #1634 Missing EOL when add imports if the class not exist imports before + (PR [#3020](https://github.com/javaparser/javaparser/pull/3020), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3024 methodCallExpr.resolve() StackOverflowError + (PR [#3025](https://github.com/javaparser/javaparser/pull/3025), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3027 Unable to parse class with generic parameter using JavaParserTypeSolver + (PR [#3029](https://github.com/javaparser/javaparser/pull/3029), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3030 NoSuchElementException when solving type + (PR [#3031](https://github.com/javaparser/javaparser/pull/3031), by [@4everTheOne](https://github.com/4everTheOne)) +* Issue 3028 -- Changed MethodResolutionLogic to deal with multiple candidates with varargs when varargs have not been specified in the call. + (PR [#3032](https://github.com/javaparser/javaparser/pull/3032), by [@greggers123](https://github.com/greggers123)) +* Issue #1834 Improving annotation support: Implement ResolvedAnnotationDeclaration#getDefaultValue() + (PR [#3055](https://github.com/javaparser/javaparser/pull/3055), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3057 Removed redundant definition of method to inherit from super + (PR [#3058](https://github.com/javaparser/javaparser/pull/3058), by [@4everTheOne](https://github.com/4everTheOne)) +* Issue #3074 Unable to delete .jar files after parsing + (PR [#3075](https://github.com/javaparser/javaparser/pull/3075), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue #3083 Fix choosing the most specific method in case of java.lang.Object argument type + (PR [#3084](https://github.com/javaparser/javaparser/pull/3084), by [@jlerbsc](https://github.com/jlerbsc)) + + +Version 3.18.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/179?closed=1) + +### Added +* Add a convenient method (hasRange) to the interface NodeWithRange + (PR [#2929](https://github.com/javaparser/javaparser/pull/2929), by [@jlerbsc](https://github.com/jlerbsc)) +* Add test case to issue 1017 LambdaExpr left side too permissive + (PR [#2946](https://github.com/javaparser/javaparser/pull/2946), by [@jlerbsc](https://github.com/jlerbsc)) +* Added Pattern Matching for instanceof (Java 14 preview, Java 15 second preview, Java 16 targeted release) + (PR [#2654](https://github.com/javaparser/javaparser/pull/2654), by [@MysterAitch](https://github.com/MysterAitch)) +* Added java 15 (latest released) and java 16 (bleeding edge) language level options, incl. some validators / post processors / configuration options + (PR [#2959](https://github.com/javaparser/javaparser/pull/2959), by [@MysterAitch](https://github.com/MysterAitch)) +### Changed +* Minor change in PrettyPrinterConfiguration : adding default char in enum IndentType + (PR [#2948](https://github.com/javaparser/javaparser/pull/2948), by [@jlerbsc](https://github.com/jlerbsc)) +* Minor refactoring rename interface Printable to Stringable. Something that has a printable form. I.e., it can be converted to a user-facing String + (PR [#2949](https://github.com/javaparser/javaparser/pull/2949), by [@jlerbsc](https://github.com/jlerbsc)) +* Adding interface Printable for printer + (PR [#2950](https://github.com/javaparser/javaparser/pull/2950), by [@jlerbsc](https://github.com/jlerbsc)) +* Minor refactoring in ResolvedReferenceType and add corresponding tests + (PR [#2955](https://github.com/javaparser/javaparser/pull/2955), by [@jlerbsc](https://github.com/jlerbsc)) +* Tweak the property generator to add imports when generating and improve the typecastinggenerator's error message + (PR [#2957](https://github.com/javaparser/javaparser/pull/2957), by [@MysterAitch](https://github.com/MysterAitch)) +* Bump mockito-core from 3.6.0 to 3.6.28 + (PR [#2942](https://github.com/javaparser/javaparser/pull/2942), by dependabot +### Removed +* Removed .travis.yml -- per #2919 + (PR [#2958](https://github.com/javaparser/javaparser/pull/2958), by [@MysterAitch](https://github.com/MysterAitch)) +### Fixed +* Issue 2909 Improving search for the most relevant declaration of the specified class + (PR [#2927](https://github.com/javaparser/javaparser/pull/2927), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2926 NoSuchElementException in PhantomNodeLogic after adding node + (PR [#2930](https://github.com/javaparser/javaparser/pull/2930), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2909 try different bottom / up and try with type solver strategies + (PR [#2931](https://github.com/javaparser/javaparser/pull/2931), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2936 Triggering observer notifications for the NodeList iterator + (PR [#2938](https://github.com/javaparser/javaparser/pull/2938), by [@MysterAitch](https://github.com/MysterAitch)) +* Issue 2065 Problem resolving type of lambda with Math method invocation inside + (PR [#2945](https://github.com/javaparser/javaparser/pull/2945), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2740 Issue related to a method call in an anonymous class on a field with a private visibility + (PR [#2947](https://github.com/javaparser/javaparser/pull/2947), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2951 Cannot solve function with List argument defined in jar + (PR [#2952](https://github.com/javaparser/javaparser/pull/2952), by [@qzchenwl](https://github.com/qzchenwl)) +* Issue 2781 Resolve Stack overflow occurs when the name of the interface implemented by the class is the same as the name of the internal class + (PR [#2956](https://github.com/javaparser/javaparser/pull/2956), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2953 UnsolvedSymbolException throw when resolving method in enum class implement in interface by default. + (PR [#2954](https://github.com/javaparser/javaparser/pull/2954), by [@qzchenwl](https://github.com/qzchenwl)) +* Fixed MethodCallExprContext generic parameter issue. (NullType must not fail matchTypeParameters) + (PR [#2939](https://github.com/javaparser/javaparser/pull/2939), by [@zcbbpo](https://github.com/zcbbpo)) +* Issue 2943 UnsolvedSymbolException thrown on `Stream.()` + (PR [#2961](https://github.com/javaparser/javaparser/pull/2961), by [@qzchenwl](https://github.com/qzchenwl)) +* Issue 1945 JavaParser choking on multiple generic method calls on the same line + (PR [#2966](https://github.com/javaparser/javaparser/pull/2966), by [@jlerbsc](https://github.com/jlerbsc)) + + +Version 3.17.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/178?closed=1) +### Fixed +* BEHAVIOUR CHANGE: Fix ArrayType brackets precedence + (PR [#2758](https://github.com/javaparser/javaparser/pull/2758), by [@iTakeshi](https://github.com/iTakeshi)) +* BEHAVIOUR CHANGE: Issue 2535 Comments within method missing indentation + (PR [#2918](https://github.com/javaparser/javaparser/pull/2918), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2290 Removing the second instance of a cloned statement within a block fails + (PR [#2892](https://github.com/javaparser/javaparser/pull/2892), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2393 Apply difference in node text after if condition replacement + (PR [#2895](https://github.com/javaparser/javaparser/pull/2895), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2406 Symbol solver fails to solve generic array type + (PR [#2896](https://github.com/javaparser/javaparser/pull/2896), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2489 SymbolSolver choosing wrong method after resolving + (PR [#2898](https://github.com/javaparser/javaparser/pull/2898), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2062 Type inference issue for method arguments + (PR [#2900](https://github.com/javaparser/javaparser/pull/2900), by [@jlerbsc](https://github.com/jlerbsc)) +* Fix LOOKAHEAD for ReferenceType + (PR [#2904](https://github.com/javaparser/javaparser/pull/2904), by [@mernst](https://github.com/mernst)) +* Issue 2578 Orphaned Comments exist but not printed on unrelated change to AST + (PR [#2916](https://github.com/javaparser/javaparser/pull/2916), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2909 Unexpected result when solving an outer class reference + (PR [#2914](https://github.com/javaparser/javaparser/pull/2914), by [@jlerbsc](https://github.com/jlerbsc)) +* Issue 2909 Improving how to resolve inner classes + (PR [#2920](https://github.com/javaparser/javaparser/pull/2920), by [@jlerbsc](https://github.com/jlerbsc)) + (PR [#2921](https://github.com/javaparser/javaparser/pull/2921), by [@jlerbsc](https://github.com/jlerbsc)) +* Ensure spaces between annotations and types for lexical-preserving printing + (PR [#2795](https://github.com/javaparser/javaparser/pull/2918), by [@jwaataja](https://github.com/jwaataja)) + +### Changed +* Updated dependencies, and dependabot config + (PR [#2893](https://github.com/javaparser/javaparser/pull/2893), by [@mysteraitch](https://github.com/mysteraitch)) + (PR [#2902](https://github.com/javaparser/javaparser/pull/2902), by Dependabot) +* Issue 2613 Auto update the version in the readme + (PR [#2903](https://github.com/javaparser/javaparser/pull/2903), by [@mysteraitch](https://github.com/mysteraitch)) +* Fix jacoco and enable codecov.io action + (PR [#2906](https://github.com/javaparser/javaparser/pull/2906), by [@mysteraitch](https://github.com/mysteraitch)) +* Minor refactoring of binary numeric promotion + (PR [#2915](https://github.com/javaparser/javaparser/pull/2915), by [@jlerbsc](https://github.com/jlerbsc)) +* Testcases for logical and/or + (PR [#2907](https://github.com/javaparser/javaparser/pull/2907), by [@mysteraitch](https://github.com/mysteraitch)) +* Format and document the grammar + (PR [#2901](https://github.com/javaparser/javaparser/pull/2901), by [@mysteraitch](https://github.com/mysteraitch)) + (PR [#2913](https://github.com/javaparser/javaparser/pull/2913), by [@mernst](https://github.com/mernst)) + + +Version 3.16.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/177?closed=1) +* ADDED: Created MANY test cases for older issues resolved but not directly linked/closed. + (PRs + [#2838](https://github.com/javaparser/javaparser/pull/2838), + [#2842](https://github.com/javaparser/javaparser/pull/2842), + [#2843](https://github.com/javaparser/javaparser/pull/2843), + [#2852](https://github.com/javaparser/javaparser/pull/2852), + [#2853](https://github.com/javaparser/javaparser/pull/2853), + [#2854](https://github.com/javaparser/javaparser/pull/2854), + [#2855](https://github.com/javaparser/javaparser/pull/2855), + [#2867](https://github.com/javaparser/javaparser/pull/2867), + [#2868](https://github.com/javaparser/javaparser/pull/2868), + [#2862](https://github.com/javaparser/javaparser/pull/2862), + [#2873](https://github.com/javaparser/javaparser/pull/2873), + by [@jlerbsc](https://github.com/jlerbsc) + ) +* ADDED: Added helper method to `ResolvedPrimitiveType.java` which checks if it is a boolean + (PR [#2856](https://github.com/javaparser/javaparser/pull/2856), by [@jlerbsc](https://github.com/jlerbsc)) +* ADDED: Added helper method to `ResolvedPrimitiveType.java` which returns all numeric types + (PR [#2858](https://github.com/javaparser/javaparser/pull/2858), by [@jlerbsc](https://github.com/jlerbsc)) +* ADDED/CHANGED: Minor refactoring - formatting code and adding convenient methods to `TypeHelper` and `ResolvedPrimitveType` + (PR [#2860](https://github.com/javaparser/javaparser/pull/2860), by [@jlerbsc](https://github.com/jlerbsc)) +* ADDED: Allow the symbol resolver for a `SymbolSolverCollectionStrategy` to be set via the given parser configuration + (PR [#2864](https://github.com/javaparser/javaparser/pull/2864), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: `MethodResolutionLogic.findMostApplicable` not return correct symbol reference when resolving overloaded method + (PR [#2866](https://github.com/javaparser/javaparser/pull/2866), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Updated `AbstractSymbolResolutionTest.java` with better `@BeforeEach`/`@AfterEach` + (PR [#2871](https://github.com/javaparser/javaparser/pull/2871), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: `TypeResolver` fails on method with args to static imported fields + (PR [#2872](https://github.com/javaparser/javaparser/pull/2872), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Fix issue Resolution error for non-generic constructor if generic constructor declared + (PR [#2874](https://github.com/javaparser/javaparser/pull/2874), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Fix issue Fails to calculate the type of a generic return type constructed from a Primitive type + (PR [#2875](https://github.com/javaparser/javaparser/pull/2875), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Fix issue Can't get qualified signature of a resolved method inside a Constant Enum declaration + (PR [#2876](https://github.com/javaparser/javaparser/pull/2876), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Fix issue Constructor resolution error for overloaded variadic constructor + (PR [#2877](https://github.com/javaparser/javaparser/pull/2877), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Fix issue Unable to find the constructor declaration when the argument list contains multiple `Optional.empty()` for different `Optional` + (PR [#2880](https://github.com/javaparser/javaparser/pull/2880), by [@jlerbsc](https://github.com/jlerbsc)) +* FIXED: Fix issue Solving symbol as value in the case where the scope is a constraint + (PR [#2883](https://github.com/javaparser/javaparser/pull/2883), by [@jlerbsc](https://github.com/jlerbsc)) + + +Version 3.16.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/176?closed=1) +* FIXED: Enhanced the handling of line separator, introducing an enum `LineSeparator` that can be used. + (PR [#2685](https://github.com/javaparser/javaparser/pull/2685), by [@MysterAitch](https://github.com/MysterAitch)) +* FIXED: The generated metamodel classes now have the `@Generated` annotation + (PR [#2706](https://github.com/javaparser/javaparser/pull/2706), by [@MysterAitch](https://github.com/MysterAitch)) +* various other bugfixes and enhancements + + +Version 3.16.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/175?closed=1) +* FIXED: Fixed typo + (PR [#2697](https://github.com/javaparser/javaparser/pull/2697), by [@hfreeb](https://github.com/hfreeb)) + + +Version 3.16.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/174?closed=1) + +There are two breaking changes within this release. +If you would like assistance with upgrading, get in touch. + +* FIXED: Edits to the value of a string value are now correctly handled for use with Lexical Preservation + (PR [#2646](https://github.com/javaparser/javaparser/pull/2646), by [@lemoncurry](https://github.com/lemoncurry)) +* FIXED: Edits to the value of other literal values also now handled + (PR [#2679](https://github.com/javaparser/javaparser/pull/2679), by [@MysterAitch](https://github.com/MysterAitch)) +* BREAKING CHANGE: Tokens relating to literal values now have the category of `JavaToken.Category.LITERAL` (previously `JavaToken.Category.KEYWORD`) + (PR [#2679](https://github.com/javaparser/javaparser/pull/2679), by [@MysterAitch](https://github.com/MysterAitch)) +* FIXED: Add symbol solver support for variadic parameters given zero or more than one argument, and when an array is given + (PR [#2675](https://github.com/javaparser/javaparser/pull/2675), by [@hfreeb](https://github.com/hfreeb)) +* CHANGED: Added the keyword `synchronized` to `JavaParserFacade#get`. This is specifically in response to #2668 - JavaParser is not otherwise threadsafe. + (PR [#2694](https://github.com/javaparser/javaparser/pull/2694), by [@MysterAitch](https://github.com/MysterAitch)) +* BREAKING CHANGE: The following methods now return `Optional<>` _(as do all classes which implement/extend them)_: + `ResolvedClassDeclaration#getSuperClass()`, + `ResolvedReferenceType#getTypeDeclaration()`. + _Note that Converting to use optional should be as simple as adding `.get()`, given that any cases where returning `Optional.empty()` causes problems would have also previously triggered a `NullPointerException`. + You might also use `.orElseThrow()`._ + (PR [#2693](https://github.com/javaparser/javaparser/pull/2693), by [@MysterAitch](https://github.com/MysterAitch)) +* CHANGED: Added some temporary logic to allow tests to use slightly different expected results based on the version of java used _(e.g. `java.lang.Object.registerNatives()` removed in JDK14)_ + (PR [#2637](https://github.com/javaparser/javaparser/pull/2637), by [@EFregnan](https://github.com/EFregnan)) +* FIXED: Fix resolving overloaded methods of external types + (PR [#2687](https://github.com/javaparser/javaparser/pull/2687), by [@maartenc](https://github.com/maartenc)) +* FIXED: Fix resolving method references on expressions other than ReferenceType::methodname + (PR [#2674](https://github.com/javaparser/javaparser/pull/2674), by [@maartenc](https://github.com/maartenc)) + + + +Version 3.15.22 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/173?closed=1) +* REVERT: Rollback of upgrade to `ph-javacc-maven-plugin` from v4.1.3 to v4.1.2 + _(this undoes the transitive dependency update `parser-generator-cc` from v1.1.2 to v1.1.1, which appears to have isuse with handling tokens longer than the buffer length)_ + ([#2646](https://github.com/javaparser/javaparser/pull/2646)) +* ADDED: Support resolving an enum's `valueOf` method + ([#2652](https://github.com/javaparser/javaparser/pull/2652)) +* FIXED: Fixed build warning -- bnd-maven-plugin flagging missing id + ([#2605](https://github.com/javaparser/javaparser/pull/2605)) +* FIXED: Fixed cases where nodes added after a trailing comment would incorrectly be added to the same line (thus be part of the comment) + ([#2646](https://github.com/javaparser/javaparser/pull/2646)) +* FIXED: Fixed resolving overloaded static method references (e.g. `String::valueOf` in a stream map/filter) + ([#2662](https://github.com/javaparser/javaparser/pull/2662)) + + +Version 3.15.21 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/172?closed=1) + +* DEPRECATED: Deprecated and documented `JarTypeSolver#getJarTypeSolver(String)`, with a view to later removal. + ([#2598](https://github.com/javaparser/javaparser/pull/2598)) + ([#2622](https://github.com/javaparser/javaparser/pull/2622)) +* FIXED: Fix issue #2552 : UnsupportedOperationException caused by resolving inner annotation + ([#2553](https://github.com/javaparser/javaparser/pull/2553)) +* FIXED: Parents of `NodeList`s now correctly retain their parent when a child is replaced + ([#2594](https://github.com/javaparser/javaparser/pull/2594)) +* FIXED: Fix JavaParserClassDeclaration canBeAssignedTo() to not cause a recursion when a node is its own parent (e.g. `java.lang.Object`) + ([#2608](https://github.com/javaparser/javaparser/pull/2608)) +* FIXED: Fix replacing an expression preceded by a comment (`LexicalPreservation` would previously throw an `UnsupportedOperation`) + ([#2611](https://github.com/javaparser/javaparser/pull/2611)) +* FIXED: The collection strategies now correctly take into account the parser configuration that is passed in via the constructor. + ([#2619](https://github.com/javaparser/javaparser/pull/2619)) + + +Version 3.15.20 +------------------ +_skipped_ + +Version 3.15.19 +------------------ +_skipped_ + +Version 3.15.18 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/170?closed=1) + +* CHANGED: Dependencies should now all be up-to-date. + ([#2572](https://github.com/javaparser/javaparser/pull/2572) / [#2581](https://github.com/javaparser/javaparser/pull/2581)) + - Note that the JavaCC update introduced a breaking change that now requires a StreamProvider to be passed a charset if using an InputStream source. +* FIXED (possible CHANGED/BREAKING): + Improvements have been made to method `PositionUtils#nodeContains()` for clarity and precision in behaviour. + ([#2502](https://github.com/javaparser/javaparser/pull/2502)) + - It is believed that there are no changes to behaviour, but if you do see anything please do reach out. + - See some additional commentary/thoughts in #2502 +* FIXED: Resolving super methodcalls in anonymous inner classes (fixes #1962) + ([#2585](https://github.com/javaparser/javaparser/pull/2585)) +* ADDED: `NodeList#getFirst(): Optional` + ([#2502](https://github.com/javaparser/javaparser/pull/2502)) +* ADDED: `NodeList#getLast(): Optional` + ([#2502](https://github.com/javaparser/javaparser/pull/2502)) + +Version 3.15.17 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/169?closed=1) + +* CHANGED: Merged symbol solver modules, for java 9 module compatibility + ([#2564](https://github.com/javaparser/javaparser/pull/2564)) +* CHANGED: Renamed the pretty printer configuration option `isSpacesBetweenOperators` to `isSpaceAroundOperators` + ([#2555](https://github.com/javaparser/javaparser/pull/2555)) + +Version 3.15.16 +------------------ +_Version skipped_ + +Version 3.15.15 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/168?closed=1) + +* Often requested, finally implemented by [ReallyLiri](https://github.com/ReallyLiri): +configurable cache sizes for the symbol solver. + +Version 3.15.14 (buggy) +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/167?closed=1) + +* a suggestion for a new Javadoc parsing API was merged too quickly, +causing issues parsing Javadoc while parsing Java normally. + +Version 3.15.13 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/166?closed=1) + +Version 3.15.12 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/165?closed=1) + +Version 3.15.11 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/164?closed=1) + +Version 3.15.10 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/163?closed=1) + +Version 3.15.9 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/161?closed=1) + +Version 3.15.8 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/160?closed=1) + +Version 3.15.7 +------------------ +* BREAKING: Range.overlapsWith works slightly different now. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/162?closed=1) + +Version 3.15.6 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/159?closed=1) + +Version 3.15.5 +------------------ +* BREAKING: bugs have been fixed in how SourceRoot configures parsing, +so behaviour may change (which can be fixed by setting configuration on SourceRoot correctly.) + +[issues resolved](https://github.com/javaparser/javaparser/milestone/158?closed=1) + +Version 3.15.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/157?closed=1) + +Version 3.15.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/156?closed=1) + +Version 3.15.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/155?closed=1) + +Version 3.15.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/154?closed=1) + +Version 3.15.0 +------------------ +- The funny "PI" version number messed up the release order in the maven site, + so here is a new minor release. +[issues resolved](https://github.com/javaparser/javaparser/milestone/153?closed=1) + +Version 3.14.16 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/152?closed=1) + +Version 3.14.159265359 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/151?closed=1) + +Version 3.14.14 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/150?closed=1) + +Version 3.14.13 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/149?closed=1) + +Version 3.14.12 +------------------ +- BREAKING: `NodeWithConstructors` has been merged into `NodeWithMembers`, +so if you don't have a very specific need to only find nodes that support constructors, +you can use `NodeWithMembers` instead. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/148?closed=1) + +Version 3.14.11 +------------------ +- BREAKING: the pseudo-language levels have been turned into constants with the same name in the same place. +With a little luck everything will keep compiling. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/147?closed=1) + +Version 3.14.10 (buggy!) +------------------ +- BREAKING: Java 13: `break` no longer has an expression, this was part of a language preview in Java 12 +and has been removed in Java 13. +- BREAKING: Java 13: `YieldStatement` and the keyword `yield` have been added. +This means the token numbers have changed, and this affects serialization. +If you rely on serialized tokens, be sure to deserialize with your current version and serialize with this version. +- Java 13: `TextBlockLiteralExpr` has been added. +- This release is broken because no identifier called `yield` can be used. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/146?closed=1) + +Version 3.14.9 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/145?closed=1) + +Version 3.14.8 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/144?closed=1) + +Version 3.14.7 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/143?closed=1) + +Version 3.14.6 (oops, failed) +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/142?closed=1) + +Version 3.14.5 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/141?closed=1) + +Version 3.14.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/140?closed=1) + +Version 3.14.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/139?closed=1) + +Version 3.14.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/138?closed=1) + +Version 3.14.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/137?closed=1) + +Version 3.14.0 +------------------ +* BREAKING: `SuperExpr` and `ThisExpr` used to have an `Expression classExpr`. +this has been tightened to `Name typeName` which is more specific and easier to use. +Checking if the expression is a `FieldAccessExpr` or `NameExpr` is no longer needed. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/136?closed=1) + +Version 3.13.10 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/135?closed=1) + +Version 3.13.9 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/134?closed=1) + +Version 3.13.8 (failed) +------------------ +(release failed) + +Version 3.13.7 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/133?closed=1) + +Version 3.13.6 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/132?closed=1) + +Version 3.13.5 +------------------ +* "BREAKING": `ReferenceType.getDirectAncestors()` no longer returns `java.lang.Object` when called on a `ReferenceType` of `java.lang.Object`. +This remedies infinite recursions in certain edge cases. If you relied on the old behavior, you have to add a `ReferenceType` instance of `java.lang.Object` +to the List returned by `ReferenceType.getDirectAncestors()` yourself. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/131?closed=1) + +Version 3.13.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/130?closed=1) + +Version 3.13.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/129?closed=1) + +Version 3.13.2 +------------------ +* Version 3.13.0 and 3.13.1 contain rather bad bugs that have been fixed here. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/128?closed=1) + +Version 3.13.1 (buggy!) +------------------ +* Slightly breaking: most parameters to Log methods now take consumers to avoid evaluating them when not necessary. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/127?closed=1) + +Version 3.13.0 (buggy!) +------------------ +* "BREAKING": The static `JavaParser.parse...` methods have moved to `StaticJavaParser.parse...`! + +[issues resolved](https://github.com/javaparser/javaparser/milestone/126?closed=1) + +Version 3.12.0 +------------------ +* "BREAKING": all deprecated code was removed. +If you don't know what to do, try version 3.11.0 and read the Javadoc for the deprecated methods. +It tells you what to use instead. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/124?closed=1) + +Version 3.11.0 +------------------ +* BREAKING: `SwitchEntryStmt` is now `SwitchEntry`, because it was never a statement. +* BREAKING: a case in a switch can now have multiple labels, +so `SwitchEntry` no longer has an `Expression label`, +but a `NodeList label`. +* This completes *parsing* support for Java 12. +Symbol resolution is still to be done. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/123?closed=1) + +Version 3.10.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/122?closed=1) + +Version 3.10.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/121?closed=1) + +Version 3.10.0 +------------------ +* slightly breaking: besides `break;` and `break [label];` there is now `break [expression];` like +`break 1+2;` or `break "bye!";` . That means that `BreakStmt` no longer has a `label`, +it has a `value` which is of type `Expression`. +This is to prepare for Java 12 switch expressions. +You can find the details in the Javadoc. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/120?closed=1) + +Version 3.9.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/119?closed=1) + +Version 3.9.0 +------------------ +* MAJOR BREAKAGE: modifiers (like public, static, transient) used to be a special case: +they were enums stored in an EnumSet. +This meant they were not true `Node`s, had to be treated in a special way, and missed some information. +This has now been corrected in [PR 1975](https://github.com/javaparser/javaparser/pull/1975). + +[issues resolved](https://github.com/javaparser/javaparser/milestone/118?closed=1) + +Version 3.8.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/117?closed=1) + +Version 3.8.2 +------------------ +* slightly breaking: `ObjectCreationExpr` no longer gets a diamond when constructed with the default constructor. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/116?closed=1) + +Version 3.8.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/114?closed=1) + +Version 3.8.0 +------------------ +* A Unicode preprocessing filter is now available again. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/113?closed=1) + +Version 3.7.1 +------------------ +* slightly breaking: the enum constants in JsonToken are now capitalized. +* slightly breaking: [some obscure methods in the symbol solver changed](https://github.com/javaparser/javaparser/pull/1922) + +[issues resolved](https://github.com/javaparser/javaparser/milestone/115?closed=1) + +Version 3.7.0 +------------------ +* BREAKING: `ForeachStmt` is now correctly capitalized: `ForEachStmt` +* BREAKING: when using modules, everything that was called `...Statement` is now correctly called `...Directive` + +[issues resolved](https://github.com/javaparser/javaparser/milestone/112?closed=1) + +Version 3.6.27 +------------------ +* The Json serialization now serializes more fields, +which *should* not impact existing code. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/111?closed=1) + +Version 3.6.26 +------------------ +* BREAKING: Node.getData now throws an exception if the data was not set before. +This can be rewritten by checking with Node.containsData before doing getData. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/110?closed=1) + +Version 3.6.25 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/109?closed=1) + +Version 3.6.24 +------------------ +* `findAncestor(type, predicate)` is now available + +[issues resolved](https://github.com/javaparser/javaparser/milestone/108?closed=1) + +Version 3.6.23 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/107?closed=1) + +Version 3.6.22 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/106?closed=1) + +Version 3.6.21 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/105?closed=1) + +Version 3.6.20 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/104?closed=1) + +Version 3.6.19 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/103?closed=1) + +Version 3.6.18 +------------------ +* Parsing Java 11 is now supported. +* Running on Java 11 is now supported. +* Building on JDK 11 is NOT yet supported. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/101?closed=1) + +Version 3.6.17 +------------------ +* A new artifact was added: javaparser-core-serialization. +It contains a JSON serializer, and might get more serializers in the future. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/100?closed=1) + +Version 3.6.16 +------------------ +* BREAKING: some parts of the module syntax used `Type` where they should have used `Name`. +This is now fixed, but your code may need to be adapted if you are parsing modules. + +[issues resolved](https://github.com/javaparser/javaparser/milestone/99?closed=1) + +Version 3.6.15 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/98?closed=1) + +Version 3.6.14 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/97?closed=1) + +Version 3.6.13 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/96?closed=1) +* JavaParserFacade.getType now can also handle NameExpr referring to types +while before they were not supported. +See [issue #1491](https://github.com/javaparser/javaparser/issues/1491#issuecomment-403277963) + +Version 3.6.12 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/95?closed=1) + +Version 3.6.10 & Version 3.6.11 +------------------ +* A mixup during the release put all the issues in the same milestone: + +[issues resolved](https://github.com/javaparser/javaparser/milestone/94?closed=1) + +Version 3.6.9 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/93?closed=1) + +Version 3.6.8 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/92?closed=1) +* Intellij Idea project files were deleted from the repository, +so if you have a clone of the JP source, your local files will be deleted as well. +Save anything you want to keep. + +Version 3.6.7 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/91?closed=1) + +Version 3.6.6 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/90?closed=1) +* You can now configure the parser inside JavaParserTypeSolver. + +Version 3.6.5 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/89?closed=1) +* Be aware of annotations or indents looking slightly different when output! + +Version 3.6.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/88?closed=1) + +Version 3.6.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/87?closed=1) + +Version 3.6.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/86?closed=1) + +Version 3.6.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/85?closed=1) +* BREAKING: `SymbolSolverQuickSetup` has been removed in favor of `ProjectRoot` and `SymbolSolverCollectionStrategy`. + +Version 3.6.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/84?closed=1) +* @daanschipper added `ProjectRoot` which is used for analysing and storing project structure. +* Upgraded version from 3.5.20 to 3.6.0 because people got tired of seeing 3.5. + +Version 3.5.20 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/83?closed=1) +* Thanks to @daanschipper for the PR :-) + +Version 3.5.19 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/82?closed=1) + +Version 3.5.18 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/81?closed=1) + +Version 3.5.17 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/80?closed=1) + +Version 3.5.16 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/79?closed=1) + +Version 3.5.15 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/78?closed=1) +* Java 10 support is complete. +* BREAKING: Java language level support has changed to make Java 10 support possible. +[Here's a little article about it](https://matozoid.github.io/2017/04/11/enable-java-9-support.html) + +Version 3.5.14 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/77?closed=1) +* Java 10's `var` can now be parsed and will be turned into a `VarType` node. +It can not be resolved yet. +* `NodeList` now has a pretty complete set of `...First` and `...Last` methods. +Thanks stephenramthun ! + +Version 3.5.13 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/76?closed=1) +* The Javadoc parser has received a lot of attention. + +Version 3.5.12 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/75?closed=1) +* Thanks to un0btanium for fixing the readme file! + +Version 3.5.11 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/74?closed=1) +* BREAKING: `AssignExpr.Operator.AND` is now `AssignExpr.Operator.BINARY_AND`. +* BREAKING: `AssignExpr.Operator.OR` is now `AssignExpr.Operator.BINARY_OR`. +* `getPrimaryTypeName` and `getPrimaryType` give access to the type that has the same name as the file it came from. +* Enums will now get their constants aligned vertically if there are more than five. +* You can now convert between `AssignExpr.Operator` and `AssignExpr.Operator` if you like. + +Version 3.5.10 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/73?closed=1) +* JavaSymbolSolver is now in the same project as JavaParser, meaning they get released together from now on. +* LexicalPreservingPrinter has had a big speed optimization. + +Version 3.5.9 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/72?closed=1) +* BREAKING: the very confusing constructor `NodeList(Node)` (which sets the parent) was removed. +* To avoid using the int type for token kinds, use the new `JavaToken.Kind` enum. +It can convert to and from the int kind. + +Version 3.5.8 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/71?closed=1) +* the module name is now set to com.github.javaparser.core + +Version 3.5.7 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/70?closed=1) + +Version 3.5.6 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/69?closed=1) +* `toSomeType()` methods have been added for many types that give more functional access to a subtype. +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.5.5 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/68?closed=1) +* SourceRoot is now silent by default - look at the Log class if you want to change that. +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.5.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/67?closed=1) +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.5.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/66?closed=1) +* Unicode escapes (`\u1234`) are now retained in the AST, + but they are now only allowed in comments, string and character literals, and identifiers. +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.5.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/65?closed=1) +* The pretty printer now cleans up Javadoc comments. +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.5.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/64?closed=1) +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.5.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/63?closed=1) +* A functional visitor API has been added. See [PR 1195](https://github.com/javaparser/javaparser/pull/1195) for now. +* Build is working again on Windows thanks to Leonardo Herrera. +* The pretty printer now has an option to order imports, also thanks to Leonardo Herrera. +* Receiver parameters are now well-supported instead of being a hack. See [issue 1194](https://github.com/javaparser/javaparser/pull/1194) for a description. +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.4.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/62?closed=1) +* BETA: the below work on Java Symbol Solver is still ongoing. + +Version 3.4.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/61?closed=1) +* BETA: we're still doing work to integrate parts of [Java Symbol Solver](https://github.com/javaparser/javasymbolsolver) to simplify its API. +* `VisitorMap` is joined by `VisitorSet` and `VisitorList`, +for when you want to store `Node`s in collection but don't want its default equals/hascode behaviour + +Version 3.4.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/60?closed=1) +* BETA: we're doing work to integrate parts of [Java Symbol Solver](https://github.com/javaparser/javasymbolsolver) to simplify its API. +* JDK 9 will compile JavaParser now. +* [An official sample Maven setup](https://github.com/javaparser/javaparser-maven-sample) was added. + +Version 3.4.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/59?closed=1) +* Two visitors were added: `NoCommentEqualsVisitor` and `NoCommentHashCodeVisitor` - +as the name implies you can use these to compare nodes without considering comments. +Thanks Ryan Beckett! +* `isSomeType()` methods have been added for many types that help avoid `instanceof`. +* `asSomeType()` methods have been added for many types that help avoid casting to that type. +* `ifSomeType()` methods have been added for many types, giving a nice functional way of doing if-is-type-then-cast-to-type-then-use. +* The `LexicalPreservingPrinter` had its API changed a little: setup and printing are now separate things, +so you don't have to drag an instance of `LexicalPreservingPrinter` through your code anymore. +* `traverseScope` was added to all nodes with a scope, so you can travel through the scope without tripping over (non-)optionality. + + +Version 3.4.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/58?closed=1) +* BREAKING: We missed a Java 9 feature which is now on board: try with resources can now refer to a resource declared outside of the statement. +This means that the node type you get for those resources is now `Expression` instead of `VariableDeclarationExpr`. +For Java 8 and below you can simply cast it to `VariableDeclarationExpr` again. +See also the Javadoc for `TryStmt`. +* You can now inspect the AST by exporting it to XML, JSON, YAML, or a Graphviz's dot diagram, thanks to Ryan Beckett! +* `GenericVisitorWithDefaults` and `VoidVisitorWithDefaults` were added which function like empty visitors, +but all the visit methods call a default method by default. +* Annotation support was cleaned up, adding some obscure locations where you can have annotations. +* `EnumDeclaration` regained its constructor builder methods. They were accidentally lost around 3.2.2. +* `ArrayType` now has an `origin` field which indicates in which position the array brackets were found. + +Version 3.3.5 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/57?closed=1) + +Version 3.3.4 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/56?closed=1) +* `SourceZip` has been added. +Use it to read source code from jars or zip files. +Thank you @ryan-beckett ! +* JavaCC was upgraded to 7.0.2 +* A new option for the pretty printer was added. +You can now wrap-and-column-align parameters of method calls. +Thank you @tarilabs ! + +Version 3.3.3 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/55?closed=1) +* Parsing a partial java file (like an expression or statement) no longer ignores trailing code. +* New memory saving option: turn off token list. + +Version 3.3.2 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/54?closed=1) +* `VisitorMap` lets you override hashcode/equals for nodes when used as a key for a map. + +Version 3.3.1 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/53?closed=1) +* The token list is now mutable - see methods on `JavaToken`. +This caused mild breakage - some fields have become `Optional`. + +Version 3.3.0 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/52?closed=1) +* Breaking: `TryStmt::tryBlock` and `EnclosedExpr::inner` were optional for no good reason. Now they are required. +* You can now ask a `JavaToken` for its category, which is useful for examining the token list or doing syntax highlighting or so. +* `enum` and `strictfp` can now be used as identifiers on lower Java versions. + +Version 3.2.12 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/51?closed=1) + +Version 3.2.11 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/50?closed=1) +* We're up to date with the latest Java 9 module system again. + +Version 3.2.10 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/49?closed=1) +* `Node.replace(old, new)` was added, including property-specific `X.replaceY(newY)` methods + +Version 3.2.9 +------------------ +Scrapped due to release problem. + +Version 3.2.8 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/48?closed=1) +* Added `isInnerClass()` that checks if a `ClassOrInterfaceDeclaration` is an inner class (note: this is different from a nested class!) +* @ryan-beckett contributed a huge [Eclipse setup guide](https://github.com/javaparser/javaparser/wiki/Eclipse-Project-Setup-Guide) + +Version 3.2.7 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/47?closed=1) +* We now recover from some parse errors! [Here is an article](https://matozoid.github.io/2017/06/11/parse-error-recovery.html) + +Version 3.2.6 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/46?closed=1) +* `EmptyMemberDeclaration` is gone! +It was deprecated for a while because it was in the AST, but doesn't have any meaning in a Java program. +`EmptyStmt` was also deprecated, but that has been reverted. +This node *does* have meaning. + +Version 3.2.5 +------------------ +[issues resolved](https://github.com/javaparser/javaparser/milestone/45?closed=1) +* `NodeWithCondition` was added on all nodes containing a condition. +* Lots of work on improving lexical preservation. +* If a file was parsed from a file system, you can now get path information etc. from `CompilationUnit` +* API BREAKING: every node now points to its start and end token. +Some of the API has started returning `TokenRange` instead of `Range` - you can call `toRange` to get the old object type. +We may still change the naming of some of this code in the following month. + +Version 3.2.4 +------------------ +New style changelog, no more issue numbers, but a link: +[issues resolved](https://github.com/javaparser/javaparser/milestone/44?closed=1) +and any notable changes: +* the new method `Node.removeForced()` by removing it, or removing the first parent that is optional. +This is different from `Node.remove()`, `remove()` only tries to remove the node from the parent and fails if it can't. +* `FieldAccessExpr.scope` is now a required property. +You might find some `get()`s in your code that are no longer necessary. +* `ReferenceType` no longer has a type parameter, so every `ReferenceType` can be replaced by `ReferenceType` now. + +Version 3.2.3 +------------------ +* 907 906 905 903 911 910 909 908 smaller improvements and fixes + +Version 3.2.2 +------------------ +Beta: `TreeStructureVisitor`. + +* 770 902 904 901 smaller improvements and fixes + +Version 3.2.1 +------------------ +Beta: `TreeStructureVisitor`. + +* Maven dependencies were updated to their latest versions +* 890 the concept of "method signature" now exists in JavaParser +* 896 891 889 887 882 789 smaller improvements and fixes + +Version 3.2.0 +------------------ +The lexical preservation code is stable! + +Beta: `TreeStructureVisitor`. + +* 885 884 879 878 smaller improvements and fixes + +Version 3.1.4 +------------------ +This is the first version to parse Java 9. + +Beta: `TreeStructureVisitor`, and `LexicalPreservingPrinter`. + +* 872 873 874 787 Remaining Java 9 work. + +Version 3.1.3 +------------------ +Beta: `TreeStructureVisitor`, and `LexicalPreservingPrinter`. + +A start has been made on source level support. The default level is Java 8. +It can be set to Java 9 like this for a parser *instance*: +```java +private final JavaParser parser = new JavaParser(new ParserConfiguration().setValidator(new Java9Validator())); +``` +and like this for the static parse methods: +```java +QuickJavaParser.getConfiguration().setValidator(new Java9Validator()); +``` + +* 862 552 "_" is an illegal identifier on source level 9. +* 869 867 109 855 857 smaller improvements and fixes + +Version 3.1.2 +------------------ +Beta: `TreeStructureVisitor`, `ConcreteSyntaxModel`, and `LexicalPreservingPrinter`. + +* 594 849 831 a validation framework was introduced to inform about problems in the AST without needing to change the grammar, +and without requiring parsing code. +It is open for extension by users. +* 852 853 826 832 846 839 smaller improvements and fixes + +Version 3.1.1 +------------------ +Beta: `TreeStructureVisitor`, `ConcreteSyntaxModel`, and `LexicalPreservingPrinter`. + +* 654 124 lexical preservation (printing source code with the same formatting it had when parsing) has been added. + Thank you @ftomassetti for a lot of work! +* 554 800 first (big) step towards Java 9 support: JavaParser can read project Jigsaw module definitions. +* 795 786 751 extend the TreeVisitor with more traversal options. Thanks @ryan-beckett! +* 791 `GenericListVisitorAdapter` has been added which collects its results in a list. Thanks @Gottox! +* 815 798 797 813 clean up Problem text +* 819 818 817 816 441 809 808 807 fix various absurd annotation related issues. +* 777 805 802 796 790 792 793 781 784 785 783 782 779 357 799 763 smaller improvements and fixes + +Version 3.1.0 +------------------ +Beta: `TreeStructureVisitor` and `ConcreteSyntaxModel`. + +* 705 755 Add the concrete syntax model, which will give you information about the exact syntax a certain nodes matches. + +* 777 smaller improvements and fixes + +Version 3.1.0-beta.2 +------------------ +This version is a beta because `TreeStructureVisitor` is not in its definite state yet. + +* 762 761 772 merge `javaparser-metamodel` and `javaparser-generator-utils` into `javaparser-core`. +* 766 the `ModifierVisitor` is now created by a code generator. Its behaviour has been made logical, and may give different results than before. +* 755 `ConstructorDeclaration` and `MethodDeclaration` now share a parent: `CallableDeclaration` +* 687 759 773 769 768 767 765 759 smaller improvements and fixes + +Version 3.1.0-beta.1 +------------------ +This version is a beta because there are a lot of new features that may still change. + +This version needs a minor version increase because of a backwards compatability issue: +* 719 `getJavadoc`, `getJavadocComment` and `getComment` could return null. Our promise was to return `Optional`, so that is what they do now. + +New: +* 658 718 736 737 we have created a metamodel. +It gives information about the structure of the various AST nodes, as if you are introspecting them. +You can find it in `javaparser-metamodel`, the main class is `JavaParserMetaModel` +* 353 365 visitors are no longer hand made, they are now generated from the metamodel. This should make them 100% reliable. +Affected visitors are: `GenericVisitorAdapter`, `EqualsVisitor`, `VoidVisitorAdapter`, `VoidVisitor`, `GenericVisitor`, `HashCodeVisitor`, `CloneVisitor`. + +If you want to generate your own visitors, you can use the `VisitorGenerator` class from `javaparser-core-generators` + +If you want to reuse the code generation utilities, look at module `javaparser-generator-utils` - there is a very useful `SourceRoot` class in there that takes away a lot of file management troubles. +* 538 735 `TreeStructureVisitor` has been added, which should be considered beta. +* 220 733 717 749 745 750 743 748 666 732 746 734 733 smaller improvements and fixes + +Version 3.0.1 +------------------ +* 699 433 325 Javadoc can now be parsed +* 703 696 added NodeWithOptionalScope +* 702 FieldAccessExpr now implements NodeWithSimpleName, *which means that "field" has been renamed to "name"* +* 707 706 improve range of array types and levels +* 709 smaller improvements and fixes + +Version 3.0.0 +------------------ +* 695 697 689 680 693 691 682 690 677 679 688 684 683 smaller improvements and fixes + +Version 3.0.0-RC.4 +------------------ +* 668 669 TypeDeclarationStmt became LocalClassDeclarationStmt +* 347 665 every node now has some documentation +* 660 670 673 four types of import declaration have been merged back into the old ImportDeclaration +* 659 The pretty printer can now take customized visitors +* 650 671 672 674 524 smaller improvements and fixes + +Version 3.0.0-RC.3 +------------------ +* 639 622 632 657 656 652 653 647 648 645 194 643 630 624 628 627 626 625 623 cleanups, small fixes, and general housekeeping + +Version 3.0.0-RC.2 +------------------ +* 593 EmptyImportDeclaration and NonEmptyImportDeclaration have been removed +* 612 VariableDeclaratorId has been removed. It has been substituted by "SimpleName name" +* 614 617 the list of tokens has been linearized and simplified +* 615 support for arrays has once more been changed. See [the issue](https://github.com/javaparser/javaparser/issues/592) +* 580 453 380 618 580 611 610 424 608 smaller improvements and fixes + +Version 3.0.0-RC.1 +------------------ +* 499 601 renames many fields to be more consistent +* 596 605 602 604 smaller improvements and fixes + +Version 3.0.0-alpha.11 +------------------ +* 547 595 Node.range is now using Optional instead of Range.UNKNOWN +* 584 588 548 585 bug fixes and improvements + +Version 3.0.0-alpha.10 +------------------ +* 578 579 577 575 290 570 568 567 562 564 551 bug fixes and improvements + +Version 3.0.0-alpha.9 +------------------ +* 403 358 549 Make all names nodes: either SimpleName or Name. This makes every name in the AST visitable. NameExpr is now a wrapper to use SimpleName in an expression. +* 516 536 use Optional<> for return values. +* 556 557 558 550 small improvements and fixes. +* 560 559 make nodes observable. + +Version 3.0.0-alpha.8 +------------------ +* 344 529 turn DumpVisitor into an official PrettyPrinter +* 532 508 427 530 531 513 528 cleanups + +Version 3.0.0-alpha.7 +------------------ +* 515 roll back attempt at using Optional +* 522 504 make NodeList not a Node (restores parent/children behaviour to before alpha.4) +* 527 526 rename getChildrenNodes to getChildNodes +* 525 495 520 bug fix + +Version 3.0.0-alpha.6 +------------------ +* 503 modified ImportDeclaration hierarchy to have getters for static and "asterisk" again +* 506 bug fix + +Version 3.0.0-alpha.5 +------------------ +* 451 null is no longer allowed in the AST. [See last post in issue](https://github.com/javaparser/javaparser/issues/451) +* 501 421 420 316 use a special type of list for nodes: NodeList. [See last post in issue](https://github.com/javaparser/javaparser/issues/421) + +Version 3.0.0-alpha.4 +------------------ +* 463 471 nodes can now be removed easily +* 491 import handling changed. Instead of "ImportDeclaration", we now have the four types of import as described in the JLS. [See issue](https://github.com/javaparser/javaparser/pull/491) +* 452 355 474 494 various improvements +* 493 492 485 Simplify the JavaParser interface + +Version 3.0.0-alpha.3 +------------------ +* 112 237 466 465 461 460 458 457 fundamentally changes how we deal with arrays. [It is explained in the last post here](https://github.com/javaparser/javaparser/issues/237) +* 472 456 makes the "data" field on every node more structured. +* 477 468 refactor TypeArguments. You will find that TypeArguments is no longer a type, it is just a list in some nodes. +* 482 adds the "nodeTypes" packages to the osgi export. +* 479 476 makes all setters on nodes return this so they become chainable. +* 473 437 clean up CloneVisitor. + +Version 3.0.0-alpha.2 +------------------ +* 157 a new parser frontend, check https://github.com/javaparser/javaparser/pull/447 for explanations +* 435 more builder methods like 400 and 405 +* 111 440 443 444 445 446 bugs & cleanups + +Version 3.0.0-alpha.1 +------------------ +* 400 405 introduce many "builder" style methods for constructing code. Thanks DeepSnowNeeL! +* 409 remove ASTHelper (methods are now on specific Node subclasses) +* 414 JavaParser can now be instantiated and reused. InstanceJavaParser removed +* 418 417 411 408 bugs +* 367 420 407 402 various cleanups + +Version 2.5.1 +------------- +* 394 OSGi manifest added +* 391 fix ModifierVisitor NullPointerException bug +* 385 a few new parse methods +* 386 fix dumping an empty import (a single ; after the package declaration) + +Version 2.5.0 +------------- +API breaking changes: + +* 191: moved TreeVisitor to visitor package +* 368, 162, 303, 302, 360: use correct type in some places. +* 371: code is now compiled with Java 8 +* 342, 331: ModifierVisitorAdapter detects and removes broken nodes +* 328, 270: upgrade JavaCC (use TokenMgrException now) +Other changes: + +* 297: enable access to tokens. +* 341, 361: node positions are now OO +* 211, 373: escaping of \n \r for string literals +* 336, 276, 141: JavaDoc support now works +* 337, 281: reorganize the stream reading code +* 343, 309, 332, 57: take advantage of common interfaces +* 329, 326, 327: deal with platform issues +* 163, 236, 252, 296, 269, 339, 321, 322, 252, 253, 293, 295: various fixes +* 310, 311, 313, 301, 294: some code clean-ups + +Version 2.4.0 +------------- +* several fixes in DumpVisitor for bugs due to lazy initialization +* make TypeDeclaration implements DocumentableNode directly +* TypedNode interface introduced +* introduce MultiBoundType +* refactored IntersectionType and UnionType +* refactored CatchClause +* parsing annotations in throws declarations +* parse orphan semicolons in import statements +* added PackageDeclaration.getPackageName +* solved issue with newlines in string literals +* fixed handling of UnknownType in EqualsVisitor +* improvements to CommentsParser +* removing old grammar + +Version 2.3.0 +------------- +* ClassOrInterfaceType implements NamedNode +* DumpVisitor can now be extended +* Improved documentation +* AST: lists are now lazy initialized + +Version 2.1.0 +------------- +* Features + * [#75 performance improvement for `PositionUtils.sortByBeginPosition`](https://github.com/javaparser/javaparser/issues/75) + * [#64 In getDeclarationAsString parameter names should be optional](https://github.com/javaparser/javaparser/issues/64) +* Bugfixes + * [#79 Fix NPE in `ConstructorDeclaration.getDeclarationAsString`](https://github.com/javaparser/javaparser/pull/79) + * [#86 Add missing functions to ModifierVisitorAdapter](https://github.com/javaparser/javaparser/pull/86) + * [#82 set LambdaExpr as parent of its child nodes](https://github.com/javaparser/javaparser/issues/82) + * [#87 implement `setJavadoc` and `getJavadoc` at various classes](https://github.com/javaparser/javaparser/issues/87) + * [#96 Fixed encoding issue in `Javaparser.parse`](https://github.com/javaparser/javaparser/pull/96) + * [#85 Casting a lambda expression causes a parsing failure](https://github.com/javaparser/javaparser/issues/85) + * [#88 `MethodReferenceExpr` and `TypeExpr` don't set themselves as parents](https://github.com/javaparser/javaparser/issues/88) +* Internal + * [#89 CommentsParser.State contains unused fields](https://github.com/javaparser/javaparser/issues/89) + * Switched from drone.io to [Travis](https://travis-ci.org/javaparser/javaparser) + * [#105 Enforce compiling the library for a certain Java version](https://github.com/javaparser/javaparser/pull/105) + +[Code changes](https://github.com/javaparser/javaparser/compare/javaparser-parent-2.0.0...master) + +Version 2.0.0 +------------- +* support Java 8 + +Version 1.0.8 (2010-01-17) +------------- +* Fixed issues: + * Issue 17: A refactor suggestion for AnnotationExpr and its subclasses + * Issue 21: Java 5 JavaParser compiled JARs + * Issue 22: Please use java.lang.reflect.Modifier constants in japa.parser.ast.body.ModifierSet + * Issue 27: Implement the "equal" method + * Issue 30: equals and hashCode methods + +Version 1.0.7 (2009-04-12) +------------- +* Issue 19 fixed: +* Tests changed to run with junit 4 + +Version 1.0.6 (2009-01-11) +------------- +* Issue 11 fixed: changed method get/setPakage to get/setPackage in the class CompilationUnit +* Created new visitor adapter to help AST modification: ModifierVisitorAdapter +* Changed visitor adapters to abstract + +Version 1.0.5 (2008-10-26) +------------- +* Created simplified constructors in the nodes of the AST (without positional arguments) +* Created ASTHelper class with some helpful methods (more methods are still needed) + +Version 1.0.4 (2008-10-07) +------------- +* Moved to javacc 4.1. +* The java_1_5.jj can be build alone without compilation errors + +Version 1.0.3 (2008-09-06) +------------- +* Removed SuperMemberAccessExpr class, it was no longer used +* Removed the methods get/setTypeArgs() from ArrayCreationExpr, this node shouldn't have these methods. +* Fixed the bug with start/end position of the nodes IntegerLiteralMinValueExpr and LongLiteralMinValueExpr +* The methods get/setAnnotations() from all BodyDeclaration subclasses were pushed down to BodyDeclaration class + +Version 1.0.2 (2008-07-20) +------------- +* Issue fixed: Issue 1: Add support for editing AST nodes or create new ones + +Version 1.0.1 (2008-07-01) +------------- +* Issue fixed: Issue 5: end line and end column equal to begin line and begin column + +Version 1.0.0 (2008-06-25) +------------- +* Changed version numbering, starting version 1.0.0 +* Javadoc done for packages: + * japa.parser + * japa.parser.ast +* Corrected bug when parsing in multithread: + * JavaParser.setCacheParser(false) must be called before to use the parser concurrent + +2008-06-19 +------------- +* No code changes, added binary distribution to download page + +2008-06-11 +------------- +* Bug corrected: NPE in VoidVisitorAdapter + * http://code.google.com/p/javaparser/issues/detail?id=2 + +2008-06-09 +------------- +* Added Adapters for de visitors + +2008-05-28 +------------- +* This project now is published at Google Code: + * http://code.google.com/p/javaparser/ + +2008-05-25 +------------- +* Added support for comments and javadoc to the tree. + * Javadocs are stored directly to members (BodyDeclaration and all deriveds (classes, methods, fields, etc.)), accessible by the method getJavadoc(). + * All comments are stored in the CompilationUnit, accessible by the method getComments(). + +2008-04-01 +------------- +* Changed all nodes public attributes to be private and created getters to access them +* Changed the methods of the Node getLine e getColumn to getBeginLine and getBeginColumn +* Added the methods getEndLine and getEndColumn to the Node class (works only in the BlockNode) + +2007-12-22 +------------- +* Corrected ConditionalExpression bug + +2007-10-21 +------------- +* Added LGPL License + +2007-10-21 +------------- +* Bugs corrected: + * Created PackageDeclaration member of CompilationUnit to add suport for annotations in the package declaration + * Parameterized anonymous constructor invocation + * Explicit constructor invotation Type Arguments + * ctrl+z ("\u001A") ar end of compilation unit + +2007-10-09 +------------- +* EnumConstantDeclaration annotation support corrected +* Parssing Java Unicode escape characters suport added + +2007-10-03 +------------- +* Bug corrected: "MotifComboPopup.this.super()" statement was generating parser error + +2007-10-01 +------------- +* Bug corrected: Casting signed primitive values +``` + double d = (double) -1; + ^ +``` +2007-08-06 +------------- +* Bug with the single line comments in the final of the unit corrected + +2007-07-31 +------------- +* Fixed the bug with the following expression: `Class c = (int.class);` + +2007-06-26 +------------- +* Bug fixes from Leon Poyyayil work + * suport for hex floating point + * unicode digits in indentifier + * MemberValueArrayInitializer + +2007-03-09 +------------- +* Long and Integer literal MIN_VALUE bug + +2007-02-24 +------------- +* '\0' bug fixed + +2007-02-01 +------------- +* Many bug fixes +* Added line/column to nodes diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/codecov.yml b/Assignment-2/javaparser-javaparser-parent-3.27.0/codecov.yml new file mode 100644 index 0000000..4755d38 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/codecov.yml @@ -0,0 +1,90 @@ +codecov: + require_ci_to_pass: true + + +coverage: + + ## Configure decimal places, rounding, and the colour ranges used: + ## https://docs.codecov.com/docs/coverage-configuration + precision: 3 + round: down + range: "70...90" # Colour range - 70% coverage (and below) is solid red, 90% coverage (and above) is solid green. + + + ## These statuses show at the bottom of the PR. + ## Split the coverage reporting into sub-projects. + ## https://docs.codecov.io/docs/commit-status + ## https://docs.codecov.io/docs/codecovyml-reference#coveragestatus + status: + + ## Status configuration of the whole project + project: + + whole_project: ## Whole project (note no flags specified) + target: auto ## Increase overall coverage on each pull request (compared to the previous base commit) + threshold: 0.5% ## Flexibility in allowing a minor drop in coverage + + javaparser-core: ## Just JavaParser Core + target: auto ## Increase overall coverage on each pull request (compared to the previous base commit) + threshold: 0.5% ## Flexibility in allowing a minor drop in coverage + ## TBC: Unclear if setting flags AND paths is redundant + flags: + - javaparser-core + paths: + - javaparser-core/src/main/java* + - javaparser-core-testing/src/test/java* + - javaparser-core-testing-bdd/src/test/java* + + javaparser-symbol-solver: ## Just the Symbol Solver + target: auto ## Increase overall coverage on each pull request (compared to the previous base commit) + threshold: 0.5% ## Flexibility in allowing a minor drop in coverage + ## TBC: Unclear if setting flags AND paths is redundant + flags: + - javaparser-symbol-solver + paths: + - javaparser-symbol-solver-core/src/main/java* + - javaparser-symbol-solver-testing/src/test/java* + + ## Status configuration of ONLY the changed lines + patch: + + + +## Configuration of the comments that get added to PRs +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: false + ### Do not comment on the PR until coverage reports for all builds has been received + ### Note: 54 = three OSs (mac, windows, ubuntu) x nine java levels (8,9,10,11,12,13,14,15,16) x two modules (jp-core, jss) + after_n_builds: 54 + + +## Flags defined elsewhere MUST also be defined here (required for GitHub PR checks information) +flags: + javaparser-core: + paths: + - javaparser-core/src/main/java* + - javaparser-core-testing/src/test/java* + - javaparser-core-testing-bdd/src/test/java* + carryforward: false + javaparser-symbol-solver: + paths: + - javaparser-symbol-solver-core/src/main/java* + - javaparser-symbol-solver-testing/src/test/java* + carryforward: false + + +# ## New section re: flags +# ## No individual flags are added to YAML and flag names are automatically ingested from the Uploader +# ## https://docs.codecov.com/docs/flags +# flag_management: +# default_rules: +# carryforward: false + + +ignore: + - "/javaparser-core/src/main/java-templates/**" ## This source is ... +# - "/javaparser-core/src/main/javacc-support/**" ## This source is generated by JavaCC + - "/javaparser-symbol-solver-testing/src/test/test_sourcecode/**" ## This source is used as inputs to test cases + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-CheckStyle.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-CheckStyle.xml new file mode 100644 index 0000000..534866b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-CheckStyle.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-eclipse.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-eclipse.xml new file mode 100644 index 0000000..853811c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-eclipse.xml @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-idea.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-idea.xml new file mode 100644 index 0000000..fd90eed --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/JavaParser-idea.xml @@ -0,0 +1,38 @@ + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/settings.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/settings.xml new file mode 100644 index 0000000..5522172 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/dev-files/settings.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + ossrh + ${env.MAVEN_OSSRH_USERNAME} + ${env.MAVEN_OSSRH_PASSWORD} + + + + + + ossrh + + true + + + + gpg + ${env.MAVEN_GPG_KEYNAME} + ${env.MAVEN_GPG_PASSPHRASE} + + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/doc/component_diagram.puml b/Assignment-2/javaparser-javaparser-parent-3.27.0/doc/component_diagram.puml new file mode 100644 index 0000000..2a219aa --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/doc/component_diagram.puml @@ -0,0 +1,29 @@ +@startuml +node core { + [Java parser] <-- [AST] + [Javadoc parser] + [AST] <-- [lexical preserving printer] + [AST] <-- [concrete syntax model] + [concrete syntax model] <-- [lexical preserving printer] + events <-- [lexical preserving printer] + [AST] <-- [comments inserter] + [AST] <-- [visitors] + [AST] <-- [meta model] + [AST] <-- [pretty printer] + [visitors] <-- [pretty printer] + [AST] - symbol_resolution + [AST] - events + [visitors] <-- [code generators] + [AST] <-- [code generators] + [meta model] <-- [code generators] + [AST] <-- [JSON (de)serializer] + [Java parser] <- [source root] +} +node symbol-solver { + [AST] <- [model] + symbol_resolution <- [model] + [model] <-- [core] + [model] <-- [logic] + [logic] <-- [core] +} +@enduml \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/doc/readme.md b/Assignment-2/javaparser-javaparser-parent-3.27.0/doc/readme.md new file mode 100644 index 0000000..01c069d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/doc/readme.md @@ -0,0 +1,132 @@ + + + +# JavaParser + +[![Maven Central](https://img.shields.io/maven-central/v/com.github.javaparser/javaparser-core.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.javaparser%22%20AND%20a%3A%22javaparser-core%22) +[![Build Status](https://travis-ci.org/javaparser/javaparser.svg?branch=master)](https://travis-ci.org/javaparser/javaparser) +[![Coverage Status](https://codecov.io/gh/javaparser/javaparser/branch/master/graphs/badge.svg?branch=master)](https://app.codecov.io/gh/javaparser/javaparser?branch=master) +[![Join the chat at https://gitter.im/javaparser/javaparser](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/javaparser/javaparser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![License LGPL-3/Apache-2.0](https://img.shields.io/badge/license-LGPL--3%2FApache--2.0-blue.svg)](LICENSE) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2667378.svg)](https://doi.org/10.5281/zenodo.2667378) + + +This project contains a set of libraries implementing a Java 1.0 - Java 15 Parser with advanced analysis functionalities. This includes preview features to Java 13, with Java 14 preview features work-in-progress. + +Our main site is at [JavaParser.org](http://javaparser.org) + +## Setup + +The project binaries are available in Maven Central. + +We strongly advise users to adopt Maven, Gradle or another build system for their projects. +If you are not familiar with them we suggest taking a look at the maven quickstart projects +([javaparser-maven-sample](https://github.com/javaparser/javaparser-maven-sample), +[javasymbolsolver-maven-sample](https://github.com/javaparser/javasymbolsolver-maven-sample)). + +Just add the following to your maven configuration or tailor to your own dependency management system. + +[Please refer to the Migration Guide when upgrading from 2.5.1 to 3.0.0+](https://github.com/javaparser/javaparser/wiki/Migration-Guide) + +**Maven**: + +```xml + + com.github.javaparser + javaparser-symbol-solver-core + ${project.version} + +``` + +**Gradle**: + +``` +implementation 'com.github.javaparser:javaparser-symbol-solver-core:${project.version}' +``` + +Since Version 3.5.10, the JavaParser project includes the JavaSymbolSolver. +While JavaParser generates an Abstract Syntax Tree, JavaSymbolSolver analyzes that AST and is able to find +the relation between an element and its declaration (e.g. for a variable name it could be a parameter of a method, providing information about its type, position in the AST, ect). + +Using the dependency above will add both JavaParser and JavaSymbolSolver to your project. If you only need the core functionality of parsing Java source code in order to traverse and manipulate the generated AST, you can reduce your projects boilerplate by only including JavaParser to your project: + +**Maven**: + +```xml + + com.github.javaparser + javaparser-core + ${project.version} + +``` + +**Gradle**: + +``` +implementation 'com.github.javaparser:javaparser-core:${project.version}' +``` + +Since version 3.6.17 the AST can be serialized to JSON. +There is a separate module for this: + +**Maven**: + +```xml + + com.github.javaparser + javaparser-core-serialization + ${project.version} + +``` + +**Gradle**: + +``` +implementation 'com.github.javaparser:javaparser-core-serialization:${project.version}' +``` + +## How To Compile Sources + +If you checked out the project's source code from GitHub, you can build the project with maven using: +``` +mvnw clean install +``` + +If you want to generate the packaged jar files from the source files, you run the following maven command: +``` +mvnw package +``` + +**NOTE** the jar files for the two modules can be found in: +- `javaparser/javaparser-core/target/javaparser-core-\.jar` +- `javaparser-symbol-solver-core/target/javaparser-symbol-solver-core-\.jar` + +If you checkout the sources and want to view the project in an IDE, it is best to first generate some of the source files; +otherwise you will get many compilation complaints in the IDE. (`mvnw clean install` already does this for you.) + +``` +mvnw javacc:javacc +``` + +If you modify the code of the AST nodes, specifically if you add or remove fields or node classes, +the code generators will update a lot of code for you. +The `run_metamodel_generator.sh` script will rebuild the metamodel, +which is used by the code generators which are run by `run_core_generators.sh` +Make sure that `javaparser-core` at least compiles before you run these. + +**Note**: for Eclipse IDE follow the steps described in the wiki: https://github.com/javaparser/javaparser/wiki/Eclipse-Project-Setup-Guide + +## More information + +#### [JavaParser.org](https://javaparser.org) is the main information site. + +## License + +JavaParser is available either under the terms of the LGPL License or the Apache License. You as the user are entitled to choose the terms under which adopt JavaParser. + +For details about the LGPL License please refer to [LICENSE.LGPL](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.LGPL). + +For details about the Apache License please refer to [LICENSE.APACHE](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.APACHE). diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/pom.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/pom.xml new file mode 100644 index 0000000..645321f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/pom.xml @@ -0,0 +1,55 @@ + + + + javaparser-parent + com.github.javaparser + 3.27.0 + + 4.0.0 + + javaparser-core-generators + A code generator framework, and the generators for javaparser-core + + + + com.github.javaparser + javaparser-core + ${project.version} + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + run-generators + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-javaparser-core + test + + java + + + + + test + com.github.javaparser.generator.core.CoreGenerator + + ${project.basedir} + + + + + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/CompilationUnitGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/CompilationUnitGenerator.java new file mode 100644 index 0000000..e99eb4f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/CompilationUnitGenerator.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator; + +import com.github.javaparser.ParseResult; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.utils.SourceRoot; +import java.util.List; + +public abstract class CompilationUnitGenerator extends Generator { + + protected CompilationUnitGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + public void generate() throws Exception { + List> parsedCus = sourceRoot.tryToParse(); + for (ParseResult cu : parsedCus) { + cu.ifSuccessful(this::generateCompilationUnit); + } + } + + protected abstract void generateCompilationUnit(CompilationUnit compilationUnit); +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/Generator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/Generator.java new file mode 100644 index 0000000..9e75816 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/Generator.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator; + +import static com.github.javaparser.ast.NodeList.toNodeList; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.Generated; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.CallableDeclaration; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; +import com.github.javaparser.utils.SourceRoot; +import java.util.List; + +/** + * A general pattern that the generators in this module will follow. + */ +public abstract class Generator { + protected final SourceRoot sourceRoot; + + protected Generator(SourceRoot sourceRoot) { + this.sourceRoot = sourceRoot; + } + + public abstract void generate() throws Exception; + + protected > void annotateGenerated(T node) { + annotate(node, Generated.class, new StringLiteralExpr(getClass().getName())); + } + + protected > void annotateSuppressWarnings(T node) { + annotate(node, SuppressWarnings.class, new StringLiteralExpr("unchecked")); + } + + protected void annotateOverridden(MethodDeclaration method) { + annotate(method, Override.class, null); + } + + private > void annotate(T node, Class annotation, Expression content) { + node.setAnnotations(node.getAnnotations().stream() + .filter(a -> !a.getNameAsString().equals(annotation.getSimpleName())) + .collect(toNodeList())); + + if (content != null) { + node.addSingleMemberAnnotation(annotation.getSimpleName(), content); + } else { + node.addMarkerAnnotation(annotation.getSimpleName()); + } + node.tryAddImportToParentCompilationUnit(annotation); + } + + /** + * Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it + * with callable. If not found, adds callable. When the new callable has no javadoc, any old javadoc will be kept. + */ + protected void addOrReplaceWhenSameSignature( + ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration callable) { + addMethod(containingClassOrInterface, callable, () -> containingClassOrInterface.addMember(callable)); + } + + /** + * Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it + * with callable. If not found, fails. When the new callable has no javadoc, any old javadoc will be kept. The + * method or constructor is annotated with the generator class. + */ + protected void replaceWhenSameSignature( + ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration callable) { + addMethod(containingClassOrInterface, callable, () -> { + throw new AssertionError(f( + "Wanted to regenerate a method with signature %s in %s, but it wasn't there.", + callable.getSignature(), containingClassOrInterface.getNameAsString())); + }); + } + + private void addMethod( + ClassOrInterfaceDeclaration containingClassOrInterface, + CallableDeclaration callable, + Runnable onNoExistingMethod) { + List> existingCallables = + containingClassOrInterface.getCallablesWithSignature(callable.getSignature()); + if (existingCallables.isEmpty()) { + onNoExistingMethod.run(); + return; + } + if (existingCallables.size() > 1) { + throw new AssertionError(f( + "Wanted to regenerate a method with signature %s in %s, but found more than one.", + callable.getSignature(), containingClassOrInterface.getNameAsString())); + } + final CallableDeclaration existingCallable = existingCallables.get(0); + callable.setJavadocComment(callable.getJavadocComment() + .orElseGet(() -> existingCallable.getJavadocComment().orElse(null))); + annotateGenerated(callable); + containingClassOrInterface.getMembers().replace(existingCallable, callable); + } + + /** + * Removes all methods from containingClassOrInterface that have the same signature as callable. This is not used by + * any code, but it is useful when changing a generator and you need to get rid of a set of outdated methods. + */ + protected void removeMethodWithSameSignature( + ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration callable) { + for (CallableDeclaration existingCallable : + containingClassOrInterface.getCallablesWithSignature(callable.getSignature())) { + containingClassOrInterface.remove(existingCallable); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/NodeGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/NodeGenerator.java new file mode 100644 index 0000000..73a89c2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/NodeGenerator.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.Pair; +import com.github.javaparser.utils.SourceRoot; +import java.util.Arrays; + +/** + * Makes it easier to generate code in the core AST nodes. The generateNode method will get every node type passed to + * it, ready for modification. + */ +public abstract class NodeGenerator extends Generator { + protected NodeGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + public final void generate() throws Exception { + Log.info("Running %s", () -> getClass().getSimpleName()); + for (BaseNodeMetaModel nodeMetaModel : JavaParserMetaModel.getNodeMetaModels()) { + Pair result = parseNode(nodeMetaModel); + generateNode(nodeMetaModel, result.a, result.b); + } + after(); + } + + protected Pair parseNode(BaseNodeMetaModel nodeMetaModel) { + CompilationUnit nodeCu = + sourceRoot.parse(nodeMetaModel.getPackageName(), nodeMetaModel.getTypeName() + ".java"); + ClassOrInterfaceDeclaration nodeCoid = nodeCu.getClassByName(nodeMetaModel.getTypeName()) + .orElseThrow(() -> new AssertionError("Can't find class")); + return new Pair<>(nodeCu, nodeCoid); + } + + /** + * Annotate a method with the {@link Override} annotation, if it overrides other method. + * + * @param nodeMetaModel The current meta model. + * @param methodDeclaration The method declaration. + */ + protected void annotateWhenOverridden(BaseNodeMetaModel nodeMetaModel, MethodDeclaration methodDeclaration) { + Class type = nodeMetaModel.getType(); + Class superClass = type.getSuperclass(); + + boolean isOverriding = Arrays.stream(superClass.getMethods()) + .filter(m -> m.getName().equals(methodDeclaration.getNameAsString())) + .anyMatch(m -> m.getParameters().length + == methodDeclaration.getParameters().size()); + if (isOverriding) { + annotateOverridden(methodDeclaration); + } + } + + protected void after() throws Exception {} + + protected abstract void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) + throws Exception; +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/VisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/VisitorGenerator.java new file mode 100644 index 0000000..7d44f6f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/VisitorGenerator.java @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator; + +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.expr.MarkerAnnotationExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.SourceRoot; +import java.util.Optional; + +/** + * Makes it easier to generate visitor classes. + * It will create missing visit methods on the fly, + * and will ask you to fill in the bodies of the visit methods. + */ +public abstract class VisitorGenerator extends Generator { + private final String pkg; + private final String visitorClassName; + private final String returnType; + private final String argumentType; + private final boolean createMissingVisitMethods; + + protected VisitorGenerator( + SourceRoot sourceRoot, + String pkg, + String visitorClassName, + String returnType, + String argumentType, + boolean createMissingVisitMethods) { + super(sourceRoot); + this.pkg = pkg; + this.visitorClassName = visitorClassName; + this.returnType = returnType; + this.argumentType = argumentType; + this.createMissingVisitMethods = createMissingVisitMethods; + } + + public final void generate() throws Exception { + Log.info("Running %s", () -> getClass().getSimpleName()); + + final CompilationUnit compilationUnit = sourceRoot + .tryToParse(pkg, visitorClassName + ".java") + .getResult() + .get(); + + Optional visitorClassOptional = compilationUnit.getClassByName(visitorClassName); + if (!visitorClassOptional.isPresent()) { + visitorClassOptional = compilationUnit.getInterfaceByName(visitorClassName); + } + final ClassOrInterfaceDeclaration visitorClass = visitorClassOptional.get(); + + JavaParserMetaModel.getNodeMetaModels().stream() + .filter((baseNodeMetaModel) -> !baseNodeMetaModel.isAbstract()) + .forEach(node -> generateVisitMethodForNode(node, visitorClass, compilationUnit)); + after(); + } + + protected void after() throws Exception {} + + private void generateVisitMethodForNode( + BaseNodeMetaModel node, ClassOrInterfaceDeclaration visitorClass, CompilationUnit compilationUnit) { + final Optional existingVisitMethod = visitorClass.getMethods().stream() + .filter(m -> "visit".equals(m.getNameAsString())) + .filter(m -> m.getParameter(0).getType().toString().equals(node.getTypeName())) + .findFirst(); + + if (existingVisitMethod.isPresent()) { + generateVisitMethodBody(node, existingVisitMethod.get(), compilationUnit); + } else if (createMissingVisitMethods) { + MethodDeclaration newVisitMethod = visitorClass + .addMethod("visit") + .addParameter(node.getTypeNameGenerified(), "n") + .addParameter(argumentType, "arg") + .setType(returnType); + if (!visitorClass.isInterface()) { + newVisitMethod + .addAnnotation(new MarkerAnnotationExpr(new Name("Override"))) + .addModifier(PUBLIC); + } + generateVisitMethodBody(node, newVisitMethod, compilationUnit); + } + } + + protected abstract void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit); +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/CoreGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/CoreGenerator.java new file mode 100644 index 0000000..c1bbf4c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/CoreGenerator.java @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.RAW; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.generator.core.node.*; +import com.github.javaparser.generator.core.other.BndGenerator; +import com.github.javaparser.generator.core.other.TokenKindGenerator; +import com.github.javaparser.generator.core.quality.NotNullGenerator; +import com.github.javaparser.generator.core.visitor.*; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.SourceRoot; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * Generates all generated visitors in the javaparser-core module. + * Suggested usage is by running the run_core_generators.sh script. + * You may want to run_metamodel_generator.sh before that. + */ +public class CoreGenerator { + private static final ParserConfiguration parserConfiguration = new ParserConfiguration().setLanguageLevel(RAW) + // .setStoreTokens(false) + // .setAttributeComments(false) + // .setLexicalPreservationEnabled(true) + ; + + public static void main(String[] args) throws Exception { + if (args.length != 1) { + throw new RuntimeException("Need 1 parameter: the JavaParser source checkout root directory."); + } + Log.setAdapter(new Log.StandardOutStandardErrorAdapter()); + final Path root = Paths.get(args[0], "..", "javaparser-core", "src", "main", "java"); + final SourceRoot sourceRoot = new SourceRoot(root, parserConfiguration) + // .setPrinter(LexicalPreservingPrinter::print) + ; + StaticJavaParser.setConfiguration(parserConfiguration); + + final Path generatedJavaCcRoot = + Paths.get(args[0], "..", "javaparser-core", "target", "generated-sources", "javacc"); + final SourceRoot generatedJavaCcSourceRoot = new SourceRoot(generatedJavaCcRoot, parserConfiguration) + // .setPrinter(LexicalPreservingPrinter::print) + ; + + new CoreGenerator().run(sourceRoot, generatedJavaCcSourceRoot); + + sourceRoot.saveAll(); + } + + private void run(SourceRoot sourceRoot, SourceRoot generatedJavaCcSourceRoot) throws Exception { + new TypeCastingGenerator(sourceRoot).generate(); + new GenericListVisitorAdapterGenerator(sourceRoot).generate(); + new GenericVisitorAdapterGenerator(sourceRoot).generate(); + new GenericVisitorWithDefaultsGenerator(sourceRoot).generate(); + new EqualsVisitorGenerator(sourceRoot).generate(); + new ObjectIdentityEqualsVisitorGenerator(sourceRoot).generate(); + new NoCommentEqualsVisitorGenerator(sourceRoot).generate(); + new VoidVisitorAdapterGenerator(sourceRoot).generate(); + new VoidVisitorGenerator(sourceRoot).generate(); + new VoidVisitorWithDefaultsGenerator(sourceRoot).generate(); + new GenericVisitorGenerator(sourceRoot).generate(); + new HashCodeVisitorGenerator(sourceRoot).generate(); + new ObjectIdentityHashCodeVisitorGenerator(sourceRoot).generate(); + new NoCommentHashCodeVisitorGenerator(sourceRoot).generate(); + new CloneVisitorGenerator(sourceRoot).generate(); + new ModifierVisitorGenerator(sourceRoot).generate(); + + new PropertyGenerator(sourceRoot).generate(); + new RemoveMethodGenerator(sourceRoot).generate(); + new ReplaceMethodGenerator(sourceRoot).generate(); + new CloneGenerator(sourceRoot).generate(); + new GetMetaModelGenerator(sourceRoot).generate(); + new MainConstructorGenerator(sourceRoot).generate(); + new NodeModifierGenerator(sourceRoot).generate(); + new AcceptGenerator(sourceRoot).generate(); + new TokenKindGenerator(sourceRoot, generatedJavaCcSourceRoot).generate(); + new BndGenerator(sourceRoot).generate(); + + new NotNullGenerator(sourceRoot).generate(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/AcceptGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/AcceptGenerator.java new file mode 100644 index 0000000..e785ff9 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/AcceptGenerator.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.visitor.GenericVisitor; +import com.github.javaparser.ast.visitor.VoidVisitor; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class AcceptGenerator extends NodeGenerator { + private final MethodDeclaration genericAccept; + private final MethodDeclaration voidAccept; + + public AcceptGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + genericAccept = parseBodyDeclaration( + "@Override public R accept(final GenericVisitor v, final A arg) { return v.visit(this, arg); }") + .asMethodDeclaration(); + voidAccept = parseBodyDeclaration( + "@Override public
void accept(final VoidVisitor v, final A arg) { v.visit(this, arg); }") + .asMethodDeclaration(); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + if (nodeMetaModel.isAbstract()) { + return; + } + nodeCu.addImport(GenericVisitor.class); + nodeCu.addImport(VoidVisitor.class); + addOrReplaceWhenSameSignature(nodeCoid, genericAccept); + addOrReplaceWhenSameSignature(nodeCoid, voidAccept); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/CloneGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/CloneGenerator.java new file mode 100644 index 0000000..954d12a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/CloneGenerator.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.visitor.CloneVisitor; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class CloneGenerator extends NodeGenerator { + public CloneGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + nodeCu.addImport(CloneVisitor.class); + MethodDeclaration cloneMethod = (MethodDeclaration) parseBodyDeclaration(f( + "@Override public %s clone() { return (%s) accept(new CloneVisitor(), null); }", + nodeMetaModel.getTypeNameGenerified(), nodeMetaModel.getTypeNameGenerified())); + addOrReplaceWhenSameSignature(nodeCoid, cloneMethod); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/GetMetaModelGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/GetMetaModelGenerator.java new file mode 100644 index 0000000..37148a6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/GetMetaModelGenerator.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class GetMetaModelGenerator extends NodeGenerator { + public GetMetaModelGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + final MethodDeclaration getMetaModelMethod = (MethodDeclaration) parseBodyDeclaration(f( + "%s public %s getMetaModel() { return JavaParserMetaModel.%s; }", + nodeMetaModel.isRootNode() ? "" : "@Override", + nodeMetaModel.getClass().getSimpleName(), + nodeMetaModel.getMetaModelFieldName())); + + addOrReplaceWhenSameSignature(nodeCoid, getMetaModelMethod); + nodeCu.addImport(nodeMetaModel.getClass().getName()); + nodeCu.addImport(JavaParserMetaModel.class); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/MainConstructorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/MainConstructorGenerator.java new file mode 100644 index 0000000..299b87d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/MainConstructorGenerator.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseExplicitConstructorInvocationStmt; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.TokenRange; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SeparatedItemStringBuilder; +import com.github.javaparser.utils.SourceRoot; + +public class MainConstructorGenerator extends NodeGenerator { + public MainConstructorGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + if (nodeMetaModel.is(Node.class)) { + return; + } + ConstructorDeclaration constructor = new ConstructorDeclaration() + .setPublic(true) + .setName(nodeCoid.getNameAsString()) + .addParameter(TokenRange.class, "tokenRange") + .setJavadocComment("\n * This constructor is used by the parser and is considered private.\n "); + + BlockStmt body = constructor.getBody(); + + SeparatedItemStringBuilder superCall = new SeparatedItemStringBuilder("super(", ", ", ");"); + superCall.append("tokenRange"); + for (PropertyMetaModel parameter : nodeMetaModel.getConstructorParameters()) { + constructor.addParameter(parameter.getTypeNameForSetter(), parameter.getName()); + if (nodeMetaModel.getDeclaredPropertyMetaModels().contains(parameter)) { + body.addStatement(f("%s(%s);", parameter.getSetterMethodName(), parameter.getName())); + } else { + superCall.append(parameter.getName()); + } + } + + body.getStatements().addFirst(parseExplicitConstructorInvocationStmt(superCall.toString())); + + body.addStatement("customInitialization();"); + + addOrReplaceWhenSameSignature(nodeCoid, constructor); + nodeCu.addImport(TokenRange.class); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/NodeModifierGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/NodeModifierGenerator.java new file mode 100644 index 0000000..cb83238 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/NodeModifierGenerator.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class NodeModifierGenerator extends NodeGenerator { + public NodeModifierGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + nodeCoid.setFinal(false).setPublic(true); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/PropertyGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/PropertyGenerator.java new file mode 100644 index 0000000..a2d1d9a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/PropertyGenerator.java @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseType; +import static com.github.javaparser.ast.Modifier.Keyword.FINAL; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static com.github.javaparser.utils.CodeGenerationUtils.f; +import static com.github.javaparser.utils.Utils.camelCaseToScreaming; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.EnumConstantDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.generator.core.utils.CodeUtils; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; +import java.util.*; + +public class PropertyGenerator extends NodeGenerator { + + private final Map declaredProperties = new HashMap<>(); + private final Map derivedProperties = new HashMap<>(); + + public PropertyGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + for (PropertyMetaModel property : nodeMetaModel.getDeclaredPropertyMetaModels()) { + generateGetter(nodeMetaModel, nodeCoid, property); + generateSetter(nodeMetaModel, nodeCoid, property); + } + nodeMetaModel.getDerivedPropertyMetaModels().forEach(p -> derivedProperties.put(p.getName(), p)); + } + + private void generateSetter( + BaseNodeMetaModel nodeMetaModel, ClassOrInterfaceDeclaration nodeCoid, PropertyMetaModel property) { + // Ensure the relevant imports have been added for the methods/annotations used + nodeCoid.findCompilationUnit().get().addImport(ObservableProperty.class); + + final String name = property.getName(); + // Fill body + final String observableName = camelCaseToScreaming(name.startsWith("is") ? name.substring(2) : name); + declaredProperties.put(observableName, property); + + if (property == JavaParserMetaModel.nodeMetaModel.commentPropertyMetaModel) { + // Node.comment has a very specific setter that we shouldn't overwrite. + return; + } + + final MethodDeclaration setter = new MethodDeclaration( + createModifierList(PUBLIC), + parseType(property.getContainingNodeMetaModel().getTypeNameGenerified()), + property.getSetterMethodName()); + annotateWhenOverridden(nodeMetaModel, setter); + if (property.getContainingNodeMetaModel().hasWildcard()) { + setter.setType(parseType("T")); + } + setter.addAndGetParameter(property.getTypeNameForSetter(), property.getName()) + .addModifier(FINAL); + + final BlockStmt body = setter.getBody().get(); + body.getStatements().clear(); + + if (property.isRequired()) { + Class type = property.getType(); + if (property.isNonEmpty() && property.isSingular()) { + nodeCoid.findCompilationUnit() + .get() + .addImport("com.github.javaparser.utils.Utils.assertNonEmpty", true, false); + body.addStatement(f("assertNonEmpty(%s);", name)); + } else if (type != boolean.class && type != int.class) { + nodeCoid.findCompilationUnit() + .get() + .addImport("com.github.javaparser.utils.Utils.assertNotNull", true, false); + body.addStatement(f("assertNotNull(%s);", name)); + } + } + + // Check if the new value is the same as the old value + String returnValue = CodeUtils.castValue("this", setter.getType(), nodeMetaModel.getTypeName()); + body.addStatement(f("if (%s == this.%s) { return %s; }", name, name, returnValue)); + + body.addStatement(f("notifyPropertyChange(ObservableProperty.%s, this.%s, %s);", observableName, name, name)); + if (property.isNode()) { + body.addStatement(f("if (this.%s != null) this.%s.setParentNode(null);", name, name)); + } + body.addStatement(f("this.%s = %s;", name, name)); + if (property.isNode()) { + body.addStatement(f("setAsParentNodeOf(%s);", name)); + } + if (property.getContainingNodeMetaModel().hasWildcard()) { + body.addStatement(f("return (T) this;")); + } else { + body.addStatement(f("return this;")); + } + addOrReplaceWhenSameSignature(nodeCoid, setter); + if (property.getContainingNodeMetaModel().hasWildcard()) { + annotateSuppressWarnings(setter); + } + } + + private void generateGetter( + BaseNodeMetaModel nodeMetaModel, ClassOrInterfaceDeclaration nodeCoid, PropertyMetaModel property) { + final MethodDeclaration getter = new MethodDeclaration( + createModifierList(PUBLIC), parseType(property.getTypeNameForGetter()), property.getGetterMethodName()); + annotateWhenOverridden(nodeMetaModel, getter); + final BlockStmt body = getter.getBody().get(); + body.getStatements().clear(); + if (property.isOptional()) { + // Ensure imports have been included. + nodeCoid.findCompilationUnit().get().addImport(Optional.class); + body.addStatement(f("return Optional.ofNullable(%s);", property.getName())); + } else { + body.addStatement(f("return %s;", property.getName())); + } + addOrReplaceWhenSameSignature(nodeCoid, getter); + } + + private void generateObservableProperty( + EnumDeclaration observablePropertyEnum, PropertyMetaModel property, boolean derived) { + boolean isAttribute = !Node.class.isAssignableFrom(property.getType()); + String name = property.getName(); + String constantName = camelCaseToScreaming(name.startsWith("is") ? name.substring(2) : name); + EnumConstantDeclaration enumConstantDeclaration = observablePropertyEnum.addEnumConstant(constantName); + if (isAttribute) { + enumConstantDeclaration.addArgument("Type.SINGLE_ATTRIBUTE"); + } else { + if (property.isNodeList()) { + enumConstantDeclaration.addArgument("Type.MULTIPLE_REFERENCE"); + } else { + enumConstantDeclaration.addArgument("Type.SINGLE_REFERENCE"); + } + } + if (derived) { + enumConstantDeclaration.addArgument("true"); + } + } + + @Override + protected void after() throws Exception { + CompilationUnit observablePropertyCu = sourceRoot + .tryToParse("com.github.javaparser.ast.observer", "ObservableProperty.java") + .getResult() + .get(); + EnumDeclaration observablePropertyEnum = + observablePropertyCu.getEnumByName("ObservableProperty").get(); + observablePropertyEnum.getEntries().clear(); + List observablePropertyNames = new LinkedList<>(declaredProperties.keySet()); + observablePropertyNames.sort(String::compareTo); + for (String propName : observablePropertyNames) { + generateObservableProperty(observablePropertyEnum, declaredProperties.get(propName), false); + } + List derivedPropertyNames = new LinkedList<>(derivedProperties.keySet()); + derivedPropertyNames.sort(String::compareTo); + for (String propName : derivedPropertyNames) { + generateObservableProperty(observablePropertyEnum, derivedProperties.get(propName), true); + } + observablePropertyEnum.addEnumConstant("RANGE"); + observablePropertyEnum.addEnumConstant("COMMENTED_NODE"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/RemoveMethodGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/RemoveMethodGenerator.java new file mode 100644 index 0000000..7da4ccd --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/RemoveMethodGenerator.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static com.github.javaparser.utils.CodeGenerationUtils.f; +import static com.github.javaparser.utils.Utils.capitalize; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class RemoveMethodGenerator extends NodeGenerator { + public RemoveMethodGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + MethodDeclaration removeNodeMethod = + (MethodDeclaration) parseBodyDeclaration("public boolean remove(Node node) {}"); + nodeCu.addImport(Node.class); + annotateWhenOverridden(nodeMetaModel, removeNodeMethod); + + final BlockStmt body = removeNodeMethod.getBody().get(); + + body.addStatement("if (node == null) { return false; }"); + int numberPropertiesDeclared = 0; + for (PropertyMetaModel property : nodeMetaModel.getDeclaredPropertyMetaModels()) { + if (!property.isNode()) { + continue; + } + String check; + if (property.isNodeList()) { + check = nodeListCheck(property); + } else { + if (property.isRequired()) { + continue; + } + String removeAttributeMethodName = generateRemoveMethodForAttribute(nodeCoid, nodeMetaModel, property); + check = attributeCheck(property, removeAttributeMethodName); + } + if (property.isOptional()) { + check = f("if (%s != null) { %s }", property.getName(), check); + } + body.addStatement(check); + numberPropertiesDeclared++; + } + if (nodeMetaModel.getSuperNodeMetaModel().isPresent()) { + body.addStatement("return super.remove(node);"); + } else { + body.addStatement("return false;"); + } + + if (!nodeMetaModel.isRootNode() && numberPropertiesDeclared == 0) { + removeMethodWithSameSignature(nodeCoid, removeNodeMethod); + } else { + addOrReplaceWhenSameSignature(nodeCoid, removeNodeMethod); + } + } + + private String attributeCheck(PropertyMetaModel property, String removeAttributeMethodName) { + return f( + "if (node == %s) {" + " %s();" + " return true;\n" + "}", + property.getName(), removeAttributeMethodName); + } + + private String nodeListCheck(PropertyMetaModel property) { + return f( + "for (int i = 0; i < %s.size(); i++) {" + " if (%s.get(i) == node) {" + + " %s.remove(i);" + + " return true;" + + " }" + + "}", + property.getName(), property.getName(), property.getName()); + } + + private String generateRemoveMethodForAttribute( + ClassOrInterfaceDeclaration nodeCoid, BaseNodeMetaModel nodeMetaModel, PropertyMetaModel property) { + final String methodName = "remove" + capitalize(property.getName()); + final MethodDeclaration removeMethod = (MethodDeclaration) + parseBodyDeclaration(f("public %s %s() {}", nodeMetaModel.getTypeName(), methodName)); + + final BlockStmt block = removeMethod.getBody().get(); + block.addStatement(f("return %s((%s) null);", property.getSetterMethodName(), property.getTypeNameForSetter())); + + addOrReplaceWhenSameSignature(nodeCoid, removeMethod); + return methodName; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/ReplaceMethodGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/ReplaceMethodGenerator.java new file mode 100644 index 0000000..e0f2e5f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/ReplaceMethodGenerator.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class ReplaceMethodGenerator extends NodeGenerator { + public ReplaceMethodGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { + MethodDeclaration replaceNodeMethod = + (MethodDeclaration) parseBodyDeclaration("public boolean replace(Node node, Node replacementNode) {}"); + nodeCu.addImport(Node.class); + annotateWhenOverridden(nodeMetaModel, replaceNodeMethod); + + final BlockStmt body = replaceNodeMethod.getBody().get(); + + body.addStatement("if (node == null) { return false; }"); + + int numberPropertiesDeclared = 0; + for (PropertyMetaModel property : nodeMetaModel.getDeclaredPropertyMetaModels()) { + if (!property.isNode()) { + continue; + } + String check; + if (property.isNodeList()) { + check = nodeListCheck(property); + } else { + check = attributeCheck(property, property.getSetterMethodName()); + } + if (property.isOptional()) { + check = f("if (%s != null) { %s }", property.getName(), check); + } + body.addStatement(check); + numberPropertiesDeclared++; + } + if (nodeMetaModel.getSuperNodeMetaModel().isPresent()) { + body.addStatement("return super.replace(node, replacementNode);"); + } else { + body.addStatement("return false;"); + } + + if (!nodeMetaModel.isRootNode() && numberPropertiesDeclared == 0) { + removeMethodWithSameSignature(nodeCoid, replaceNodeMethod); + } else { + addOrReplaceWhenSameSignature(nodeCoid, replaceNodeMethod); + } + } + + private String attributeCheck(PropertyMetaModel property, String attributeSetterName) { + return f( + "if (node == %s) {" + " %s((%s) replacementNode);" + " return true;\n" + "}", + property.getName(), attributeSetterName, property.getTypeName()); + } + + private String nodeListCheck(PropertyMetaModel property) { + return f( + "for (int i = 0; i < %s.size(); i++) {" + " if (%s.get(i) == node) {" + + " %s.set(i, (%s) replacementNode);" + + " return true;" + + " }" + + "}", + property.getName(), property.getName(), property.getName(), property.getTypeName()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/TypeCastingGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/TypeCastingGenerator.java new file mode 100644 index 0000000..1be5c50 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/node/TypeCastingGenerator.java @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.node; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static com.github.javaparser.utils.CodeGenerationUtils.f; +import static com.github.javaparser.utils.Utils.set; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.generator.NodeGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.utils.Pair; +import com.github.javaparser.utils.SourceRoot; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; + +public class TypeCastingGenerator extends NodeGenerator { + private final Set baseNodes = set( + JavaParserMetaModel.statementMetaModel, + JavaParserMetaModel.expressionMetaModel, + JavaParserMetaModel.typeMetaModel, + JavaParserMetaModel.moduleDirectiveMetaModel, + JavaParserMetaModel.bodyDeclarationMetaModel, + JavaParserMetaModel.commentMetaModel); + + public TypeCastingGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + protected void generateNode( + BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) + throws Exception { + Pair baseCode = null; + for (BaseNodeMetaModel baseNode : baseNodes) { + if (nodeMetaModel == baseNode) { + // We adjust the base models from the child nodes, + // so we don't do anything when we *are* the base model. + return; + } + if (nodeMetaModel.isInstanceOfMetaModel(baseNode)) { + baseCode = parseNode(baseNode); + } + } + + if (baseCode == null) { + // Node is not a child of one of the base nodes, so we don't want to generate this method for it. + return; + } + + final String typeName = nodeMetaModel.getTypeName(); + final ClassOrInterfaceDeclaration baseCoid = baseCode.b; + final CompilationUnit baseCu = baseCode.a; + + generateIsType(nodeMetaModel, baseCu, nodeCoid, baseCoid, typeName); + generateAsType(nodeMetaModel, baseCu, nodeCoid, baseCoid, typeName); + generateToType(nodeMetaModel, nodeCu, baseCu, nodeCoid, baseCoid, typeName); + generateIfType(nodeMetaModel, nodeCu, baseCu, nodeCoid, baseCoid, typeName); + } + + private void generateAsType( + BaseNodeMetaModel nodeMetaModel, + CompilationUnit baseCu, + ClassOrInterfaceDeclaration nodeCoid, + ClassOrInterfaceDeclaration baseCoid, + String typeName) { + baseCu.addImport("com.github.javaparser.utils.CodeGenerationUtils.f", true, false); + + final MethodDeclaration asTypeBaseMethod = (MethodDeclaration) parseBodyDeclaration(f( + "public %s as%s() { throw new IllegalStateException(f(\"%%s is not %s, it is %%s\", this, this.getClass().getSimpleName())); }", + typeName, typeName, typeName)); + final MethodDeclaration asTypeNodeMethod = (MethodDeclaration) + parseBodyDeclaration(f("@Override public %s as%s() { return this; }", typeName, typeName)); + + annotateWhenOverridden(nodeMetaModel, asTypeNodeMethod); + + addOrReplaceWhenSameSignature(baseCoid, asTypeBaseMethod); + addOrReplaceWhenSameSignature(nodeCoid, asTypeNodeMethod); + } + + private void generateToType( + BaseNodeMetaModel nodeMetaModel, + CompilationUnit nodeCu, + CompilationUnit baseCu, + ClassOrInterfaceDeclaration nodeCoid, + ClassOrInterfaceDeclaration baseCoid, + String typeName) { + baseCu.addImport(Optional.class); + nodeCu.addImport(Optional.class); + + final MethodDeclaration toTypeBaseMethod = (MethodDeclaration) parseBodyDeclaration( + f("public Optional<%s> to%s() { return Optional.empty(); }", typeName, typeName, typeName)); + final MethodDeclaration toTypeNodeMethod = (MethodDeclaration) parseBodyDeclaration( + f("@Override public Optional<%s> to%s() { return Optional.of(this); }", typeName, typeName)); + + annotateWhenOverridden(nodeMetaModel, toTypeNodeMethod); + + addOrReplaceWhenSameSignature(baseCoid, toTypeBaseMethod); + addOrReplaceWhenSameSignature(nodeCoid, toTypeNodeMethod); + } + + private void generateIfType( + BaseNodeMetaModel nodeMetaModel, + CompilationUnit nodeCu, + CompilationUnit baseCu, + ClassOrInterfaceDeclaration nodeCoid, + ClassOrInterfaceDeclaration baseCoid, + String typeName) { + baseCu.addImport(Consumer.class); + nodeCu.addImport(Consumer.class); + + final MethodDeclaration ifTypeBaseMethod = (MethodDeclaration) + parseBodyDeclaration(f("public void if%s(Consumer<%s> action) { }", typeName, typeName)); + final MethodDeclaration ifTypeNodeMethod = (MethodDeclaration) parseBodyDeclaration( + f("public void if%s(Consumer<%s> action) { action.accept(this); }", typeName, typeName)); + + annotateWhenOverridden(nodeMetaModel, ifTypeNodeMethod); + + addOrReplaceWhenSameSignature(baseCoid, ifTypeBaseMethod); + addOrReplaceWhenSameSignature(nodeCoid, ifTypeNodeMethod); + } + + private void generateIsType( + BaseNodeMetaModel nodeMetaModel, + CompilationUnit baseCu, + ClassOrInterfaceDeclaration nodeCoid, + ClassOrInterfaceDeclaration baseCoid, + String typeName) { + final MethodDeclaration baseIsTypeMethod = + (MethodDeclaration) parseBodyDeclaration(f("public boolean is%s() { return false; }", typeName)); + final MethodDeclaration overriddenIsTypeMethod = (MethodDeclaration) + parseBodyDeclaration(f("@Override public boolean is%s() { return true; }", typeName)); + + annotateWhenOverridden(nodeMetaModel, overriddenIsTypeMethod); + + addOrReplaceWhenSameSignature(nodeCoid, overriddenIsTypeMethod); + addOrReplaceWhenSameSignature(baseCoid, baseIsTypeMethod); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/BndGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/BndGenerator.java new file mode 100644 index 0000000..fa12beb --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/BndGenerator.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.other; + +import com.github.javaparser.generator.Generator; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.SourceRoot; +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; + +/** + * Generates the bnd.bnd file in javaparser-core. + */ +public class BndGenerator extends Generator { + + public BndGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + public void generate() throws IOException { + Log.info("Running %s", () -> getClass().getSimpleName()); + Path root = sourceRoot.getRoot(); + Path projectRoot = root.getParent().getParent().getParent(); + String lineSeparator = System.getProperty("line.separator"); + try (Stream stream = Files.walk(root)) { + String packagesList = stream.filter(Files::isRegularFile) + .map(path -> getPackageName(root, path)) + .distinct() + .sorted() + .reduce( + null, + (packageList, packageName) -> concatPackageName(packageName, packageList, lineSeparator)); + Path output = projectRoot.resolve("bnd.bnd"); + try (Writer writer = Files.newBufferedWriter(output)) { + Path templateFile = projectRoot.resolve("bnd.bnd.template"); + String template = new String(Files.readAllBytes(templateFile), StandardCharsets.UTF_8); + writer.write(template.replace("{exportedPackages}", packagesList)); + } + Log.info("Written " + output); + } + } + + private String concatPackageName(String packageName, String packageList, String lineSeparator) { + return (packageList == null ? ("\\" + lineSeparator) : (packageList + ", \\" + lineSeparator)) + " " + + packageName; + } + + private static String getPackageName(Path root, Path path) { + return root.relativize(path.getParent()).toString().replace(File.separatorChar, '.'); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/GrammarLetterGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/GrammarLetterGenerator.java new file mode 100644 index 0000000..cabb843 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/GrammarLetterGenerator.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.other; + +import java.util.function.Function; + +/** + * Prints the LETTER and PART_LETTER tokens. They should be inserted into the grammar manually. + */ +public class GrammarLetterGenerator { + public static void main(String[] args) { + generate( + "LETTER", + c -> Character.isJavaIdentifierStart(c) + || Character.isHighSurrogate((char) (int) c) + || Character.isLowSurrogate((char) (int) c)); + generate( + "PART_LETTER", + c -> Character.isJavaIdentifierPart(c) + || Character.isHighSurrogate((char) (int) c) + || Character.isLowSurrogate((char) (int) c)); + } + + private static void generate(String tokenName, Function f) { + final String indent = " "; + System.out.println(" < #" + tokenName + ": ["); + System.out.print(indent); + int nltime = 0; + int i = 0; + while (i < 0x10000) { + while (!f.apply(i) && i < 0x10000) { + i++; + } + String start = format(i); + while (f.apply(i) && i < 0x10000) { + i++; + } + String end = format(i - 1); + if (i >= 0x10000) { + break; + } + if (start.equals(end)) { + nltime++; + System.out.print(start + ", "); + } else { + nltime += 2; + System.out.print(start + "-" + end + ", "); + } + if (nltime >= 10) { + nltime = 0; + System.out.println(); + System.out.print(indent); + } + } + // Too lazy to remove the final illegal comma. + System.out.println("]"); + System.out.println(" | "); + System.out.println(" >"); + } + + private static String format(int i) { + return String.format("\"\\u%04x\"", i); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/TokenKindGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/TokenKindGenerator.java new file mode 100644 index 0000000..b4a6b90 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/TokenKindGenerator.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.other; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.EnumConstantDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.stmt.SwitchEntry; +import com.github.javaparser.ast.stmt.SwitchStmt; +import com.github.javaparser.generator.Generator; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates the TokenKind enum from {@link com.github.javaparser.GeneratedJavaParserConstants} + */ +public class TokenKindGenerator extends Generator { + private final SourceRoot generatedJavaCcSourceRoot; + + public TokenKindGenerator(SourceRoot sourceRoot, SourceRoot generatedJavaCcSourceRoot) { + super(sourceRoot); + this.generatedJavaCcSourceRoot = generatedJavaCcSourceRoot; + } + + @Override + public void generate() { + Log.info("Running %s", () -> getClass().getSimpleName()); + + final CompilationUnit javaTokenCu = sourceRoot.parse("com.github.javaparser", "JavaToken.java"); + final ClassOrInterfaceDeclaration javaToken = javaTokenCu + .getClassByName("JavaToken") + .orElseThrow(() -> new AssertionError("Can't find class in java file.")); + final EnumDeclaration kindEnum = javaToken + .findFirst(EnumDeclaration.class, e -> "Kind".equals(e.getNameAsString())) + .orElseThrow(() -> new AssertionError("Can't find class in java file.")); + + kindEnum.getEntries().clear(); + annotateGenerated(kindEnum); + + final SwitchStmt valueOfSwitch = kindEnum.findFirst(SwitchStmt.class) + .orElseThrow(() -> new AssertionError("Can't find valueOf switch.")); + valueOfSwitch.findAll(SwitchEntry.class).stream() + .filter(e -> e.getLabels().isNonEmpty()) + .forEach(Node::remove); + + final CompilationUnit constantsCu = + generatedJavaCcSourceRoot.parse("com.github.javaparser", "GeneratedJavaParserConstants.java"); + final ClassOrInterfaceDeclaration constants = constantsCu + .getInterfaceByName("GeneratedJavaParserConstants") + .orElseThrow(() -> new AssertionError("Can't find class in java file.")); + for (BodyDeclaration member : constants.getMembers()) { + member.toFieldDeclaration() + .filter(field -> { + String javadoc = field.getJavadocComment().get().getContent(); + return javadoc.contains("RegularExpression Id") || javadoc.contains("End of File"); + }) + .map(field -> field.getVariable(0)) + .ifPresent(var -> { + final String name = var.getNameAsString(); + final IntegerLiteralExpr kind = + var.getInitializer().get().asIntegerLiteralExpr(); + generateEnumEntry(kindEnum, name, kind); + generateValueOfEntry(valueOfSwitch, name, kind); + }); + } + } + + private void generateValueOfEntry(SwitchStmt valueOfSwitch, String name, IntegerLiteralExpr kind) { + final SwitchEntry entry = new SwitchEntry( + new NodeList<>(kind), + SwitchEntry.Type.STATEMENT_GROUP, + new NodeList<>(new ReturnStmt(name)), + false, + null); + valueOfSwitch.getEntries().addFirst(entry); + } + + private void generateEnumEntry(EnumDeclaration kindEnum, String name, IntegerLiteralExpr kind) { + final EnumConstantDeclaration enumEntry = new EnumConstantDeclaration(name); + enumEntry.getArguments().add(kind); + kindEnum.addEntry(enumEntry); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/quality/NotNullGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/quality/NotNullGenerator.java new file mode 100644 index 0000000..4b59215 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/quality/NotNullGenerator.java @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.quality; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.CallableDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.AnnotationExpr; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.generator.CompilationUnitGenerator; +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Preconditions; +import com.github.javaparser.utils.SourceRoot; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +/** + * Generator to process annotations {@link com.github.javaparser.quality.NotNull}. + */ +public class NotNullGenerator extends CompilationUnitGenerator { + + public NotNullGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + @Override + public void generateCompilationUnit(CompilationUnit compilationUnit) { + compilationUnit.findAll(ConstructorDeclaration.class).forEach(this::generateQualityForConstructor); + compilationUnit.findAll(MethodDeclaration.class).forEach(this::generateQualityForMethod); + } + + /** + * Generate the pre conditions based on the method parameters. + *
+ * If parameters are annotated with {@link com.github.javaparser.quality.NotNull} and a {@code null} is + * passed, the method should throw an {@link IllegalArgumentException}. + *
+ * If annotated with {@link com.github.javaparser.quality.Nullable}, other annotation or none, nothing should be + * changed. + * + * @param methodDeclaration The method declaration to generate. + */ + protected void generateQualityForMethod(MethodDeclaration methodDeclaration) { + methodDeclaration + .getBody() + .ifPresent(blockStmt -> + generateQualityForParameter(methodDeclaration, methodDeclaration.getParameters(), blockStmt)); + } + + /** + * Generate the pre conditions based on the constructor parameters. + *
+ * If parameters are annotated with {@link com.github.javaparser.quality.NotNull} and a {@code null} is + * passed, the method should throw an {@link IllegalArgumentException}. + *
+ * If annotated with {@link com.github.javaparser.quality.Nullable}, other annotation or none, nothing should be + * changed. + * + * @param constructorDeclaration The constructor declaration to generate. + */ + protected void generateQualityForConstructor(ConstructorDeclaration constructorDeclaration) { + generateQualityForParameter( + constructorDeclaration, constructorDeclaration.getParameters(), constructorDeclaration.getBody()); + } + + /** + * Generate the pre conditions for the parameters. + *
+ * If parameters are annotated with {@link com.github.javaparser.quality.NotNull} and a {@code null} is + * passed, the method should throw an {@link IllegalArgumentException}. + *
+ * If annotated with {@link com.github.javaparser.quality.Nullable}, other annotation or none, nothing should be + * changed. + * + * @param callableDeclaration The declaration where the parameters belong. + * @param parameters The list of parameters. + * @param blockStmt The block where the assertions should be added. + * + * @param The callable declaration type. + */ + protected > void generateQualityForParameter( + N callableDeclaration, NodeList parameters, BlockStmt blockStmt) { + + List assertions = new ArrayList<>(); + + for (Parameter parameter : parameters) { + Optional nonNullAnnotation = parameter.getAnnotationByClass(NotNull.class); + if (nonNullAnnotation.isPresent()) { + assertions.add(createAssertion(parameter)); + } + } + + insertAssertionsInBlock(callableDeclaration, blockStmt, assertions); + } + + /** + * Create assertion for the parameters. + * + * @param parameter The parameter to create the assertion. + * + * @return The assertion to be added to the code. + */ + private Statement createAssertion(Parameter parameter) { + + parameter.tryAddImportToParentCompilationUnit(Preconditions.class); + return StaticJavaParser.parseStatement(f( + "Preconditions.checkNotNull(%s, \"Parameter %s can't be null.\");", + parameter.getNameAsString(), parameter.getNameAsString())); + } + + /** + * Insert the assertions into the block. + * + * @param callableDeclaration The declaration where the parameters belong. + * @param blockStmt The block where the assertions should be added. + * @param assertions The list of assertions to be inserted. + * + * @param The callable declaration type. + */ + private > void insertAssertionsInBlock( + N callableDeclaration, BlockStmt blockStmt, List assertions) { + + // If there's nothing to add, just ignore + if (assertions.isEmpty()) return; + + int position = 0; + NodeList statements = blockStmt.getStatements(); + + // When the callable is a constructor we must check if is a ExplicitConstructorInvocationStmt. + if (callableDeclaration.isConstructorDeclaration()) { + Optional optionalFirstStatement = statements.getFirst(); + if (optionalFirstStatement.isPresent()) { + + // Check if the first item is a "super" expr. If it's then we add the assertions after it. + Statement firstStatement = optionalFirstStatement.get(); + if (firstStatement instanceof ExplicitConstructorInvocationStmt) { + position = 1; + } + } + } + + // Register assertions + for (int i = 0; i < assertions.size(); i++) { + Statement assertion = assertions.get(i); + + Optional optOldStmt = getSimilarAssertionInBlock(assertion, blockStmt); + + if (optOldStmt.isPresent()) { + optOldStmt.get().replace(assertion); + } else { + blockStmt.addStatement(position + i, assertion); + } + } + } + + private Optional getSimilarAssertionInBlock(Statement assertion, BlockStmt blockStmt) { + + MethodCallExpr assertionCall = + assertion.asExpressionStmt().getExpression().asMethodCallExpr(); + List methodCallExpressions = blockStmt.findAll(MethodCallExpr.class); + + for (MethodCallExpr blockMethodCall : methodCallExpressions) { + + // Check if the method calls name match + if (blockMethodCall.getNameAsExpression().equals(assertionCall.getNameAsExpression()) + && blockMethodCall.getScope().equals(assertionCall.getScope()) + && blockMethodCall.getArguments().size() == 2 + && blockMethodCall.getArguments().get(0).equals(assertionCall.getArgument(0))) { + return blockMethodCall.findAncestor(ExpressionStmt.class); + } + } + // TODO: + return Optional.empty(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/utils/CodeUtils.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/utils/CodeUtils.java new file mode 100644 index 0000000..b1e7231 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/utils/CodeUtils.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.utils; + +import com.github.javaparser.ast.type.Type; + +public final class CodeUtils { + + private CodeUtils() { + // This constructor is used to hide the public one + } + + /** + * Cast the value if the current type doesn't match the required type. + *
+ * Given the following example: + * + * int withoutCast = 1; + * double withCast = (double) 1; + * + * The variable withoutCast doesn't need to be casted, since we have int as required type and int as value type. + * While in the variable withCast we have double as required type and int as value type. + * + * @param value The value to be returned. + * @param requiredType The expected type to be casted if needed. + * @param valueType The type of the value to be returned. + * + * @return The value casted if needed. + */ + public static String castValue(String value, Type requiredType, String valueType) { + String requiredTypeName = requiredType.asString(); + + if (requiredTypeName.equals(valueType)) return value; + return String.format("(%s) %s", requiredTypeName, value); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/CloneVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/CloneVisitorGenerator.java new file mode 100644 index 0000000..60e06c4 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/CloneVisitorGenerator.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.CompilationUnitMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SeparatedItemStringBuilder; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's CloneVisitor. + */ +public class CloneVisitorGenerator extends VisitorGenerator { + public CloneVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "CloneVisitor", "Visitable", "Object", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + for (PropertyMetaModel field : node.getAllPropertyMetaModels()) { + final String getter = field.getGetterMethodName() + "()"; + if (field.getNodeReference().isPresent()) { + if (field.isOptional() && field.isNodeList()) { + body.addStatement(f( + "NodeList<%s> %s = cloneList(n.%s.orElse(null), arg);", + field.getTypeNameGenerified(), field.getName(), getter)); + } else if (field.isNodeList()) { + body.addStatement(f( + "NodeList<%s> %s = cloneList(n.%s, arg);", + field.getTypeNameGenerified(), field.getName(), getter)); + } else { + body.addStatement( + f("%s %s = cloneNode(n.%s, arg);", field.getTypeNameGenerified(), field.getName(), getter)); + } + } + } + + SeparatedItemStringBuilder builder = new SeparatedItemStringBuilder( + f("%s r = new %s(", node.getTypeNameGenerified(), node.getTypeNameGenerified()), ",", ");"); + builder.append("n.getTokenRange().orElse(null)"); + for (PropertyMetaModel field : node.getConstructorParameters()) { + if ("comment".equals(field.getName())) { + continue; + } + if (field.getNodeReference().isPresent()) { + builder.append(field.getName()); + } else { + builder.append(f("n.%s()", field.getGetterMethodName())); + } + } + + body.addStatement(builder.toString()); + if (node instanceof CompilationUnitMetaModel) { + body.addStatement("n.getStorage().ifPresent(s -> r.setStorage(s.getPath(), s.getEncoding()));"); + } + body.addStatement("r.setComment(comment);"); + body.addStatement("n.getOrphanComments().stream().map(Comment::clone).forEach(r::addOrphanComment);"); + body.addStatement("copyData(n, r);"); + body.addStatement("return r;"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/EqualsVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/EqualsVisitorGenerator.java new file mode 100644 index 0000000..98a7031 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/EqualsVisitorGenerator.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's EqualsVisitor. + */ +public class EqualsVisitorGenerator extends VisitorGenerator { + public EqualsVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "EqualsVisitor", "Boolean", "Visitable", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + body.addStatement(f("final %s n2 = (%s) arg;", node.getTypeName(), node.getTypeName())); + + for (PropertyMetaModel field : node.getAllPropertyMetaModels()) { + final String getter = field.getGetterMethodName() + "()"; + if (field.getNodeReference().isPresent()) { + if (field.isNodeList()) { + body.addStatement(f("if (!nodesEquals(n.%s, n2.%s)) return false;", getter, getter)); + } else { + body.addStatement(f("if (!nodeEquals(n.%s, n2.%s)) return false;", getter, getter)); + } + } else { + body.addStatement(f("if (!objEquals(n.%s, n2.%s)) return false;", getter, getter)); + } + } + if (body.getStatements().size() == 1) { + // Only the cast line was added, but nothing is using it, so remove it again. + body.getStatements().clear(); + } + body.addStatement("return true;"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericListVisitorAdapterGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericListVisitorAdapterGenerator.java new file mode 100644 index 0000000..dd6668b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericListVisitorAdapterGenerator.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Generates JavaParser's GenericListVisitorAdapter. + */ +public class GenericListVisitorAdapterGenerator extends VisitorGenerator { + public GenericListVisitorAdapterGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "GenericListVisitorAdapter", "List", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + body.addStatement("List result = new ArrayList<>();"); + body.addStatement("List tmp;"); + + final String resultCheck = "if (tmp != null) result.addAll(tmp);"; + + for (PropertyMetaModel field : node.getAllPropertyMetaModels()) { + final String getter = field.getGetterMethodName() + "()"; + if (field.getNodeReference().isPresent()) { + if (field.isOptional()) { + body.addStatement(f( + "if (n.%s.isPresent()) {" + " tmp = n.%s.get().accept(this, arg);" + " %s" + "}", + getter, getter, resultCheck)); + } else { + body.addStatement(f("{ tmp = n.%s.accept(this, arg); %s }", getter, resultCheck)); + } + } + } + body.addStatement("return result;"); + Arrays.stream(new Class[] {List.class, ArrayList.class}) + .filter(c -> compilationUnit.getImports().stream() + .noneMatch(i -> c.getName().equals(i.getName().asString()))) + .forEach(compilationUnit::addImport); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorAdapterGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorAdapterGenerator.java new file mode 100644 index 0000000..302e52a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorAdapterGenerator.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's VoidVisitorAdapter. + */ +public class GenericVisitorAdapterGenerator extends VisitorGenerator { + public GenericVisitorAdapterGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "GenericVisitorAdapter", "R", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + body.addStatement("R result;"); + + final String resultCheck = "if (result != null) return result;"; + + for (PropertyMetaModel field : node.getAllPropertyMetaModels()) { + final String getter = field.getGetterMethodName() + "()"; + if (field.getNodeReference().isPresent()) { + if (field.isOptional()) { + body.addStatement(f( + "if (n.%s.isPresent()) {" + " result = n.%s.get().accept(this, arg);" + " %s" + "}", + getter, getter, resultCheck)); + } else { + body.addStatement(f("{ result = n.%s.accept(this, arg); %s }", getter, resultCheck)); + } + } + } + body.addStatement("return null;"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorGenerator.java new file mode 100644 index 0000000..29be139 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorGenerator.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's GenericVisitor. + */ +public class GenericVisitorGenerator extends VisitorGenerator { + public GenericVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "GenericVisitor", "R", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(false)); + + visitMethod.setBody(null); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorWithDefaultsGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorWithDefaultsGenerator.java new file mode 100644 index 0000000..8af1cf7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/GenericVisitorWithDefaultsGenerator.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's GenericVisitorWithDefaults. + */ +public class GenericVisitorWithDefaultsGenerator extends VisitorGenerator { + public GenericVisitorWithDefaultsGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "GenericVisitorWithDefaults", "R", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + body.addStatement("return defaultAction(n, arg);"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/HashCodeVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/HashCodeVisitorGenerator.java new file mode 100644 index 0000000..d6b4ee6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/HashCodeVisitorGenerator.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.StaticJavaParser.parseStatement; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SeparatedItemStringBuilder; +import com.github.javaparser.utils.SourceRoot; +import java.util.List; + +/** + * Generates JavaParser's HashCodeVisitor. + */ +public class HashCodeVisitorGenerator extends VisitorGenerator { + public HashCodeVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "HashCodeVisitor", "Integer", "Void", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + final BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + final SeparatedItemStringBuilder builder = new SeparatedItemStringBuilder("return ", "* 31 +", ";"); + final List propertyMetaModels = node.getAllPropertyMetaModels(); + if (propertyMetaModels.isEmpty()) { + builder.append("0"); + } else { + for (PropertyMetaModel field : propertyMetaModels) { + final String getter = field.getGetterMethodName() + "()"; + // Is this field another AST node? Visit it. + if (field.getNodeReference().isPresent()) { + if (field.isOptional()) { + builder.append("(n.%s.isPresent()? n.%s.get().accept(this, arg):0)", getter, getter); + } else { + builder.append("(n.%s.accept(this, arg))", getter); + } + } else { + Class type = field.getType(); + if (type.equals(boolean.class)) { + builder.append("(n.%s?1:0)", getter); + } else if (type.equals(int.class)) { + builder.append("n.%s", getter); + } else { + builder.append("(n.%s.hashCode())", getter); + } + } + } + } + body.addStatement(parseStatement(builder.toString())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ModifierVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ModifierVisitorGenerator.java new file mode 100644 index 0000000..5ff2243 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ModifierVisitorGenerator.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.expr.BinaryExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SeparatedItemStringBuilder; +import com.github.javaparser.utils.SourceRoot; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +public class ModifierVisitorGenerator extends VisitorGenerator { + public ModifierVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "ModifierVisitor", "Visitable", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + // FIXME: Bit of a hacky way to get this fixed order, and then have everything else (note this list is reversed) + List order = Arrays.asList( + // "comment", "name", "members", "parameters", "name", + "modifiers", "annotations"); + List sortedPropertyMetaModels = node.getAllPropertyMetaModels().stream() + .sorted( + Comparator.comparingInt((PropertyMetaModel o) -> order.indexOf(o.getName())) + .reversed() + // .thenComparing(PropertyMetaModel::getName) + ) + .collect(Collectors.toList()); + + // + sortedPropertyMetaModels.forEach(property -> extracted(body, property)); + + // + if (node.is(BinaryExpr.class)) { + body.addStatement("if (left == null) return right;"); + body.addStatement("if (right == null) return left;"); + } else { + final SeparatedItemStringBuilder collapseCheck = + new SeparatedItemStringBuilder("if(", "||", ") return null;"); + sortedPropertyMetaModels.forEach(property -> { + if (property.isRequired() && property.isNode()) { + if (property.isNodeList()) { + if (property.isNonEmpty()) { + collapseCheck.append(f("%s.isEmpty()", property.getName())); + } + } else { + collapseCheck.append(f("%s==null", property.getName())); + } + } + }); + if (collapseCheck.hasItems()) { + body.addStatement(collapseCheck.toString()); + } + } + + // + sortedPropertyMetaModels.forEach(property -> { + if (property.isNode()) { + body.addStatement(f("n.%s(%s);", property.getSetterMethodName(), property.getName())); + } + }); + + // + body.addStatement("return n;"); + } + + private void extracted(BlockStmt body, PropertyMetaModel property) { + if (property.isNode()) { + if (property.isNodeList()) { + body.addStatement(f( + "NodeList<%s> %s = modifyList(n.%s(), arg);", + property.getTypeNameGenerified(), property.getName(), property.getGetterMethodName())); + } else if (property.isOptional()) { + body.addStatement(f( + "%s %s = n.%s().map(s -> (%s) s.accept(this, arg)).orElse(null);", + property.getTypeNameGenerified(), + property.getName(), + property.getGetterMethodName(), + property.getTypeNameGenerified())); + } else { + body.addStatement(f( + "%s %s = (%s) n.%s().accept(this, arg);", + property.getTypeNameGenerified(), + property.getName(), + property.getTypeNameGenerified(), + property.getGetterMethodName())); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/NoCommentEqualsVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/NoCommentEqualsVisitorGenerator.java new file mode 100644 index 0000000..809feed --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/NoCommentEqualsVisitorGenerator.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; + +public class NoCommentEqualsVisitorGenerator extends VisitorGenerator { + + public NoCommentEqualsVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "NoCommentEqualsVisitor", "Boolean", "Visitable", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + if (!(node.equals(JavaParserMetaModel.lineCommentMetaModel) + || node.equals(JavaParserMetaModel.blockCommentMetaModel) + || node.equals(JavaParserMetaModel.javadocCommentMetaModel))) { + + body.addStatement(f("final %s n2 = (%s) arg;", node.getTypeName(), node.getTypeName())); + + for (PropertyMetaModel field : node.getAllPropertyMetaModels()) { + final String getter = field.getGetterMethodName() + "()"; + if (field.equals(JavaParserMetaModel.nodeMetaModel.commentPropertyMetaModel)) continue; + if (field.getNodeReference().isPresent()) { + if (field.isNodeList()) { + body.addStatement(f("if (!nodesEquals(n.%s, n2.%s)) return false;", getter, getter)); + } else { + body.addStatement(f("if (!nodeEquals(n.%s, n2.%s)) return false;", getter, getter)); + } + } else { + body.addStatement(f("if (!objEquals(n.%s, n2.%s)) return false;", getter, getter)); + } + } + if (body.getStatements().size() == 1) { + // Only the cast line was added, but nothing is using it, so remove it again. + body.getStatements().clear(); + } + } + body.addStatement("return true;"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/NoCommentHashCodeVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/NoCommentHashCodeVisitorGenerator.java new file mode 100644 index 0000000..42a33eb --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/NoCommentHashCodeVisitorGenerator.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.StaticJavaParser.parseStatement; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SeparatedItemStringBuilder; +import com.github.javaparser.utils.SourceRoot; +import java.util.List; + +public class NoCommentHashCodeVisitorGenerator extends VisitorGenerator { + + public NoCommentHashCodeVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "NoCommentHashCodeVisitor", "Integer", "Void", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + final BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + final SeparatedItemStringBuilder builder = new SeparatedItemStringBuilder("return ", "* 31 +", ";"); + final List propertyMetaModels = node.getAllPropertyMetaModels(); + if (node.equals(JavaParserMetaModel.lineCommentMetaModel) + || node.equals(JavaParserMetaModel.blockCommentMetaModel) + || node.equals(JavaParserMetaModel.javadocCommentMetaModel) + || propertyMetaModels.isEmpty()) { + builder.append("0"); + } else { + for (PropertyMetaModel field : propertyMetaModels) { + final String getter = field.getGetterMethodName() + "()"; + if (field.equals(JavaParserMetaModel.nodeMetaModel.commentPropertyMetaModel)) { + if (propertyMetaModels.size() == 1) { + builder.append("0"); + break; + } + continue; + } + // Is this field another AST node? Visit it. + if (field.getNodeReference().isPresent()) { + if (field.isOptional()) { + builder.append("(n.%s.isPresent()? n.%s.get().accept(this, arg):0)", getter, getter); + } else { + builder.append("(n.%s.accept(this, arg))", getter); + } + } else { + Class type = field.getType(); + if (type.equals(boolean.class)) { + builder.append("(n.%s?1:0)", getter); + } else if (type.equals(int.class)) { + builder.append("n.%s", getter); + } else { + builder.append("(n.%s.hashCode())", getter); + } + } + } + } + body.addStatement(parseStatement(builder.toString())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ObjectIdentityEqualsVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ObjectIdentityEqualsVisitorGenerator.java new file mode 100644 index 0000000..92d335b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ObjectIdentityEqualsVisitorGenerator.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's ObjectIdentityEqualsVisitor. + */ +public class ObjectIdentityEqualsVisitorGenerator extends VisitorGenerator { + public ObjectIdentityEqualsVisitorGenerator(SourceRoot sourceRoot) { + super( + sourceRoot, + "com.github.javaparser.ast.visitor", + "ObjectIdentityEqualsVisitor", + "Boolean", + "Visitable", + true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + body.addStatement("return n == arg;"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ObjectIdentityHashCodeVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ObjectIdentityHashCodeVisitorGenerator.java new file mode 100644 index 0000000..9caa7e0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/ObjectIdentityHashCodeVisitorGenerator.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's ObjectIdentityHashCodeVisitor. + */ +public class ObjectIdentityHashCodeVisitorGenerator extends VisitorGenerator { + public ObjectIdentityHashCodeVisitorGenerator(SourceRoot sourceRoot) { + super( + sourceRoot, + "com.github.javaparser.ast.visitor", + "ObjectIdentityHashCodeVisitor", + "Integer", + "Void", + true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + final BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + body.addStatement("return n.hashCode();"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorAdapterGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorAdapterGenerator.java new file mode 100644 index 0000000..b176cbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorAdapterGenerator.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's VoidVisitorAdapter. + */ +public class VoidVisitorAdapterGenerator extends VisitorGenerator { + public VoidVisitorAdapterGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "VoidVisitorAdapter", "void", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + for (PropertyMetaModel field : node.getAllPropertyMetaModels()) { + final String getter = field.getGetterMethodName() + "()"; + if (field.getNodeReference().isPresent()) { + if (field.isOptional() && field.isNodeList()) { + body.addStatement(f("n.%s.ifPresent( l -> l.forEach( v -> v.accept(this, arg)));", getter)); + } else if (field.isOptional()) { + body.addStatement(f("n.%s.ifPresent(l -> l.accept(this, arg));", getter)); + } else if (field.isNodeList()) { + body.addStatement(f("n.%s.forEach(p -> p.accept(this, arg));", getter)); + } else { + body.addStatement(f("n.%s.accept(this, arg);", getter)); + } + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorGenerator.java new file mode 100644 index 0000000..4f6ae4c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorGenerator.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's VoidVisitor. + */ +public class VoidVisitorGenerator extends VisitorGenerator { + public VoidVisitorGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "VoidVisitor", "void", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(false)); + + visitMethod.setBody(null); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorWithDefaultsGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorWithDefaultsGenerator.java new file mode 100644 index 0000000..cb0f565 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/VoidVisitorWithDefaultsGenerator.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.visitor; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.generator.VisitorGenerator; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.utils.SourceRoot; + +/** + * Generates JavaParser's VoidVisitorWithDefaults. + */ +public class VoidVisitorWithDefaultsGenerator extends VisitorGenerator { + public VoidVisitorWithDefaultsGenerator(SourceRoot sourceRoot) { + super(sourceRoot, "com.github.javaparser.ast.visitor", "VoidVisitorWithDefaults", "void", "A", true); + } + + @Override + protected void generateVisitMethodBody( + BaseNodeMetaModel node, MethodDeclaration visitMethod, CompilationUnit compilationUnit) { + visitMethod.getParameters().forEach(p -> p.setFinal(true)); + + BlockStmt body = visitMethod.getBody().get(); + body.getStatements().clear(); + + body.addStatement("defaultAction(n, arg);"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/java/com/github/javaparser/generator/core/quality/NotNullGeneratorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/java/com/github/javaparser/generator/core/quality/NotNullGeneratorTest.java new file mode 100644 index 0000000..5b75390 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/java/com/github/javaparser/generator/core/quality/NotNullGeneratorTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.quality; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.printer.DefaultPrettyPrinter; +import com.github.javaparser.utils.SourceRoot; +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import org.junit.jupiter.api.Test; + +class NotNullGeneratorTest { + + @Test + void testExecutionOfGenerator() throws Exception { + + // Setup the + String resourcesFolderPath = getClass().getCanonicalName().replace(".", File.separator); + + String basePath = Paths.get("src", "test", "resources").toString(); + Path originalFile = Paths.get(basePath, resourcesFolderPath, "original"); + Path expectedFile = Paths.get(basePath, resourcesFolderPath, "expected"); + + SourceRoot originalSources = new SourceRoot(originalFile); + SourceRoot expectedSources = new SourceRoot(expectedFile); + expectedSources.tryToParse(); + + // Generate the information + new NotNullGenerator(originalSources).generate(); + + List editedSourceCus = originalSources.getCompilationUnits(); + List expectedSourcesCus = expectedSources.getCompilationUnits(); + assertEquals(expectedSourcesCus.size(), editedSourceCus.size()); + + // Check if all the files match the expected result + for (int i = 0; i < editedSourceCus.size(); i++) { + + DefaultPrettyPrinter printer = new DefaultPrettyPrinter(); + String expectedCode = printer.print(expectedSourcesCus.get(i)); + String editedCode = printer.print(editedSourceCus.get(i)); + + if (!expectedCode.equals(editedCode)) { + System.out.println("Expected:"); + System.out.println("####"); + System.out.println(expectedSourcesCus.get(i)); + System.out.println("####"); + System.out.println("Actual:"); + System.out.println("####"); + System.out.println(editedSourceCus.get(i)); + System.out.println("####"); + fail("Actual code doesn't match with the expected code."); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/java/com/github/javaparser/generator/core/utils/CodeUtilsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/java/com/github/javaparser/generator/core/utils/CodeUtilsTest.java new file mode 100644 index 0000000..b4794f3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/java/com/github/javaparser/generator/core/utils/CodeUtilsTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.core.utils; + +import static com.github.javaparser.generator.core.utils.CodeUtils.castValue; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.ast.type.Type; +import org.junit.jupiter.api.Test; + +class CodeUtilsTest { + + private static final String RETURN_VALUE = "this"; + + @Test + void castReturnValue_whenAValueMatchesTheExpectedTypeNoCastIsNeeded() { + Type returnType = PrimitiveType.booleanType(); + Type valueType = PrimitiveType.booleanType(); + + assertEquals(RETURN_VALUE, castValue(RETURN_VALUE, returnType, valueType.asString())); + } + + @Test + void castReturnValue_whenAValueIsNotAssignedByReturnShouldBeCasted() { + Type returnType = StaticJavaParser.parseType("String"); + Type valueType = StaticJavaParser.parseType("Object"); + + assertEquals( + String.format("(%s) %s", returnType, RETURN_VALUE), + castValue(RETURN_VALUE, returnType, valueType.asString())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/ConstructorParameterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/ConstructorParameterTest.java new file mode 100644 index 0000000..15bfffa --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/ConstructorParameterTest.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.example; + +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Nullable; +import com.github.javaparser.quality.Preconditions; + +class ConstructorParameterTest { + + private final String a; + + private final String b; + + private final String c; + + public ConstructorParameterTest(@NotNull String notNullString, @Nullable String nullableString, String otherString) { + Preconditions.checkNotNull(notNullString, "Parameter notNullString can't be null."); + this.a = notNullString; + this.b = nullableString; + this.c = otherString; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/ConstructorParameterWithSuperTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/ConstructorParameterWithSuperTest.java new file mode 100644 index 0000000..524ab05 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/ConstructorParameterWithSuperTest.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Preconditions; + +class A { + + public A(String a) { + } +} + +class B { + + public B(@NotNull String c) { + super("ok"); + Preconditions.checkNotNull(c, "Parameter c can't be null."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/MethodParameterRerunTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/MethodParameterRerunTest.java new file mode 100644 index 0000000..22e149e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/MethodParameterRerunTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Preconditions; + +class A { + + public void method(@NotNull String notNull, @NotNull String secondNotNull) { + Preconditions.checkNotNull(notNull, "Parameter notNull can't be null."); + Preconditions.checkNotNull(secondNotNull, "Parameter secondNotNull can't be null."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/MethodParameterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/MethodParameterTest.java new file mode 100644 index 0000000..5c5ba8e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/expected/MethodParameterTest.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Preconditions; + +class A { + + public void method(@NotNull String notNull) { + Preconditions.checkNotNull(notNull, "Parameter notNull can't be null."); + } + + public void method(int age) { + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/ConstructorParameterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/ConstructorParameterTest.java new file mode 100644 index 0000000..9f9a593 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/ConstructorParameterTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.example; + +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Nullable; + +class ConstructorParameterTest { + + private final String a; + private final String b; + private final String c; + + public ConstructorParameterTest(@NotNull String notNullString, @Nullable String nullableString, + String otherString) { + this.a = notNullString; + this.b = nullableString; + this.c = otherString; + } + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/ConstructorParameterWithSuperTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/ConstructorParameterWithSuperTest.java new file mode 100644 index 0000000..2938191 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/ConstructorParameterWithSuperTest.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.quality.NotNull; + +class A { + public A(String a) {} +} + +class B { + + public B(@NotNull String c) { + super("ok"); + } + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/MethodParameterRerunTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/MethodParameterRerunTest.java new file mode 100644 index 0000000..30ce35b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/MethodParameterRerunTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Preconditions; + +class A { + + public void method(@NotNull String notNull, @NotNull String secondNotNull) { + Preconditions.checkNotNull(notNull, "This was aan old message."); + Preconditions.checkNotNull(secondNotNull, "Parameter secondNotNull can't be null."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/MethodParameterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/MethodParameterTest.java new file mode 100644 index 0000000..f66e0b9 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-generators/src/test/resources/com/github/javaparser/generator/core/quality/NotNullGeneratorTest/original/MethodParameterTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2021 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.quality.NotNull; +import com.github.javaparser.quality.Preconditions; + +class A { + + public void method(@NotNull String notNull) {} + + public void method(int age) {} + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/pom.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/pom.xml new file mode 100644 index 0000000..ae4b1a9 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/pom.xml @@ -0,0 +1,63 @@ + + + + javaparser-parent + com.github.javaparser + 3.27.0 + + 4.0.0 + + javaparser-core-metamodel-generator + The tool that generates the code in the javaparser-metamodel module + + + + com.github.javaparser + javaparser-core + ${project.version} + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + + true + + + + + + + + run-generators + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-javaparser-metamodel + test + + java + + + + + test + com.github.javaparser.generator.metamodel.MetaModelGenerator + + ${project.basedir} + + + + + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/AbstractGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/AbstractGenerator.java new file mode 100644 index 0000000..e2daa26 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/AbstractGenerator.java @@ -0,0 +1,333 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator; + +import static com.github.javaparser.ast.NodeList.toNodeList; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ParseResult; +import com.github.javaparser.Problem; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Generated; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.expr.AnnotationExpr; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.SwitchStmt; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.SourceRoot; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * A general pattern that the generators in this module will follow. + */ +public abstract class AbstractGenerator { + + protected static final String COPYRIGHT_NOTICE_JP_CORE = "\n" + " * Copyright (C) 2007-2010 Júlio Vilmar Gesser.\n" + + " * Copyright (C) 2011, 2013-2024 The JavaParser Team.\n" + + " *\n" + + " * This file is part of JavaParser.\n" + + " *\n" + + " * JavaParser can be used either under the terms of\n" + + " * a) the GNU Lesser General Public License as published by\n" + + " * the Free Software Foundation, either version 3 of the License, or\n" + + " * (at your option) any later version.\n" + + " * b) the terms of the Apache License\n" + + " *\n" + + " * You should have received a copy of both licenses in LICENCE.LGPL and\n" + + " * LICENCE.APACHE. Please refer to those files for details.\n" + + " *\n" + + " * JavaParser is distributed in the hope that it will be useful,\n" + + " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + + " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + + " * GNU Lesser General Public License for more details.\n" + + " "; + + protected static final String COPYRIGHT_NOTICE_JP_SS = "\n" + " * Copyright (C) 2015-2016 Federico Tomassetti\n" + + " * Copyright (C) 2017-2024 The JavaParser Team.\n" + + " *\n" + + " * This file is part of JavaParser.\n" + + " *\n" + + " * JavaParser can be used either under the terms of\n" + + " * a) the GNU Lesser General Public License as published by\n" + + " * the Free Software Foundation, either version 3 of the License, or\n" + + " * (at your option) any later version.\n" + + " * b) the terms of the Apache License\n" + + " *\n" + + " * You should have received a copy of both licenses in LICENCE.LGPL and\n" + + " * LICENCE.APACHE. Please refer to those files for details.\n" + + " *\n" + + " * JavaParser is distributed in the hope that it will be useful,\n" + + " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + + " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + + " * GNU Lesser General Public License for more details.\n" + + " "; + + protected final SourceRoot sourceRoot; + + protected AbstractGenerator(SourceRoot sourceRoot) { + this.sourceRoot = sourceRoot; + } + + private void addOrReplaceMethod( + ClassOrInterfaceDeclaration containingClassOrInterface, + CallableDeclaration callable, + Runnable onNoExistingMethod) { + List> existingMatchingCallables = + containingClassOrInterface.getCallablesWithSignature(callable.getSignature()); + if (existingMatchingCallables.isEmpty()) { + // A matching callable exists -- will now normally add/insert. + onNoExistingMethod.run(); + } else { + // A matching callable doe NOT exist -- will now normally replace. + if (existingMatchingCallables.size() > 1) { + throw new AssertionError(f( + "Wanted to regenerate a method with signature %s in %s, but found more than one, and unable to disambiguate.", + callable.getSignature(), containingClassOrInterface.getNameAsString())); + } + + final CallableDeclaration existingCallable = existingMatchingCallables.get(0); + + // Attempt to retain any existing javadoc. + + // TODO: Confirm what is done with normal comments... + Optional callableJavadocComment = callable.getJavadocComment(); + Optional existingCallableJavadocComment = existingCallable.getJavadocComment(); + + Optional callableComment = callable.getComment(); + Optional existingCallableComment = existingCallable.getComment(); + + callable.setComment(callableComment.orElseGet( + () -> existingCallable.getComment().orElse(null))); + // + // callable.setJavadocComment(callableJavadocComment.orElse(existingCallableJavadocComment.orElse(null))); + + // Mark the method as having been fully/partially generated. + annotateGenerated(callable); + + if (callable.isMethodDeclaration()) { + // We want the methods that we generate/insert to be pretty printed. + MethodDeclaration prettyMethodDeclaration = prettyPrint(callable.asMethodDeclaration(), " "); + + // Do the replacement. + containingClassOrInterface.getMembers().replace(existingCallable, prettyMethodDeclaration); + } else { + // TODO: Unable to parse a constructor directly...? + + // Do the replacement. + containingClassOrInterface.getMembers().replace(existingCallable, callable); + } + } + } + + /** + * Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it + * with callable. If not found, adds callable. When the new callable has no javadoc, any old javadoc will be kept. + */ + protected void addOrReplaceWhenSameSignature( + ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration callable) { + addOrReplaceMethod(containingClassOrInterface, callable, () -> { + annotateGenerated(callable); + containingClassOrInterface.addMember(callable); + }); + } + + protected void after() throws Exception {} + + /** + * @param node The node to which the annotation will be added. + * @param annotation The annotation to be added to the given node. + * @param content Where an annotation has content, it is passed here (otherwise null). + * @param Only accept nodes which accept annotations. + */ + private > void annotate(T node, Class annotation, Expression content) { + NodeList annotations = node.getAnnotations().stream() + .filter(a -> !a.getNameAsString().equals(annotation.getSimpleName())) + .collect(toNodeList()); + + node.setAnnotations(annotations); + + if (content != null) { + node.addSingleMemberAnnotation(annotation.getSimpleName(), content); + } else { + node.addMarkerAnnotation(annotation.getSimpleName()); + } + + // The annotation class will normally need to be imported. + node.tryAddImportToParentCompilationUnit(annotation); + } + + /** + * @param node The node to which the {@code @Annotated} annotation will be added. + * @param + */ + protected > void annotateGenerated(T node) { + annotate(node, Generated.class, new StringLiteralExpr(getClass().getName())); + } + + protected > void removeAnnotation(T node, Class annotation) { + node.getAnnotations() + .removeIf(annotationExpr -> annotationExpr.getName().asString().equals(annotation.getSimpleName())); + + node.findAncestor(CompilationUnit.class).ifPresent(compilationUnit -> { + removeAnnotationImportIfUnused(compilationUnit, annotation); + }); + } + + protected > void removeGenerated(T node) { + removeAnnotation(node, Generated.class); + } + + protected void removeAnnotationImportIfUnused(CompilationUnit compilationUnit, Class annotation) { + + List staleAnnotations = compilationUnit.findAll(AnnotationExpr.class).stream() + .filter(annotationExpr -> annotationExpr.getName().asString().equals(annotation.getSimpleName())) + .collect(Collectors.toList()); + + if (staleAnnotations.isEmpty()) { + // If there are no usages of this annotation, remove the import. + boolean isRemoved = compilationUnit.getImports().removeIf(importDeclaration -> { + return importDeclaration.getNameAsString().equals(annotation.getCanonicalName()); + }); + } + } + + /** + * @param method The node to which the {@code @Override} annotation will be added. + */ + protected void annotateOverridden(MethodDeclaration method) { + annotate(method, Override.class, null); + } + + /** + * @param node The node to which the {@code @SuppressWarnings} annotation will be added. + * @param Only accept nodes which accept annotations. + */ + protected > void annotateSuppressWarnings(T node, String warningType) { + annotate(node, SuppressWarnings.class, new StringLiteralExpr(warningType)); + } + + /** + * Removes all methods from containingClassOrInterface that have the same signature as callable. + * This is not currently used directly by any current generators, but may be useful when changing a generator + * and you need to get rid of a set of outdated methods. + */ + protected void removeMethodWithSameSignature( + ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration callable) { + for (CallableDeclaration existingCallable : + containingClassOrInterface.getCallablesWithSignature(callable.getSignature())) { + containingClassOrInterface.remove(existingCallable); + } + } + + /** + * Utility method that looks for a method or constructor with an identical signature as "callable" and replaces it + * with callable. If not found, fails. When the new callable has no javadoc, any old javadoc will be kept. The + * method or constructor is annotated with the generator class. + */ + protected void replaceWhenSameSignature( + ClassOrInterfaceDeclaration containingClassOrInterface, CallableDeclaration callable) { + addOrReplaceMethod(containingClassOrInterface, callable, () -> { + throw new AssertionError(f( + "Wanted to regenerate a method with signature %s in %s, but it wasn't there.", + callable.getSignature(), containingClassOrInterface.getNameAsString())); + }); + } + + protected List getParsedCompilationUnitsFromSourceRoot(SourceRoot sourceRoot) throws IOException { + List cus = sourceRoot.getCompilationUnits(); + List> parseResults = sourceRoot.tryToParse(); + + boolean allParsed = parseResults.stream().allMatch(ParseResult::isSuccessful); + if (!allParsed) { + List> problemResults = parseResults.stream() + .filter(compilationUnitParseResult -> !compilationUnitParseResult.isSuccessful()) + .collect(Collectors.toList()); + for (int i = 0; i < problemResults.size(); i++) { + ParseResult parseResult = problemResults.get(i); + List problems = parseResult.getProblems(); + Log.info(""); + Log.info("Problems (" + (i + 1) + " of " + problemResults.size() + "): "); + Log.info(problems.toString()); + } + + throw new IllegalStateException("Expected all files to parse."); + } + + Log.info("parseResults.size() = " + parseResults.size()); + + return parseResults.stream() + .map(ParseResult::getResult) + .map(Optional::get) + .collect(Collectors.toList()); + } + + protected MethodDeclaration prettyPrint(MethodDeclaration methodDeclaration) { + return prettyPrint(methodDeclaration, ""); + } + + protected MethodDeclaration prettyPrint(MethodDeclaration methodDeclaration, String indent) { + String methodDeclarationString = indent + methodDeclaration.toString().replaceAll("(\\R)", "$1" + indent); + MethodDeclaration prettyMethodDeclaration = StaticJavaParser.parseMethodDeclaration(methodDeclarationString); + + return prettyMethodDeclaration; + } + + protected EnumDeclaration prettyPrint(EnumDeclaration enumDeclaration) { + return prettyPrint(enumDeclaration, ""); + } + + protected EnumDeclaration prettyPrint(EnumDeclaration enumDeclaration, String indent) { + String enumDeclarationString = indent + enumDeclaration.toString().replaceAll("(\\R)", "$1" + indent); + TypeDeclaration prettyEnumDeclaration = StaticJavaParser.parseTypeDeclaration(enumDeclarationString); + + LexicalPreservingPrinter.setup(prettyEnumDeclaration); + + // We know that it is an enum declaration. + return prettyEnumDeclaration.asEnumDeclaration(); + } + + protected SwitchStmt prettyPrint(SwitchStmt switchStmt) { + return prettyPrint(switchStmt, ""); + } + + protected SwitchStmt prettyPrint(SwitchStmt switchStmt, String indent) { + String switchStmtString = indent + switchStmt.toString().replaceAll("(\\R)", "$1" + indent); + Statement prettySwitchStmt = StaticJavaParser.parseStatement(switchStmtString); + + LexicalPreservingPrinter.setup(prettySwitchStmt); + + // We know that it is an switch statement. + return prettySwitchStmt.asSwitchStmt(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java new file mode 100644 index 0000000..7536af8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.metamodel; + +import static java.lang.reflect.Modifier.isAbstract; + +import com.github.javaparser.ast.NodeList; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.lang.reflect.WildcardType; +import java.util.Optional; + +/** + * A hacky thing that collects flags we need from AST types to generate the metamodel. + */ +class AstTypeAnalysis { + final boolean isAbstract; + boolean isOptional = false; + boolean isNodeList = false; + boolean isSelfType = false; + Class innerType; + + AstTypeAnalysis(Type type) { + if (type instanceof Class) { + TypeVariable>[] typeParameters = ((Class) type).getTypeParameters(); + if (typeParameters.length > 0) { + isSelfType = true; + } + } else { + while (type instanceof ParameterizedType) { + ParameterizedType t = (ParameterizedType) type; + Type currentOuterType = t.getRawType(); + if (currentOuterType == NodeList.class) { + isNodeList = true; + } + if (currentOuterType == Optional.class) { + isOptional = true; + } + + if (t.getActualTypeArguments()[0] instanceof WildcardType) { + type = t.getRawType(); + isSelfType = true; + break; + } + type = t.getActualTypeArguments()[0]; + } + } + innerType = (Class) type; + isAbstract = isAbstract(innerType.getModifiers()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java new file mode 100644 index 0000000..1584890 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.metamodel; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static com.github.javaparser.generator.metamodel.MetaModelGenerator.nodeMetaModelFieldName; +import static com.github.javaparser.generator.metamodel.MetaModelGenerator.propertyMetaModelFieldName; +import static com.github.javaparser.utils.CodeGenerationUtils.f; + +import com.github.javaparser.ast.AllFieldsConstructor; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.stmt.Statement; +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; + +class InitializeConstructorParametersStatementsGenerator { + void generate(Class nodeClass, NodeList initializeConstructorParametersStatements) { + if (nodeClass == Node.class) { + return; + } + Constructor constructor = findAllFieldsConstructor(nodeClass); + for (java.lang.reflect.Parameter parameter : constructor.getParameters()) { + Field field = findFieldInClass(nodeClass, parameter.getName()); + + String addFieldStatement = f( + "%s.getConstructorParameters().add(%s.%s);", + nodeMetaModelFieldName(nodeClass), + nodeMetaModelFieldName(field.getDeclaringClass()), + propertyMetaModelFieldName(field)); + + initializeConstructorParametersStatements.add(parseStatement(addFieldStatement)); + } + } + + private Field findFieldInClass(Class nodeClass, String name) { + Class searchClass = nodeClass; + do { + for (Field field : searchClass.getDeclaredFields()) { + if (field.getName().equals(name)) { + return field; + } + } + searchClass = searchClass.getSuperclass(); + } while (searchClass != null); + throw new AssertionError( + f("Couldn't find constructor parameter %s as a field, class %s", name, nodeClass.getSimpleName())); + } + + private Constructor findAllFieldsConstructor(Class nodeClass) { + for (Constructor constructor : nodeClass.getDeclaredConstructors()) { + for (Annotation annotation : constructor.getAnnotations()) { + if (annotation.annotationType() == AllFieldsConstructor.class) { + return constructor; + } + } + } + throw new AssertionError( + f("Node class %s has no constructor annotated with @AllFieldsConstructor", nodeClass.getSimpleName())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java new file mode 100644 index 0000000..1631a30 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.metamodel; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.generator.metamodel.MetaModelGenerator.isNode; +import static com.github.javaparser.generator.metamodel.MetaModelGenerator.nodeMetaModelName; +import static com.github.javaparser.utils.CodeGenerationUtils.*; +import static com.github.javaparser.utils.Utils.decapitalize; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.metamodel.NonEmptyProperty; +import com.github.javaparser.metamodel.OptionalProperty; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +class InitializePropertyMetaModelsStatementsGenerator { + void generate( + Field field, + ClassOrInterfaceDeclaration nodeMetaModelClass, + String nodeMetaModelFieldName, + NodeList initializePropertyMetaModelsStatements) { + final AstTypeAnalysis fieldTypeAnalysis = new AstTypeAnalysis(field.getGenericType()); + + final Class fieldType = fieldTypeAnalysis.innerType; + final String typeName = fieldType.getTypeName().replace('$', '.'); + final String propertyMetaModelFieldName = field.getName() + "PropertyMetaModel"; + nodeMetaModelClass.addField("PropertyMetaModel", propertyMetaModelFieldName, PUBLIC); + final String propertyInitializer = f( + "new PropertyMetaModel(%s, \"%s\", %s.class, %s, %s, %s, %s, %s)", + nodeMetaModelFieldName, + field.getName(), + typeName, + optionalOf(decapitalize(nodeMetaModelName(fieldType)), isNode(fieldType)), + isOptional(field), + isNonEmpty(field), + fieldTypeAnalysis.isNodeList, + fieldTypeAnalysis.isSelfType); + final String fieldSetting = + f("%s.%s=%s;", nodeMetaModelFieldName, propertyMetaModelFieldName, propertyInitializer); + final String fieldAddition = f( + "%s.getDeclaredPropertyMetaModels().add(%s.%s);", + nodeMetaModelFieldName, nodeMetaModelFieldName, propertyMetaModelFieldName); + + initializePropertyMetaModelsStatements.add(parseStatement(fieldSetting)); + initializePropertyMetaModelsStatements.add(parseStatement(fieldAddition)); + } + + void generateDerivedProperty( + Method method, + ClassOrInterfaceDeclaration nodeMetaModelClass, + String nodeMetaModelFieldName, + NodeList initializePropertyMetaModelsStatements) { + final AstTypeAnalysis returnTypeAnalysis = new AstTypeAnalysis(method.getGenericReturnType()); + + final Class innermostReturnType = returnTypeAnalysis.innerType; + final String typeName = innermostReturnType.getTypeName().replace('$', '.'); + final String propertyMetaModelFieldName = getterToPropertyName(method.getName()) + "PropertyMetaModel"; + nodeMetaModelClass.addField("PropertyMetaModel", propertyMetaModelFieldName, PUBLIC); + final String propertyInitializer = f( + "new PropertyMetaModel(%s, \"%s\", %s.class, %s, %s, %s, %s, %s)", + nodeMetaModelFieldName, + getterToPropertyName(method.getName()), + typeName, + optionalOf(decapitalize(nodeMetaModelName(innermostReturnType)), isNode(innermostReturnType)), + returnTypeAnalysis.isOptional, + isNonEmpty(method), + returnTypeAnalysis.isNodeList, + returnTypeAnalysis.isSelfType); + final String fieldSetting = + f("%s.%s=%s;", nodeMetaModelFieldName, propertyMetaModelFieldName, propertyInitializer); + final String fieldAddition = f( + "%s.getDerivedPropertyMetaModels().add(%s.%s);", + nodeMetaModelFieldName, nodeMetaModelFieldName, propertyMetaModelFieldName); + + initializePropertyMetaModelsStatements.add(parseStatement(fieldSetting)); + initializePropertyMetaModelsStatements.add(parseStatement(fieldAddition)); + } + + private boolean isNonEmpty(Field field) { + return field.isAnnotationPresent(NonEmptyProperty.class); + } + + private boolean isNonEmpty(Method method) { + return method.isAnnotationPresent(NonEmptyProperty.class); + } + + private boolean isOptional(Field field) { + return field.isAnnotationPresent(OptionalProperty.class); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java new file mode 100644 index 0000000..933e665 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.metamodel; + +import static com.github.javaparser.utils.Utils.decapitalize; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.CompactConstructorDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.generator.AbstractGenerator; +import com.github.javaparser.printer.DefaultPrettyPrinter; +import com.github.javaparser.printer.Printer; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.PrinterConfiguration; +import com.github.javaparser.utils.SourceRoot; +import java.lang.reflect.Field; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +public class MetaModelGenerator extends AbstractGenerator { + + static final String BASE_NODE_META_MODEL = "BaseNodeMetaModel"; + static final String METAMODEL_PACKAGE = "com.github.javaparser.metamodel"; + + /** + * Note that order of this list is manually set and maintained. + */ + private static final List> ALL_NODE_CLASSES = new ArrayList>() { + { + /* Base classes go first, so we don't have to do any sorting to make sure + generated classes can refer to their base generated classes without + being afraid those are not initialized yet. */ + + // Fully qualified names used to make logical groupings (somewhat) more explicit. + + // + add(com.github.javaparser.ast.Node.class); + + add(com.github.javaparser.ast.body.BodyDeclaration.class); + add(com.github.javaparser.ast.body.CallableDeclaration.class); + add(com.github.javaparser.ast.expr.Expression.class); + add(com.github.javaparser.ast.stmt.Statement.class); + add(com.github.javaparser.ast.type.Type.class); + + add(com.github.javaparser.ast.expr.AnnotationExpr.class); + add(com.github.javaparser.ast.type.ReferenceType.class); + add(com.github.javaparser.ast.body.TypeDeclaration.class); + + add(com.github.javaparser.ast.expr.LiteralExpr.class); + add(com.github.javaparser.ast.expr.LiteralStringValueExpr.class); + add(com.github.javaparser.ast.expr.StringLiteralExpr.class); + + add(com.github.javaparser.ast.modules.ModuleDeclaration.class); + add(com.github.javaparser.ast.modules.ModuleDirective.class); + + // + add(com.github.javaparser.ast.ArrayCreationLevel.class); + add(com.github.javaparser.ast.CompilationUnit.class); + add(com.github.javaparser.ast.ImportDeclaration.class); + add(com.github.javaparser.ast.Modifier.class); + add(com.github.javaparser.ast.PackageDeclaration.class); + + // + add(com.github.javaparser.ast.body.AnnotationDeclaration.class); + add(com.github.javaparser.ast.body.AnnotationMemberDeclaration.class); + add(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.class); + add(com.github.javaparser.ast.body.ConstructorDeclaration.class); + add(com.github.javaparser.ast.body.EnumConstantDeclaration.class); + add(com.github.javaparser.ast.body.EnumDeclaration.class); + add(com.github.javaparser.ast.body.FieldDeclaration.class); + add(com.github.javaparser.ast.body.InitializerDeclaration.class); + add(com.github.javaparser.ast.body.MethodDeclaration.class); + add(com.github.javaparser.ast.body.Parameter.class); + add(com.github.javaparser.ast.body.ReceiverParameter.class); + add(com.github.javaparser.ast.body.RecordDeclaration.class); + add(CompactConstructorDeclaration.class); + add(com.github.javaparser.ast.body.VariableDeclarator.class); + + add(com.github.javaparser.ast.comments.Comment.class); // First, as it is the base of other comment types + add(com.github.javaparser.ast.comments.BlockComment.class); + add(com.github.javaparser.ast.comments.JavadocComment.class); + add(com.github.javaparser.ast.comments.LineComment.class); + + add(com.github.javaparser.ast.expr.ArrayAccessExpr.class); + add(com.github.javaparser.ast.expr.ArrayCreationExpr.class); + add(com.github.javaparser.ast.expr.ArrayInitializerExpr.class); + add(com.github.javaparser.ast.expr.AssignExpr.class); + add(com.github.javaparser.ast.expr.BinaryExpr.class); + add(com.github.javaparser.ast.expr.BooleanLiteralExpr.class); + add(com.github.javaparser.ast.expr.CastExpr.class); + add(com.github.javaparser.ast.expr.CharLiteralExpr.class); + add(com.github.javaparser.ast.expr.ClassExpr.class); + add(com.github.javaparser.ast.expr.ConditionalExpr.class); + add(com.github.javaparser.ast.expr.DoubleLiteralExpr.class); + add(com.github.javaparser.ast.expr.EnclosedExpr.class); + add(com.github.javaparser.ast.expr.FieldAccessExpr.class); + add(com.github.javaparser.ast.expr.InstanceOfExpr.class); + add(com.github.javaparser.ast.expr.IntegerLiteralExpr.class); + add(com.github.javaparser.ast.expr.LambdaExpr.class); + add(com.github.javaparser.ast.expr.LongLiteralExpr.class); + add(com.github.javaparser.ast.expr.MarkerAnnotationExpr.class); + add(com.github.javaparser.ast.expr.MemberValuePair.class); + add(com.github.javaparser.ast.expr.MethodCallExpr.class); + add(com.github.javaparser.ast.expr.MethodReferenceExpr.class); + add(com.github.javaparser.ast.expr.NameExpr.class); + add(com.github.javaparser.ast.expr.Name.class); + add(com.github.javaparser.ast.expr.NormalAnnotationExpr.class); + add(com.github.javaparser.ast.expr.NullLiteralExpr.class); + add(com.github.javaparser.ast.expr.ObjectCreationExpr.class); + add(com.github.javaparser.ast.expr.PatternExpr.class); + add(com.github.javaparser.ast.expr.RecordPatternExpr.class); + add(com.github.javaparser.ast.expr.SingleMemberAnnotationExpr.class); + add(com.github.javaparser.ast.expr.SimpleName.class); + add(com.github.javaparser.ast.expr.SuperExpr.class); + add(com.github.javaparser.ast.expr.SwitchExpr.class); + add(com.github.javaparser.ast.expr.TextBlockLiteralExpr.class); + add(com.github.javaparser.ast.expr.ThisExpr.class); + add(com.github.javaparser.ast.expr.TypeExpr.class); + add(com.github.javaparser.ast.expr.TypePatternExpr.class); + add(com.github.javaparser.ast.expr.UnaryExpr.class); + add(com.github.javaparser.ast.expr.VariableDeclarationExpr.class); + + add(com.github.javaparser.ast.stmt.AssertStmt.class); + add(com.github.javaparser.ast.stmt.BlockStmt.class); + add(com.github.javaparser.ast.stmt.BreakStmt.class); + add(com.github.javaparser.ast.stmt.CatchClause.class); + add(com.github.javaparser.ast.stmt.ContinueStmt.class); + add(com.github.javaparser.ast.stmt.DoStmt.class); + add(com.github.javaparser.ast.stmt.EmptyStmt.class); + add(com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt.class); + add(com.github.javaparser.ast.stmt.ExpressionStmt.class); + add(com.github.javaparser.ast.stmt.ForEachStmt.class); + add(com.github.javaparser.ast.stmt.ForStmt.class); + add(com.github.javaparser.ast.stmt.IfStmt.class); + add(com.github.javaparser.ast.stmt.LabeledStmt.class); + add(com.github.javaparser.ast.stmt.LocalClassDeclarationStmt.class); + add(com.github.javaparser.ast.stmt.LocalRecordDeclarationStmt.class); + add(com.github.javaparser.ast.stmt.ReturnStmt.class); + add(com.github.javaparser.ast.stmt.SwitchEntry.class); + add(com.github.javaparser.ast.stmt.SwitchStmt.class); + add(com.github.javaparser.ast.stmt.SynchronizedStmt.class); + add(com.github.javaparser.ast.stmt.ThrowStmt.class); + add(com.github.javaparser.ast.stmt.TryStmt.class); + add(com.github.javaparser.ast.stmt.UnparsableStmt.class); + add(com.github.javaparser.ast.stmt.WhileStmt.class); + add(com.github.javaparser.ast.stmt.YieldStmt.class); + + add(com.github.javaparser.ast.type.ArrayType.class); + add(com.github.javaparser.ast.type.ClassOrInterfaceType.class); + add(com.github.javaparser.ast.type.IntersectionType.class); + add(com.github.javaparser.ast.type.PrimitiveType.class); + add(com.github.javaparser.ast.type.TypeParameter.class); + add(com.github.javaparser.ast.type.UnionType.class); + add(com.github.javaparser.ast.type.UnknownType.class); + add(com.github.javaparser.ast.type.VarType.class); + add(com.github.javaparser.ast.type.VoidType.class); + add(com.github.javaparser.ast.type.WildcardType.class); + + add(com.github.javaparser.ast.modules.ModuleExportsDirective.class); + add(com.github.javaparser.ast.modules.ModuleOpensDirective.class); + add(com.github.javaparser.ast.modules.ModuleProvidesDirective.class); + add(com.github.javaparser.ast.modules.ModuleRequiresDirective.class); + add(com.github.javaparser.ast.modules.ModuleUsesDirective.class); + } + }; + + public MetaModelGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + public static void main(String[] args) throws Exception { + if (args.length != 1) { + throw new RuntimeException("Need 1 parameter: the JavaParser source checkout root directory."); + } + final Path root = Paths.get(args[0], "..", "javaparser-core", "src", "main", "java"); + final ParserConfiguration parserConfiguration = new ParserConfiguration() + .setLanguageLevel(ParserConfiguration.LanguageLevel.RAW) + .setStoreTokens(false); + final SourceRoot sourceRoot = new SourceRoot(root, parserConfiguration); + PrinterConfiguration config = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.END_OF_LINE_CHARACTER, ("\n"))); + Printer printer = new DefaultPrettyPrinter(config); + sourceRoot.setPrinter(printer::print); + StaticJavaParser.setConfiguration(parserConfiguration); + + new MetaModelGenerator(sourceRoot).generate(); + + sourceRoot.saveAll(); + } + + public void generate() throws Exception { + final CompilationUnit javaParserMetaModelCu = sourceRoot.parse(METAMODEL_PACKAGE, "JavaParserMetaModel.java"); + javaParserMetaModelCu.setBlockComment(COPYRIGHT_NOTICE_JP_CORE); + + generateNodeMetaModels(javaParserMetaModelCu, sourceRoot); + } + + private void generateNodeMetaModels(CompilationUnit javaParserMetaModelCu, SourceRoot sourceRoot) + throws NoSuchMethodException { + final ClassOrInterfaceDeclaration metaModelCoid = + javaParserMetaModelCu.getClassByName("JavaParserMetaModel").get(); + + // Initialiser methods + final MethodDeclaration initializeNodeMetaModelsMethod = + metaModelCoid.getMethodsByName("initializeNodeMetaModels").get(0); + final MethodDeclaration initializePropertyMetaModelsMethod = + metaModelCoid.getMethodsByName("initializePropertyMetaModels").get(0); + final MethodDeclaration initializeConstructorParametersVariable = metaModelCoid + .getMethodsByName("initializeConstructorParameters") + .get(0); + + // Ensure annotation `@Generated` is added to indicate the contents of each are generated. + annotateGenerated(initializeNodeMetaModelsMethod); + annotateGenerated(initializePropertyMetaModelsMethod); + annotateGenerated(initializeConstructorParametersVariable); + + // Empty the body of the initialiser methods, to be (re-)generated below. + final NodeList initializeNodeMetaModelsStatements = + initializeNodeMetaModelsMethod.getBody().get().getStatements(); + final NodeList initializePropertyMetaModelsStatements = + initializePropertyMetaModelsMethod.getBody().get().getStatements(); + final NodeList initializeConstructorParametersStatements = + initializeConstructorParametersVariable.getBody().get().getStatements(); + initializeNodeMetaModelsStatements.clear(); + initializePropertyMetaModelsStatements.clear(); + initializeConstructorParametersStatements.clear(); + + // Remove fields, to be (re-)generated below. + metaModelCoid.getFields().stream() + .filter(f -> f.getVariable(0).getNameAsString().endsWith("MetaModel")) + .forEach(Node::remove); + + // Do the generation of each node metamodel class. + final NodeMetaModelGenerator nodeMetaModelGenerator = new NodeMetaModelGenerator(sourceRoot); + for (Class nodeClass : ALL_NODE_CLASSES) { + nodeMetaModelGenerator.generate( + nodeClass, + metaModelCoid, + initializeNodeMetaModelsStatements, + initializePropertyMetaModelsStatements, + initializeConstructorParametersStatements, + sourceRoot); + } + + // TODO: Document why sorting occurs. + initializeNodeMetaModelsStatements.sort(Comparator.comparing(Node::toString)); + } + + static boolean isNode(Class c) { + return Node.class.isAssignableFrom(c); + } + + static String nodeMetaModelName(Class c) { + return c.getSimpleName() + "MetaModel"; + } + + static String propertyMetaModelFieldName(Field field) { + return field.getName() + "PropertyMetaModel"; + } + + static String nodeMetaModelFieldName(Class nodeClass) { + return decapitalize(nodeMetaModelName(nodeClass)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java new file mode 100644 index 0000000..b23cad2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.generator.metamodel; + +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.ast.Modifier.Keyword.*; +import static com.github.javaparser.utils.CodeGenerationUtils.f; +import static com.github.javaparser.utils.CodeGenerationUtils.optionalOf; +import static com.github.javaparser.utils.Utils.decapitalize; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.generator.AbstractGenerator; +import com.github.javaparser.metamodel.DerivedProperty; +import com.github.javaparser.metamodel.InternalProperty; +import com.github.javaparser.utils.SourceRoot; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.*; + +public class NodeMetaModelGenerator extends AbstractGenerator { + + private final InitializePropertyMetaModelsStatementsGenerator initializePropertyMetaModelsStatementsGenerator = + new InitializePropertyMetaModelsStatementsGenerator(); + private final InitializeConstructorParametersStatementsGenerator + initializeConstructorParametersStatementsGenerator = + new InitializeConstructorParametersStatementsGenerator(); + + public static final String GENERATED_CLASS_COMMENT = + "" + "This file, class, and its contents are completely generated based on:" + + "\n
    " + + "\n
  • The contents and annotations within the package `com.github.javaparser.ast`, and
  • " + + "\n
  • `ALL_NODE_CLASSES` within the class `com.github.javaparser.generator.metamodel.MetaModelGenerator`.
  • " + + "\n
" + + "\n" + + "\nFor this reason, any changes made directly to this file will be overwritten the next time generators are run." + + ""; + + private static final String GENERATED_JAVADOC_COMMENT = + "Warning: The content of this class is partially or completely generated - manual edits risk being overwritten."; + + protected NodeMetaModelGenerator(SourceRoot sourceRoot) { + super(sourceRoot); + } + + public void generate( + Class nodeClass, + ClassOrInterfaceDeclaration metaModelCoid, + NodeList initializeNodeMetaModelsStatements, + NodeList initializePropertyMetaModelsStatements, + NodeList initializeConstructorParametersStatements, + SourceRoot sourceRoot) + throws NoSuchMethodException { + metaModelCoid.setJavadocComment(GENERATED_JAVADOC_COMMENT); + + final AstTypeAnalysis typeAnalysis = new AstTypeAnalysis(nodeClass); + + final String className = MetaModelGenerator.nodeMetaModelName(nodeClass); + final String nodeMetaModelFieldName = decapitalize(className); + metaModelCoid.getFieldByName(nodeMetaModelFieldName).ifPresent(Node::remove); + + initializeNodeMetaModelsStatements.add(parseStatement(f("nodeMetaModels.add(%s);", nodeMetaModelFieldName))); + this.initializeConstructorParametersStatementsGenerator.generate( + nodeClass, initializeConstructorParametersStatements); + + final Class superclass = nodeClass.getSuperclass(); + final String superNodeMetaModel = MetaModelGenerator.nodeMetaModelName(superclass); + final boolean isRootNode = !MetaModelGenerator.isNode(superclass); + + final FieldDeclaration nodeField = + metaModelCoid.addField(className, nodeMetaModelFieldName, PUBLIC, STATIC, FINAL); + annotateGenerated(nodeField); + nodeField + .getVariable(0) + .setInitializer(parseExpression( + f("new %s(%s)", className, optionalOf(decapitalize(superNodeMetaModel), !isRootNode)))); + + // The node-specific metamodel file + final CompilationUnit classMetaModelJavaFile = new CompilationUnit(MetaModelGenerator.METAMODEL_PACKAGE); + classMetaModelJavaFile.setBlockComment(COPYRIGHT_NOTICE_JP_CORE); + classMetaModelJavaFile.addImport(Optional.class); + classMetaModelJavaFile.addImport(nodeClass); + + // + final ClassOrInterfaceDeclaration nodeMetaModelClass = classMetaModelJavaFile.addClass(className, PUBLIC); + annotateGenerated(nodeMetaModelClass); + nodeMetaModelClass.setJavadocComment(GENERATED_CLASS_COMMENT); + + if (isRootNode) { + nodeMetaModelClass.addExtendedType(MetaModelGenerator.BASE_NODE_META_MODEL); + } else { + nodeMetaModelClass.addExtendedType(superNodeMetaModel); + } + + // Constructors + final ConstructorDeclaration classMMConstructor = nodeMetaModelClass + .addConstructor() + .addParameter( + f("Optional<%s>", MetaModelGenerator.BASE_NODE_META_MODEL), + f("super%s", MetaModelGenerator.BASE_NODE_META_MODEL)); + classMMConstructor + .getBody() + .addStatement(parseExplicitConstructorInvocationStmt(f( + "super(super%s, %s.class, \"%s\", \"%s\", %s, %s);", + MetaModelGenerator.BASE_NODE_META_MODEL, + nodeClass.getSimpleName(), + nodeClass.getSimpleName(), + nodeClass.getPackage().getName(), + typeAnalysis.isAbstract, + typeAnalysis.isSelfType))); + annotateGenerated(classMMConstructor); + + // ?Abstract protected constructor? + if (typeAnalysis.isAbstract) { + classMetaModelJavaFile.addImport(Node.class); + BodyDeclaration bodyDeclaration = parseBodyDeclaration(f( + "protected %s(Optional<%s> superNodeMetaModel, Class type, String name, String packageName, boolean isAbstract, boolean hasWildcard) {" + + "super(superNodeMetaModel, type, name, packageName, isAbstract, hasWildcard);" + + " }", + className, MetaModelGenerator.BASE_NODE_META_MODEL)); + annotateGenerated(bodyDeclaration); + nodeMetaModelClass.addMember(bodyDeclaration); + } + + // Fields, sorted by name. + final List fields = new ArrayList<>(Arrays.asList(nodeClass.getDeclaredFields())); + fields.sort(Comparator.comparing(Field::getName)); + for (Field field : fields) { + if (this.fieldShouldBeIgnored(field)) { + continue; + } + + this.initializePropertyMetaModelsStatementsGenerator.generate( + field, nodeMetaModelClass, nodeMetaModelFieldName, initializePropertyMetaModelsStatements); + } + + // Methods, sorted by name. + final List methods = new ArrayList<>(Arrays.asList(nodeClass.getMethods())); + methods.sort(Comparator.comparing(Method::getName)); + for (Method method : methods) { + if (method.isAnnotationPresent(DerivedProperty.class)) { + this.initializePropertyMetaModelsStatementsGenerator.generateDerivedProperty( + method, nodeMetaModelClass, nodeMetaModelFieldName, initializePropertyMetaModelsStatements); + } + } + + this.moveStaticInitializeToTheEndOfTheClassBecauseWeNeedTheFieldsToInitializeFirst(metaModelCoid); + + // Add the file to the source root, enabling it to be saved later. + sourceRoot.add(MetaModelGenerator.METAMODEL_PACKAGE, className + ".java", classMetaModelJavaFile); + } + + private void moveStaticInitializeToTheEndOfTheClassBecauseWeNeedTheFieldsToInitializeFirst( + ClassOrInterfaceDeclaration metaModelCoid) { + for (BodyDeclaration m : metaModelCoid.getMembers()) { + if (m instanceof InitializerDeclaration) { + m.remove(); + metaModelCoid.addMember(m); + return; + } + } + } + + private boolean fieldShouldBeIgnored(Field reflectionField) { + return java.lang.reflect.Modifier.isStatic(reflectionField.getModifiers()) + || reflectionField.isAnnotationPresent(InternalProperty.class); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/pom.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/pom.xml new file mode 100644 index 0000000..7d369d9 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/pom.xml @@ -0,0 +1,71 @@ + + + javaparser-parent + com.github.javaparser + 3.27.0 + + 4.0.0 + + javaparser-core-serialization + Serializers for the JavaParser AST. + + + + GNU Lesser General Public License + http://www.gnu.org/licenses/lgpl-3.0.html + repo + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + 1.8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + com.github.javaparser.core.serialization + + + + + + + + + + + org.junit.jupiter + junit-jupiter-engine + + + com.github.javaparser + javaparser-core + ${project.version} + + + jakarta.json + jakarta.json-api + 2.1.3 + + + + org.eclipse.parsson + parsson + 1.1.7 + test + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/main/java/com/github/javaparser/serialization/JavaParserJsonDeserializer.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/main/java/com/github/javaparser/serialization/JavaParserJsonDeserializer.java new file mode 100644 index 0000000..ad4d609 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/main/java/com/github/javaparser/serialization/JavaParserJsonDeserializer.java @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.serialization; + +import static com.github.javaparser.ast.NodeList.toNodeList; +import static com.github.javaparser.metamodel.JavaParserMetaModel.getNodeMetaModel; +import static com.github.javaparser.serialization.JavaParserJsonSerializer.*; + +import com.github.javaparser.*; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.Log; +import jakarta.json.JsonArray; +import jakarta.json.JsonObject; +import jakarta.json.JsonReader; +import jakarta.json.JsonValue; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +/** + * Deserializes the JSON file that was built by {@link JavaParserJsonSerializer}. + */ +public class JavaParserJsonDeserializer { + /** + * Deserializes json, contained by JsonReader, into AST node. + * The root node and all its child nodes will be deserialized. + * @param reader json-p reader (object-level reader,
see their docs) + * @return the root level deserialized node + */ + public Node deserializeObject(JsonReader reader) { + Log.info("Deserializing JSON to Node."); + JsonObject jsonObject = reader.readObject(); + return deserializeObject(jsonObject); + } + + /** + * Recursive depth-first deserializing method that creates a Node instance from JsonObject. + * + * @param nodeJson json object at current level containg values as properties + * @return deserialized node including all children. + * @implNote the Node instance will be constructed by the properties defined in the meta model. + * Non meta properties will be set after Node is instantiated. + * @implNote comment is included in the propertyKey meta model, but not set when constructing the Node instance. + * That is, comment is not included in the constructor propertyKey list, and therefore needs to be set + * after constructing the node. + * See {@link com.github.javaparser.metamodel.BaseNodeMetaModel#construct(Map)} how the node is contructed + */ + private Node deserializeObject(JsonObject nodeJson) { + try { + String serializedNodeType = nodeJson.getString(JsonNode.CLASS.propertyKey); + BaseNodeMetaModel nodeMetaModel = getNodeMetaModel(Class.forName(serializedNodeType)) + .orElseThrow(() -> new IllegalStateException( + "Trying to deserialize an unknown node type: " + serializedNodeType)); + Map parameters = new HashMap<>(); + Map deferredJsonValues = new HashMap<>(); + + for (String name : nodeJson.keySet()) { + if (name.equals(JsonNode.CLASS.propertyKey)) { + continue; + } + + Optional optionalPropertyMetaModel = + nodeMetaModel.getAllPropertyMetaModels().stream() + .filter(mm -> mm.getName().equals(name)) + .findFirst(); + if (!optionalPropertyMetaModel.isPresent()) { + deferredJsonValues.put(name, nodeJson.get(name)); + continue; + } + + PropertyMetaModel propertyMetaModel = optionalPropertyMetaModel.get(); + if (propertyMetaModel.isNodeList()) { + JsonArray nodeListJson = nodeJson.getJsonArray(name); + parameters.put(name, deserializeNodeList(nodeListJson)); + } else if (propertyMetaModel.isNode()) { + parameters.put(name, deserializeObject(nodeJson.getJsonObject(name))); + } else { + Class type = propertyMetaModel.getType(); + if (type == String.class) { + parameters.put(name, nodeJson.getString(name)); + } else if (type == boolean.class) { + parameters.put(name, Boolean.parseBoolean(nodeJson.getString(name))); + } else if (Enum.class.isAssignableFrom(type)) { + parameters.put(name, Enum.valueOf((Class) type, nodeJson.getString(name))); + } else { + throw new IllegalStateException("Don't know how to convert: " + type); + } + } + } + + Node node = nodeMetaModel.construct(parameters); + // COMMENT is in the propertyKey meta model, but not required as constructor parameter. + // Set it after construction + if (parameters.containsKey(JsonNode.COMMENT.propertyKey)) { + node.setComment((Comment) parameters.get(JsonNode.COMMENT.propertyKey)); + } + + for (String name : deferredJsonValues.keySet()) { + if (!readNonMetaProperties(name, deferredJsonValues.get(name), node)) { + throw new IllegalStateException( + "Unknown propertyKey: " + nodeMetaModel.getQualifiedClassName() + "." + name); + } + } + setSymbolResolverIfCompilationUnit(node); + + return node; + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + + private NodeList deserializeNodeList(JsonArray nodeListJson) { + return nodeListJson.stream() + .map(nodeJson -> deserializeObject((JsonObject) nodeJson)) + .collect(toNodeList()); + } + + /** + * Reads properties from json not included in meta model (i.e., RANGE and TOKEN_RANGE). + * When read, it sets the deserialized value to the node instance. + * @param name propertyKey name for json value + * @param jsonValue json value that needs to be deserialized for this propertyKey + * @param node instance to which the deserialized value will be set to + * @return true if propertyKey is read from json and set to Node instance + */ + protected boolean readNonMetaProperties(String name, JsonValue jsonValue, Node node) { + return readRange(name, jsonValue, node) || readTokenRange(name, jsonValue, node); + } + + protected boolean readRange(String name, JsonValue jsonValue, Node node) { + if (name.equals(JsonNode.RANGE.propertyKey)) { + JsonObject jsonObject = (JsonObject) jsonValue; + Position begin = new Position( + jsonObject.getInt(JsonRange.BEGIN_LINE.propertyKey), + jsonObject.getInt(JsonRange.BEGIN_COLUMN.propertyKey)); + Position end = new Position( + jsonObject.getInt(JsonRange.END_LINE.propertyKey), + jsonObject.getInt(JsonRange.END_COLUMN.propertyKey)); + node.setRange(new Range(begin, end)); + return true; + } + return false; + } + + protected boolean readTokenRange(String name, JsonValue jsonValue, Node node) { + if (name.equals(JsonNode.TOKEN_RANGE.propertyKey)) { + JsonObject jsonObject = (JsonObject) jsonValue; + JavaToken begin = readToken(JsonTokenRange.BEGIN_TOKEN.propertyKey, jsonObject); + JavaToken end = readToken(JsonTokenRange.END_TOKEN.propertyKey, jsonObject); + node.setTokenRange(new TokenRange(begin, end)); + return true; + } + return false; + } + + protected JavaToken readToken(String name, JsonObject jsonObject) { + JsonObject tokenJson = jsonObject.getJsonObject(name); + return new JavaToken( + tokenJson.getInt(JsonToken.KIND.propertyKey), tokenJson.getString(JsonToken.TEXT.propertyKey)); + } + + /** + * This method sets symbol resolver to Node if it is an instance of CompilationUnit + * and a SymbolResolver is configured in the static configuration. This is necessary to be able to resolve symbols + * within the cu after deserialization. Normally, when parsing java with JavaParser, the symbol resolver is injected + * to the cu as a data element with key SYMBOL_RESOLVER_KEY. + * @param node instance to which symbol resolver will be set to when instance of a Compilation Unit + * @see com.github.javaparser.ast.Node#SYMBOL_RESOLVER_KEY + * @see com.github.javaparser.ParserConfiguration#ParserConfiguration() + */ + private void setSymbolResolverIfCompilationUnit(Node node) { + if (node instanceof CompilationUnit + && StaticJavaParser.getConfiguration().getSymbolResolver().isPresent()) { + CompilationUnit cu = (CompilationUnit) node; + cu.setData( + Node.SYMBOL_RESOLVER_KEY, + StaticJavaParser.getConfiguration().getSymbolResolver().get()); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/main/java/com/github/javaparser/serialization/JavaParserJsonSerializer.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/main/java/com/github/javaparser/serialization/JavaParserJsonSerializer.java new file mode 100644 index 0000000..725db49 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/main/java/com/github/javaparser/serialization/JavaParserJsonSerializer.java @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.serialization; + +import static com.github.javaparser.utils.Utils.decapitalize; +import static java.util.Objects.requireNonNull; + +import com.github.javaparser.JavaToken; +import com.github.javaparser.Range; +import com.github.javaparser.TokenRange; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.metamodel.BaseNodeMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import com.github.javaparser.metamodel.PropertyMetaModel; +import com.github.javaparser.utils.Log; +import jakarta.json.stream.JsonGenerator; + +/** + * Serializes an AST or a partial AST to JSON. + */ +public class JavaParserJsonSerializer { + + /** + * Serializes node and all its children into json. Any node siblings will be ignored. + * + * @param node the node that will be the root level json object + * @param generator the json-p generator for writing the json + * @see json-p + */ + public void serialize(Node node, JsonGenerator generator) { + requireNonNull(node); + Log.info("Serializing Node to JSON."); + try { + serialize(null, node, generator); + } finally { + generator.close(); + } + } + + /** + * Recursive depth-first method that serializes nodes into json + * + * @param nodeName nullable String. If null, it is the root object, otherwise it is the property key for the object + * @param node the current node to be serialized + * @param generator the json-p generator for writing the json + */ + private void serialize(String nodeName, Node node, JsonGenerator generator) { + requireNonNull(node); + BaseNodeMetaModel nodeMetaModel = JavaParserMetaModel.getNodeMetaModel(node.getClass()) + .orElseThrow(() -> new IllegalStateException("Unknown Node: " + node.getClass())); + + if (nodeName == null) { + generator.writeStartObject(); + } else { + generator.writeStartObject(nodeName); + } + generator.write(JsonNode.CLASS.propertyKey, node.getClass().getName()); + this.writeNonMetaProperties(node, generator); + for (PropertyMetaModel propertyMetaModel : nodeMetaModel.getAllPropertyMetaModels()) { + String name = propertyMetaModel.getName(); + Object value = propertyMetaModel.getValue(node); + if (value != null) { + if (propertyMetaModel.isNodeList()) { + NodeList list = (NodeList) value; + generator.writeStartArray(name); + for (Node n : list) { + serialize(null, n, generator); + } + generator.writeEnd(); + } else if (propertyMetaModel.isNode()) { + serialize(name, (Node) value, generator); + } else { + generator.write(name, value.toString()); + } + } + } + generator.writeEnd(); + } + + /*** + * This method writes json for properties not included in meta model (i.e., RANGE and TOKEN_RANGE). + * This method could be overriden so that - for example - tokens are not written to json to save space + * + * @see com.github.javaparser.metamodel.BaseNodeMetaModel#getAllPropertyMetaModels() + */ + protected void writeNonMetaProperties(Node node, JsonGenerator generator) { + this.writeRange(node, generator); + this.writeTokens(node, generator); + } + + protected void writeRange(Node node, JsonGenerator generator) { + if (node.hasRange()) { + Range range = node.getRange().get(); + generator.writeStartObject(JsonNode.RANGE.propertyKey); + generator.write(JsonRange.BEGIN_LINE.propertyKey, range.begin.line); + generator.write(JsonRange.BEGIN_COLUMN.propertyKey, range.begin.column); + generator.write(JsonRange.END_LINE.propertyKey, range.end.line); + generator.write(JsonRange.END_COLUMN.propertyKey, range.end.column); + generator.writeEnd(); + } + } + + protected void writeTokens(Node node, JsonGenerator generator) { + if (node.getTokenRange().isPresent()) { + TokenRange tokenRange = node.getTokenRange().get(); + generator.writeStartObject(JsonNode.TOKEN_RANGE.propertyKey); + writeToken(JsonTokenRange.BEGIN_TOKEN.propertyKey, tokenRange.getBegin(), generator); + writeToken(JsonTokenRange.END_TOKEN.propertyKey, tokenRange.getEnd(), generator); + generator.writeEnd(); + } + } + + protected void writeToken(String name, JavaToken token, JsonGenerator generator) { + generator.writeStartObject(name); + generator.write(JsonToken.KIND.propertyKey, token.getKind()); + generator.write(JsonToken.TEXT.propertyKey, token.getText()); + generator.writeEnd(); + } + + /** + * excludes properties from meta model (except comment) + **/ + public enum JsonNode { + RANGE("range"), + TOKEN_RANGE("tokenRange"), + COMMENT(decapitalize(JavaParserMetaModel.commentMetaModel.getTypeName())), + CLASS("!"); + final String propertyKey; + + JsonNode(String p) { + this.propertyKey = p; + } + + public String toString() { + return this.propertyKey; + } + } + + public enum JsonRange { + BEGIN_LINE("beginLine"), + BEGIN_COLUMN("beginColumn"), + END_LINE("endLine"), + END_COLUMN("endColumn"); + final String propertyKey; + + JsonRange(String p) { + this.propertyKey = p; + } + + public String toString() { + return this.propertyKey; + } + } + + public enum JsonTokenRange { + BEGIN_TOKEN("beginToken"), + END_TOKEN("endToken"); + final String propertyKey; + + JsonTokenRange(String p) { + this.propertyKey = p; + } + + public String toString() { + return this.propertyKey; + } + } + + public enum JsonToken { + TEXT("text"), + KIND("kind"); + final String propertyKey; + + JsonToken(String p) { + this.propertyKey = p; + } + + public String toString() { + return this.propertyKey; + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/test/java/com/github/javaparser/serialization/JavaParserJsonDeserializerTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/test/java/com/github/javaparser/serialization/JavaParserJsonDeserializerTest.java new file mode 100644 index 0000000..1ae8405 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/test/java/com/github/javaparser/serialization/JavaParserJsonDeserializerTest.java @@ -0,0 +1,239 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.serialization; + +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.serialization.JavaParserJsonSerializerTest.serialize; +import static com.github.javaparser.utils.Utils.normalizeEolInTextBlock; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.Range; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.TokenRange; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.JavadocBlockTag; +import com.github.javaparser.resolution.SymbolResolver; +import com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration; +import com.github.javaparser.resolution.types.ResolvedType; +import com.github.javaparser.utils.LineSeparator; +import jakarta.json.Json; +import java.io.StringReader; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; + +class JavaParserJsonDeserializerTest { + private final JavaParserJsonDeserializer deserializer = new JavaParserJsonDeserializer(); + + @Test + void simpleTest() { + CompilationUnit cu = parse("public class X{} class Z{}"); + String serialized = serialize(cu, false); + + Node deserialized = deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertEqualsStringIgnoringEol("public class X {\n}\n\nclass Z {\n}\n", deserialized.toString()); + assertEquals(cu.hashCode(), deserialized.hashCode()); + } + + @Test + void testRawType() { + Type type = parseType("Blub"); + String serialized = serialize(type, false); + + Node deserialized = deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertEqualsStringIgnoringEol("Blub", deserialized.toString()); + assertEquals(type.hashCode(), deserialized.hashCode()); + } + + @Test + void testDiamondType() { + Type type = parseType("Blub<>"); + String serialized = serialize(type, false); + + Node deserialized = deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertEqualsStringIgnoringEol("Blub<>", deserialized.toString()); + assertEquals(type.hashCode(), deserialized.hashCode()); + } + + @Test + void testGenerics() { + Type type = parseType("Blub"); + String serialized = serialize(type, false); + + Node deserialized = deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertEqualsStringIgnoringEol("Blub", deserialized.toString()); + assertEquals(type.hashCode(), deserialized.hashCode()); + } + + @Test + void testOperator() { + Expression expr = parseExpression("1+1"); + String serialized = serialize(expr, false); + + Node deserialized = deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertEqualsStringIgnoringEol("1 + 1", deserialized.toString()); + assertEquals(expr.hashCode(), deserialized.hashCode()); + } + + @Test + void testPrimitiveType() { + Type type = parseType("int"); + String serialized = serialize(type, false); + + Node deserialized = deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertEqualsStringIgnoringEol("int", deserialized.toString()); + assertEquals(type.hashCode(), deserialized.hashCode()); + } + + @Test + void testComment() { + CompilationUnit cu = parse("/* block comment */\npublic class X{ \n // line comment\npublic void test() {}\n}"); + String serialized = serialize(cu, false); + + CompilationUnit deserialized = + (CompilationUnit) deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + ClassOrInterfaceDeclaration classXDeclaration = + deserialized.getClassByName("X").get(); + assertTrue(classXDeclaration.getComment().isPresent()); + + Comment comment = classXDeclaration.getComment().get(); + assertEquals( + "com.github.javaparser.ast.comments.BlockComment", + comment.getClass().getName()); + assertEquals(" block comment ", comment.getContent()); + + MethodDeclaration methodDeclaration = classXDeclaration.getMethods().get(0); + assertTrue(methodDeclaration.getComment().isPresent()); + assertEquals( + "com.github.javaparser.ast.comments.LineComment", + methodDeclaration.getComment().get().getClass().getName()); + assertEquals(" line comment", methodDeclaration.getComment().get().getContent()); + } + + @Test + void testJavaDocComment() { + CompilationUnit cu = parse("public class X{ " + " /**\n" + + " * Woke text.\n" + + " * @param a blub\n" + + " * @return true \n" + + " */" + + " public boolean test(int a) { return true; }\n" + + "}"); + String serialized = serialize(cu, false); + + CompilationUnit deserialized = + (CompilationUnit) deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + ClassOrInterfaceDeclaration classDeclaration = + deserialized.getClassByName("X").get(); + MethodDeclaration methodDeclaration = classDeclaration.getMethods().get(0); + assertTrue(methodDeclaration.getJavadoc().isPresent()); + Javadoc javadoc = methodDeclaration.getJavadoc().get(); + + JavadocBlockTag paramBlockTag = javadoc.getBlockTags().get(0); + assertEquals("param", paramBlockTag.getTagName()); + assertEquals("blub", paramBlockTag.getContent().toText()); + + JavadocBlockTag returnBlockTag = javadoc.getBlockTags().get(1); + assertEquals("return", returnBlockTag.getTagName()); + assertEquals("true", returnBlockTag.getContent().toText()); + } + + @Test + void testNonMetaProperties() { + CompilationUnit cu = parse("public class X{} class Z{}"); + String serialized = serialize(cu, false); + + CompilationUnit deserialized = + (CompilationUnit) deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + + assertTrue(deserialized.hasRange()); + Range range = deserialized.getRange().get(); + assertEquals(1, range.begin.line); + assertEquals(1, range.begin.line); + assertEquals(26, range.end.column); + + assertTrue(deserialized.getTokenRange().isPresent()); + TokenRange tokenRange = deserialized.getTokenRange().get(); + assertEquals("public", tokenRange.getBegin().getText()); + assertEquals("", tokenRange.getEnd().getText()); + } + + @Test + void testAttachingSymbolResolver() { + SymbolResolver stubResolver = new SymbolResolver() { + @Override + public T resolveDeclaration(Node node, Class resultClass) { + return null; + } + + @Override + public T toResolvedType(Type javaparserType, Class resultClass) { + return null; + } + + @Override + public ResolvedType calculateType(Expression expression) { + return null; + } + + @Override + public ResolvedReferenceTypeDeclaration toTypeDeclaration(Node node) { + return null; + } + }; + StaticJavaParser.getConfiguration().setSymbolResolver(stubResolver); + CompilationUnit cu = parse("public class X{} class Z{}"); + String serialized = serialize(cu, false); + + CompilationUnit deserialized = + (CompilationUnit) deserializer.deserializeObject(Json.createReader(new StringReader(serialized))); + assertTrue(deserialized.containsData(Node.SYMBOL_RESOLVER_KEY)); + assertEquals(stubResolver, deserialized.getData(Node.SYMBOL_RESOLVER_KEY)); + } + + @AfterAll + static void clearConfiguration() { + StaticJavaParser.setConfiguration(new ParserConfiguration()); + } + + /** + * Assert that "actual" equals "expected", and that any EOL characters in "actual" are correct for the platform. + */ + private static void assertEqualsStringIgnoringEol(String expected, String actual) { + assertEquals( + normalizeEolInTextBlock(expected, LineSeparator.ARBITRARY), + normalizeEolInTextBlock(actual, LineSeparator.ARBITRARY)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/test/java/com/github/javaparser/serialization/JavaParserJsonSerializerTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/test/java/com/github/javaparser/serialization/JavaParserJsonSerializerTest.java new file mode 100644 index 0000000..96a114c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-serialization/src/test/java/com/github/javaparser/serialization/JavaParserJsonSerializerTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.serialization; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import jakarta.json.Json; +import jakarta.json.stream.JsonGenerator; +import jakarta.json.stream.JsonGeneratorFactory; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class JavaParserJsonSerializerTest { + @Test + void test() { + CompilationUnit cu = parse("class X{java.util.Y y;}"); + + String serialized = serialize(cu, false); + + assertEquals( + "{\"!\":\"com.github.javaparser.ast.CompilationUnit\",\"range\":{\"beginLine\":1,\"beginColumn\":1,\"endLine\":1,\"endColumn\":23},\"tokenRange\":{\"beginToken\":{\"kind\":19,\"text\":\"class\"},\"endToken\":{\"kind\":0,\"text\":\"\"}},\"imports\":[],\"types\":[{\"!\":\"com.github.javaparser.ast.body.ClassOrInterfaceDeclaration\",\"range\":{\"beginLine\":1,\"beginColumn\":1,\"endLine\":1,\"endColumn\":23},\"tokenRange\":{\"beginToken\":{\"kind\":19,\"text\":\"class\"},\"endToken\":{\"kind\":104,\"text\":\"}\"}},\"extendedTypes\":[],\"implementedTypes\":[],\"isInterface\":\"false\",\"permittedTypes\":[],\"typeParameters\":[],\"members\":[{\"!\":\"com.github.javaparser.ast.body.FieldDeclaration\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":22},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"java\"},\"endToken\":{\"kind\":107,\"text\":\";\"}},\"modifiers\":[],\"variables\":[{\"!\":\"com.github.javaparser.ast.body.VariableDeclarator\",\"range\":{\"beginLine\":1,\"beginColumn\":21,\"endLine\":1,\"endColumn\":21},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"y\"},\"endToken\":{\"kind\":98,\"text\":\"y\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":21,\"endLine\":1,\"endColumn\":21},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"y\"},\"endToken\":{\"kind\":98,\"text\":\"y\"}},\"identifier\":\"y\"},\"type\":{\"!\":\"com.github.javaparser.ast.type.ClassOrInterfaceType\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":19},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"java\"},\"endToken\":{\"kind\":98,\"text\":\"Y\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":19,\"endLine\":1,\"endColumn\":19},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"Y\"},\"endToken\":{\"kind\":98,\"text\":\"Y\"}},\"identifier\":\"Y\"},\"scope\":{\"!\":\"com.github.javaparser.ast.type.ClassOrInterfaceType\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":17},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"java\"},\"endToken\":{\"kind\":98,\"text\":\"util\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":14,\"endLine\":1,\"endColumn\":17},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"util\"},\"endToken\":{\"kind\":98,\"text\":\"util\"}},\"identifier\":\"util\"},\"scope\":{\"!\":\"com.github.javaparser.ast.type.ClassOrInterfaceType\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":12},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"java\"},\"endToken\":{\"kind\":98,\"text\":\"java\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":12},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"java\"},\"endToken\":{\"kind\":98,\"text\":\"java\"}},\"identifier\":\"java\"},\"annotations\":[]},\"annotations\":[]},\"annotations\":[]}}],\"annotations\":[]}],\"modifiers\":[],\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":7,\"endLine\":1,\"endColumn\":7},\"tokenRange\":{\"beginToken\":{\"kind\":98,\"text\":\"X\"},\"endToken\":{\"kind\":98,\"text\":\"X\"}},\"identifier\":\"X\"},\"annotations\":[]}]}", + serialized); + } + + static String serialize(Node node, boolean prettyPrint) { + Map config = new HashMap<>(); + if (prettyPrint) { + config.put(JsonGenerator.PRETTY_PRINTING, null); + } + JsonGeneratorFactory generatorFactory = Json.createGeneratorFactory(config); + JavaParserJsonSerializer serializer = new JavaParserJsonSerializer(); + StringWriter jsonWriter = new StringWriter(); + try (JsonGenerator generator = generatorFactory.createGenerator(jsonWriter)) { + serializer.serialize(node, generator); + } + return jsonWriter.toString(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/pom.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/pom.xml new file mode 100644 index 0000000..63656ce --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/pom.xml @@ -0,0 +1,78 @@ + + + javaparser-parent + com.github.javaparser + 3.27.0 + + 4.0.0 + + javaparser-core-testing-bdd + The BDD test suite for javaparser-core + + + + GNU Lesser General Public License + http://www.gnu.org/licenses/lgpl-3.0.html + repo + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + + + org.jacoco + jacoco-maven-plugin + + + org.apache.maven.plugins + maven-deploy-plugin + + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + plain + true + @{jacoco.javaagent} + + + + + + + com.github.javaparser + javaparser-core + ${project.version} + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.vintage + junit-vintage-engine + + + org.jbehave + jbehave-core + 5.2.0 + test + + + org.hamcrest + hamcrest + test + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/BasicJBehaveTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/BasicJBehaveTest.java new file mode 100644 index 0000000..c70646d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/BasicJBehaveTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.jbehave.core.io.CodeLocations.codeLocationFromClass; + +import java.util.List; +import org.jbehave.core.configuration.Configuration; +import org.jbehave.core.configuration.MostUsefulConfiguration; +import org.jbehave.core.failures.FailingUponPendingStep; +import org.jbehave.core.io.LoadFromClasspath; +import org.jbehave.core.io.StoryFinder; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.junit.JUnitStories; +import org.jbehave.core.reporters.Format; +import org.jbehave.core.reporters.StoryReporterBuilder; + +abstract class BasicJBehaveTest extends JUnitStories { + + private final String storiesPath; + + BasicJBehaveTest(String storiesPath) { + this.storiesPath = storiesPath; + JUnit4StoryRunner.recommendedControls(configuredEmbedder()); + } + + @Override + public final Configuration configuration() { + return new MostUsefulConfiguration() + // where to find the stories + .useStoryLoader(new LoadFromClasspath(this.getClass())) + // Fails if Steps are not implemented + .usePendingStepStrategy(new FailingUponPendingStep()) + // CONSOLE and HTML reporting + .useStoryReporterBuilder( + new StoryReporterBuilder().withDefaultFormats().withFormats(Format.CONSOLE, Format.HTML)); + } + + @Override + public final List storyPaths() { + return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()), storiesPath, ""); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/CommentParsingTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/CommentParsingTest.java new file mode 100644 index 0000000..f38e46b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/CommentParsingTest.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.CommentParsingSteps; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class CommentParsingTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + return new InstanceStepsFactory(configuration(), new CommentParsingSteps()); + } + + public CommentParsingTest() { + super("**/comment*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ComparingTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ComparingTest.java new file mode 100644 index 0000000..db095ea --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ComparingTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.ComparingSteps; +import com.github.javaparser.steps.SharedSteps; +import java.util.HashMap; +import java.util.Map; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class ComparingTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + Map state = new HashMap<>(); + + return new InstanceStepsFactory(configuration(), new SharedSteps(state), new ComparingSteps()); + } + + public ComparingTest() { + super("**/comparing*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ManipulationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ManipulationTest.java new file mode 100644 index 0000000..c7b0d0f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ManipulationTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.ManipulationSteps; +import com.github.javaparser.steps.SharedSteps; +import java.util.HashMap; +import java.util.Map; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class ManipulationTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + Map state = new HashMap<>(); + + return new InstanceStepsFactory(configuration(), new SharedSteps(state), new ManipulationSteps(state)); + } + + public ManipulationTest() { + super("**/manipulation*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ParsingTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ParsingTest.java new file mode 100644 index 0000000..0ca62fe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/ParsingTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.ParsingSteps; +import com.github.javaparser.steps.SharedSteps; +import java.util.HashMap; +import java.util.Map; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class ParsingTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + Map state = new HashMap<>(); + + return new InstanceStepsFactory(configuration(), new SharedSteps(state), new ParsingSteps(state)); + } + + public ParsingTest() { + super("**/parsing*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/PositionRangeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/PositionRangeTest.java new file mode 100644 index 0000000..90d74fb --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/PositionRangeTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.PositionRangeSteps; +import com.github.javaparser.steps.SharedSteps; +import java.util.HashMap; +import java.util.Map; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class PositionRangeTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + Map state = new HashMap<>(); + + return new InstanceStepsFactory(configuration(), new SharedSteps(state), new PositionRangeSteps()); + } + + public PositionRangeTest() { + super("**/position_range*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/PrettyPrintingTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/PrettyPrintingTest.java new file mode 100644 index 0000000..4d555b1 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/PrettyPrintingTest.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.PrettyPrintingSteps; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class PrettyPrintingTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + return new InstanceStepsFactory(configuration(), new PrettyPrintingSteps()); + } + + public PrettyPrintingTest() { + super("**/pretty_printing*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/TestUtils.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/TestUtils.java new file mode 100644 index 0000000..4d11e7e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/TestUtils.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import java.io.InputStream; + +public class TestUtils { + + public static InputStream getSampleStream(String sampleName) { + InputStream is = TestUtils.class + .getClassLoader() + .getResourceAsStream("com/github/javaparser/samples/" + sampleName + ".java"); + if (is == null) { + throw new RuntimeException("Example not found, check your test. Sample name: " + sampleName); + } + return is; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/VisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/VisitorTest.java new file mode 100644 index 0000000..1886780 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/VisitorTest.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.steps.SharedSteps; +import com.github.javaparser.steps.VisitorSteps; +import java.util.HashMap; +import java.util.Map; +import org.jbehave.core.junit.JUnit4StoryRunner; +import org.jbehave.core.steps.InjectableStepsFactory; +import org.jbehave.core.steps.InstanceStepsFactory; +import org.junit.runner.RunWith; + +@RunWith(JUnit4StoryRunner.class) +public class VisitorTest extends BasicJBehaveTest { + + @Override + public InjectableStepsFactory stepsFactory() { + Map state = new HashMap<>(); + return new InstanceStepsFactory(configuration(), new SharedSteps(state), new VisitorSteps(state)); + } + + public VisitorTest() { + super("**/visitor*.story"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/CommentParsingSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/CommentParsingSteps.java new file mode 100644 index 0000000..4b1229a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/CommentParsingSteps.java @@ -0,0 +1,440 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.Range.range; +import static com.github.javaparser.steps.SharedSteps.getMemberByTypeAndPosition; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.text.IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +import com.github.javaparser.*; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.*; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.printer.PrettyPrinter; +import com.github.javaparser.printer.Printer; +import com.github.javaparser.printer.configuration.PrettyPrinterConfiguration; +import java.nio.charset.Charset; +import java.util.Iterator; +import java.util.Set; +import org.jbehave.core.annotations.Alias; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; +import org.jbehave.core.model.ExamplesTable; +import org.jbehave.core.steps.Parameters; + +public class CommentParsingSteps { + + private CompilationUnit compilationUnit; + private CommentsCollection commentsCollection; + private String sourceUnderTest; + private ParserConfiguration configuration = new ParserConfiguration(); + private Printer prettyPrinter = new PrettyPrinter(new PrettyPrinterConfiguration()); + + @Given("the class:$classSrc") + public void givenTheClass(String classSrc) { + this.sourceUnderTest = classSrc.trim(); + } + + @When("read sample \"$sampleName\" using encoding \"$encoding\"") + public void givenTheClassWithEncoding(String sampleName, String encoding) { + sourceUnderTest = null; + ParseResult parseResult = new JavaParser(new ParserConfiguration()) + .parse(COMPILATION_UNIT, provider(TestUtils.getSampleStream(sampleName), Charset.forName(encoding))); + commentsCollection = parseResult.getCommentsCollection().orElse(new CommentsCollection()); + } + + @When("the class is parsed by the comment parser") + public void whenTheClassIsParsedByTheCommentParser() { + ParseResult parseResult = + new JavaParser(new ParserConfiguration()).parse(COMPILATION_UNIT, provider(sourceUnderTest)); + commentsCollection = parseResult.getCommentsCollection().orElse(new CommentsCollection()); + } + + @When("the do not consider annotations as node start for code attribution is $value on the Java parser") + public void whenTheDoNotConsiderAnnotationsAsNodeStartForCodeAttributionIsTrueOnTheJavaParser(boolean value) { + configuration.setIgnoreAnnotationsWhenAttributingComments(value); + } + + @When("the do not assign comments preceding empty lines is $value on the Java parser") + public void whenTheDoNotAssignCommentsPrecedingEmptyLinesIsTrueOnTheJavaParser(boolean value) { + configuration.setDoNotAssignCommentsPrecedingEmptyLines(value); + } + + @When("the class is parsed by the Java parser") + public void whenTheClassIsParsedByTheJavaParser() { + ParseResult result = + new JavaParser(configuration).parse(COMPILATION_UNIT, provider(sourceUnderTest)); + compilationUnit = result.getResult().get(); + } + + @Then("the Java parser cannot parse it because of an error") + public void javaParserCannotParseBecauseOfLexicalErrors() { + ParseResult result = + new JavaParser(configuration).parse(COMPILATION_UNIT, provider(sourceUnderTest)); + if (result.isSuccessful()) { + fail("Lexical error expected"); + } + } + + @Then("the total number of comments is $expectedCount") + public void thenTheTotalNumberOfCommentsIs(int expectedCount) { + assertThat(commentsCollection.size(), is(expectedCount)); + } + + private T getCommentAt(Set set, int index) { + Iterator iterator = set.iterator(); + T comment = null; + while (index >= 0) { + comment = iterator.next(); + index--; + } + return comment; + } + + @Then("line comment $position is \"$expectedContent\"") + public void thenLineCommentIs(int position, String expectedContent) { + LineComment lineCommentUnderTest = getCommentAt(commentsCollection.getLineComments(), position - 1); + + assertThat(lineCommentUnderTest.getContent(), is(expectedContent)); + } + + @Then("block comment $position is \"$expectedContent\"") + public void thenBlockCommentIs(int position, String expectedContent) { + BlockComment lineCommentUnderTest = getCommentAt(commentsCollection.getBlockComments(), position - 1); + + assertThat(lineCommentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("Javadoc comment $position is \"$expectedContent\"") + public void thenJavadocCommentIs(int position, String expectedContent) { + JavadocComment commentUnderTest = getCommentAt(commentsCollection.getJavadocComments(), position - 1); + + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("the line comments have the following positions: $table") + public void thenTheLineCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) { + int index = 0; + for (Parameters exampleRow : examplesTable.getRowsAsParameters()) { + Comment expectedLineComment = toComment(exampleRow, new LineComment()); + Comment lineCommentUnderTest = getCommentAt(commentsCollection.getLineComments(), index); + + Range underTestRange = lineCommentUnderTest.getRange().get(); + Range expectedRange = expectedLineComment.getRange().get(); + + assertThat(underTestRange.begin.line, is(expectedRange.begin.line)); + assertThat(underTestRange.begin.column, is(expectedRange.begin.column)); + assertThat(underTestRange.end.line, is(expectedRange.end.line)); + assertThat(underTestRange.end.column, is(expectedRange.end.column)); + index++; + } + } + + @Then("the block comments have the following positions: $table") + public void thenTheBlockCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) { + int index = 0; + for (Parameters exampleRow : examplesTable.getRowsAsParameters()) { + Comment expectedLineComment = toComment(exampleRow, new BlockComment()); + Comment lineCommentUnderTest = getCommentAt(commentsCollection.getBlockComments(), index); + + Range underTestRange = lineCommentUnderTest.getRange().get(); + Range expectedRange = expectedLineComment.getRange().get(); + + assertThat(underTestRange.begin.line, is(expectedRange.begin.line)); + assertThat(underTestRange.begin.column, is(expectedRange.begin.column)); + assertThat(underTestRange.end.line, is(expectedRange.end.line)); + assertThat(underTestRange.end.column, is(expectedRange.end.column)); + index++; + } + } + + @Then("the Javadoc comments have the following positions: $table") + public void thenTheJavadocCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) { + int index = 0; + for (Parameters exampleRow : examplesTable.getRowsAsParameters()) { + Comment expectedLineComment = toComment(exampleRow, new BlockComment()); + Comment lineCommentUnderTest = getCommentAt(commentsCollection.getJavadocComments(), index); + + Range underTestRange = lineCommentUnderTest.getRange().get(); + Range expectedRange = expectedLineComment.getRange().get(); + + assertThat(underTestRange.begin.line, is(expectedRange.begin.line)); + assertThat(underTestRange.begin.column, is(expectedRange.begin.column)); + assertThat(underTestRange.end.line, is(expectedRange.end.line)); + assertThat(underTestRange.end.column, is(expectedRange.end.column)); + index++; + } + } + + @Then("it is printed as:$src") + public void isPrintedAs(String src) { + assertThat(prettyPrinter.print(compilationUnit).trim(), is(src.trim())); + } + + @Then("the compilation unit is not commented") + public void thenTheCompilationUnitIsNotCommented() { + assertEquals(false, compilationUnit.getComment().isPresent()); + } + + @Then("the compilation is commented \"$expectedContent\"") + public void thenTheCompilationIsCommentedCompilationUnitComment(String expectedContent) { + assertThat(compilationUnit.getComment().get().getContent(), is(expectedContent)); + } + + @Then("the compilation unit has $expectedCount contained comments") + public void thenTheCompilationUnitHasContainedComments(int expectedCount) { + assertThat(compilationUnit.getComments().size(), is(expectedCount)); + } + + @Then("the compilation unit has $expectedCount orphan comments") + public void thenTheCompilationUnitHasExpectedCountOrphanComments(int expectedCount) { + assertThat(compilationUnit.getOrphanComments().size(), is(expectedCount)); + } + + @Then("the compilation unit orphan comment $position is \"$expectedContent\"") + public void thenTheCompilationUnitOrphanCommentIs(int position, String expectedContent) { + Comment commentUnderTest = compilationUnit.getOrphanComments().get(position - 1); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("comment $commentPosition in compilation unit is not an orphan") + public void thenCommentInCompilationUnitIsNotAnOrphan(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.isOrphan(), is(false)); + } + + @Then("comment $commentPosition in compilation unit is an orphan") + public void thenCommentInCompilationUnitIsAnOrphan(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.isOrphan(), is(true)); + } + + @Then("comment $commentPosition in compilation unit is \"$expectedContent\"") + public void thenCommentInCompilationUnitIs(int position, String expectedContent) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(position - 1); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("class $position is not commented") + public void thenClassIsNotCommented(int position) { + TypeDeclaration classUnderTest = compilationUnit.getType(position - 1); + assertEquals(false, classUnderTest.getComment().isPresent()); + } + + @Then("class $position is commented \"$expectedContent\"") + public void thenClassIsCommented(int position, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(position - 1); + assertThat(classUnderTest.getComment().get().getContent(), is(expectedContent)); + } + + @Then("class $position has $expectedCount total contained comments") + public void thenClassHasTotalContainedComments(int position, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(position - 1); + assertThat(classUnderTest.getAllContainedComments().size(), is(expectedCount)); + } + + @Then("class $position has $expectedCount orphan comment") + @Alias("class $position has $expectedCount orphan comments") + public void thenClassHasOrphanComments(int position, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(position - 1); + assertThat(classUnderTest.getOrphanComments().size(), is(expectedCount)); + } + + @Then("class $classPosition orphan comment $commentPosition is \"$expectedContent\"") + public void thenClassOrphanCommentIs(int classPosition, int commentPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + Comment commentUnderTest = classUnderTest.getOrphanComments().get(commentPosition - 1); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("method $methodPosition in class $classPosition is commented \"$expectedContent\"") + public void thenMethodInClassIsCommented(int methodPosition, int classPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + assertThat(methodUnderTest.getComment().get().getContent(), equalToCompressingWhiteSpace(expectedContent)); + } + + @Then("method $methodPosition in class $classPosition has $expectedCount total contained comments") + public void thenMethodInClassHasTotalContainedComments(int methodPosition, int classPosition, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + assertThat(methodUnderTest.getAllContainedComments().size(), is(expectedCount)); + } + + @Then("comment $commentPosition in method $methodPosition in class $classPosition is \"$expectedContent\"") + public void thenCommentInMethodInClassIs( + int commentPosition, int methodPosition, int classPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + Comment commentUnderTest = methodUnderTest.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("method $methodPosition in class $classPosition has $expectedCount orphan comments") + public void thenMethodInClassHasOrphanComments(int methodPosition, int classPosition, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + assertThat(methodUnderTest.getOrphanComments().size(), is(expectedCount)); + } + + @Then( + "block statement in method $methodPosition in class $classPosition has $expectedCount total contained comments") + public void thenBlockStatementInMethodInClassHasTotalContainedComments( + int methodPosition, int classPosition, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null); + assertThat(blockStmtUnderTest.getAllContainedComments().size(), is(expectedCount)); + } + + @Then("block statement in method $methodPosition in class $classPosition has $expectedCount orphan comments") + public void thenBlockStatementInMethodInClassHasOrphanComments( + int methodPosition, int classPosition, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null); + assertThat(blockStmtUnderTest.getOrphanComments().size(), is(expectedCount)); + } + + @Then( + "block statement in method $methodPosition in class $classPosition orphan comment $commentPosition is \"$expectedContent\"") + public void thenBlockStatementInMethodInClassIs( + int methodPosition, int classPosition, int commentPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null); + Comment commentUnderTest = blockStmtUnderTest.getOrphanComments().get(commentPosition - 1); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("type of method $methodPosition in class $classPosition is commented \"$expectedContent\"") + public void thenTypeOfMethodInClassIsCommented(int methodPosition, int classPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + MethodDeclaration methodUnderTest = + getMemberByTypeAndPosition(classUnderTest, methodPosition - 1, MethodDeclaration.class); + Comment commentUnderTest = methodUnderTest.getType().getComment().get(); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then("field $fieldPosition in class $classPosition contains $expectedCount comments") + public void thenFieldInClassContainsComments(int fieldPosition, int classPosition, int expectedCount) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + FieldDeclaration fieldUnderTest = + getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1, FieldDeclaration.class); + assertThat(fieldUnderTest.getAllContainedComments().size(), is(expectedCount)); + } + + @Then("field $fieldPosition in class $classPosition is not commented") + public void thenFieldInClassIsNotCommented(int fieldPosition, int classPosition) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + FieldDeclaration fieldUnderTest = + getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1, FieldDeclaration.class); + assertEquals(false, fieldUnderTest.getComment().isPresent()); + } + + @Then("field $fieldPosition in class $classPosition is commented \"$expectedContent\"") + public void thenFieldInClassIsCommented(int fieldPosition, int classPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + FieldDeclaration fieldUnderTest = + getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1, FieldDeclaration.class); + Comment commentUnderTest = fieldUnderTest.getComment().get(); + assertThat(commentUnderTest.getContent(), is(equalToCompressingWhiteSpace(expectedContent))); + } + + @Then( + "variable $variablePosition value of field $fieldPosition in class $classPosition is commented \"$expectedContent\"") + public void thenVariableValueOfFieldInClassIsCommented( + int variablePosition, int fieldPosition, int classPosition, String expectedContent) { + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + FieldDeclaration fieldUnderTest = + getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1, FieldDeclaration.class); + VariableDeclarator variableUnderTest = fieldUnderTest.getVariable(variablePosition - 1); + Expression valueUnderTest = variableUnderTest.getInitializer().orElse(null); + Comment commentUnderTest = valueUnderTest.getComment().get(); + assertThat(commentUnderTest.getContent(), is(expectedContent)); + } + + @Then("comment $commentPosition in compilation unit parent is ClassOrInterfaceDeclaration") + public void thenCommentInCompilationUnitParentIsClassOrInterfaceDeclaration(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getParentNode().get(), instanceOf(ClassOrInterfaceDeclaration.class)); + } + + @Then("comment $commentPosition in compilation unit commented node is ClassOrInterfaceDeclaration") + public void thenCommentInCompilationUnitCommentedNodeIsClassOrInterfaceDeclaration(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(ClassOrInterfaceDeclaration.class)); + } + + @Then("comment $commentPosition in compilation unit commented node is FieldDeclaration") + public void thenCommentInCompilationUnitCommentedNodeIsFieldDeclaration(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(FieldDeclaration.class)); + } + + @Then("comment $commentPosition in compilation unit commented node is IntegerLiteralExpr") + public void thenCommentInCompilationUnitCommentedNodeIsIntegerLiteralExpr(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(IntegerLiteralExpr.class)); + } + + @Then("comment $commentPosition in compilation unit commented node is ExpressionStmt") + public void thenCommentInCompilationUnitCommentedNodeIsIntegerExpressionStmt(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(ExpressionStmt.class)); + } + + @Then("comment $commentPosition in compilation unit commented node is PrimitiveType") + public void thenCommentInCompilationUnitCommentedNodeIsIntegerPrimitiveType(int commentPosition) { + Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1); + assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(PrimitiveType.class)); + } + + private Comment toComment(Parameters row, Comment comment) { + comment.setRange(range( + Integer.parseInt(row.values().get("beginLine")), + Integer.parseInt(row.values().get("beginColumn")), + Integer.parseInt(row.values().get("endLine")), + Integer.parseInt(row.values().get("endColumn")))); + return comment; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ComparingSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ComparingSteps.java new file mode 100644 index 0000000..53504d5 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ComparingSteps.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import com.github.javaparser.ast.CompilationUnit; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; + +public class ComparingSteps { + + private CompilationUnit first; + private CompilationUnit second; + + /* + * Given steps + */ + + @Given("the first class:$classSrc") + public void givenTheFirstClass(String classSrc) { + this.first = parse(classSrc.trim()); + } + + @Given("the second class:$classSrc") + public void givenTheSecondClass(String classSrc) { + this.second = parse(classSrc.trim()); + } + + /* + * Then steps + */ + + @Then("they are equals") + public void thenTheyAreEquals() { + assertThat(first, is(equalTo(second))); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ExistenceOfParentNodeVerifier.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ExistenceOfParentNodeVerifier.java new file mode 100644 index 0000000..f41f05d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ExistenceOfParentNodeVerifier.java @@ -0,0 +1,550 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.core.Is.is; + +import com.github.javaparser.HasParentNode; +import com.github.javaparser.ast.ArrayCreationLevel; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; + +/** + * The ExistenceOfParentNodeVerifier verifies that each node of the compilation unit has a parent set. + */ +class ExistenceOfParentNodeVerifier { + + public void verify(CompilationUnit compilationUnit) throws AssertionError { + new Verifier().visit(compilationUnit, null); + } + + private static class Verifier extends VoidVisitorAdapter { + private static void assertParentIsSet(HasParentNode n) { + assertThat(n + " has no parent set!", n.getParentNode().orElse(null), is(notNullValue())); + } + + @Override + public void visit(AnnotationDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(AnnotationMemberDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayAccessExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayCreationExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayInitializerExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(AssertStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(AssignExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(BinaryExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(BlockComment n, Void arg) { + super.visit(n, arg); + } + + @Override + public void visit(BlockStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(BooleanLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(BreakStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(CastExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(CatchClause n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(CharLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ClassExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ClassOrInterfaceDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ClassOrInterfaceType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(CompilationUnit n, Void arg) { + super.visit(n, arg); + } + + @Override + public void visit(ConditionalExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ConstructorDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ContinueStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(DoStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(DoubleLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(EmptyStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(EnclosedExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(EnumConstantDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(EnumDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ExplicitConstructorInvocationStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ExpressionStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(FieldAccessExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(FieldDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ForEachStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ForStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(IfStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(InitializerDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(InstanceOfExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(IntegerLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(JavadocComment n, Void arg) { + super.visit(n, arg); + } + + @Override + public void visit(LabeledStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(LineComment n, Void arg) { + super.visit(n, arg); + } + + @Override + public void visit(LambdaExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(LongLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(MarkerAnnotationExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(MemberValuePair n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(MethodCallExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(MethodDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(MethodReferenceExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(NameExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(NormalAnnotationExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(NullLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ObjectCreationExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(PackageDeclaration n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(Parameter n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(PrimitiveType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(Name n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(SimpleName n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayCreationLevel n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(IntersectionType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(UnionType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ReturnStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(SingleMemberAnnotationExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(StringLiteralExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(SuperExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(SwitchEntry n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(SwitchStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(SynchronizedStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ThisExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(ThrowStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(TryStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(LocalClassDeclarationStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(LocalRecordDeclarationStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(TypeExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(NodeList n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(TypeParameter n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(UnaryExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(UnknownType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(VariableDeclarationExpr n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(VariableDeclarator n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(VoidType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(WhileStmt n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + + @Override + public void visit(WildcardType n, Void arg) { + assertParentIsSet(n); + super.visit(n, arg); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ManipulationSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ManipulationSteps.java new file mode 100644 index 0000000..6002ce1 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ManipulationSteps.java @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static com.github.javaparser.ast.Modifier.staticModifier; +import static com.github.javaparser.ast.NodeList.nodeList; +import static com.github.javaparser.ast.type.PrimitiveType.intType; +import static com.github.javaparser.steps.SharedSteps.getMethodByPositionAndClassPosition; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.body.TypeDeclaration; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.VoidType; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import java.util.Map; +import org.jbehave.core.annotations.Alias; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; + +public class ManipulationSteps { + + /* Fields used to maintain step state within this step class */ + private BlockStmt blockStmt; + private Statement statement; + private TryStmt tryStmt; + private NodeList variableDeclarationExprList; + private ChangeMethodNameToUpperCaseVisitor changeMethodNameToUpperCaseVisitor; + private AddNewIntParameterCalledValueVisitor addNewIntParameterCalledValueVisitor; + + /* Map that maintains shares state across step classes. If manipulating the objects in the map you must update the state */ + private Map state; + + public ManipulationSteps(Map state) { + this.state = state; + } + + @Given("a BlockStmt") + public void givenABlockStatement() { + blockStmt = new BlockStmt(); + } + + @Given("a Statement") + public void givenAStatement() { + statement = null; + } + + @Given("a TryStmt") + public void givenATryStmt() { + tryStmt = new TryStmt(); + } + + @Given("a List of VariableDeclarations") + public void givenAListOfVariableDeclarations() { + variableDeclarationExprList = new NodeList<>(); + variableDeclarationExprList.add(new VariableDeclarationExpr()); + variableDeclarationExprList.add(new VariableDeclarationExpr()); + } + + @Given("a ChangeNameToUpperCaseVisitor") + public void givenAChangeNameToUpperCaseVisitor() { + changeMethodNameToUpperCaseVisitor = new ChangeMethodNameToUpperCaseVisitor(); + } + + @Given("a AddNewIntParameterCalledValueVisitor") + public void givenAAddNewParameterCalledValueVisitor() { + addNewIntParameterCalledValueVisitor = new AddNewIntParameterCalledValueVisitor(); + } + + @When("is the String \"$value\" is parsed by the JavaParser using parseBlock") + public void whenIsTheStringIsParsedByTheJavaParser(String value) { + blockStmt = parseBlock(value); + } + + @When("is the String \"$value\" is parsed by the JavaParser using parseStatement") + public void whenIsTheStringIsParsedByTheJavaParserUsingParseStatement(String value) { + statement = parseStatement(value); + } + + @When("the List of VariableDeclarations are set as the resources on TryStmt") + public void whenTheListOfVariableDeclarationsAreSetAsTheResourcesOnTryStmt() { + tryStmt.setResources(variableDeclarationExprList); + } + + @When("empty list is set as the resources on TryStmt") + public void whenNullIsSetAsTheResourcesOnTryStmt() { + tryStmt.setResources(new NodeList<>()); + } + + @When("the package declaration is set to \"$packageName\"") + public void whenThePackageDeclarationIsSetTo(String packageName) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + compilationUnit.setPackageDeclaration(new PackageDeclaration(parseName(packageName))); + state.put("cu1", compilationUnit); + } + + @When("a public class called \"$className\" is added to the CompilationUnit") + public void whenAClassCalledIsAddedToTheCompilationUnit(String className) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + TypeDeclaration type = new ClassOrInterfaceDeclaration(createModifierList(PUBLIC), false, "CreateClass"); + compilationUnit.setTypes(nodeList(type)); + state.put("cu1", compilationUnit); + } + + @When( + "a public static method called \"$methodName\" returning void is added to class $position in the compilation unit") + public void whenAStaticMethodCalledReturningIsAddedToClassInTheCompilationUnit(String methodName, int position) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + TypeDeclaration type = compilationUnit.getType(position - 1); + NodeList modifiers = createModifierList(PUBLIC); + MethodDeclaration method = new MethodDeclaration(modifiers, new VoidType(), methodName); + modifiers.add(staticModifier()); + method.setModifiers(modifiers); + type.addMember(method); + state.put("cu1", compilationUnit); + } + + @When("$typeName varargs called \"$parameterName\" are added to method $methodPosition in class $classPosition") + public void whenVarargsCalledAreAddedToMethodInClass( + String typeName, String parameterName, int methodPosition, int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition) + .addAndGetParameter(typeName, parameterName) + .setVarArgs(true); + } + + @When("a BlockStmt is added to method $methodPosition in class $classPosition") + public void whenABlockStmtIsAddedToMethodInClass(int methodPosition, int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + method.setBody(new BlockStmt()); + } + + @When( + "$className.$fieldName.$methodName(\"$stringValue\"); is added to the body of method $methodPosition in class $classPosition") + public void whenHelloWorldIsAddedToTheBodyOfMethodInClass( + String className, + String fieldName, + String methodName, + String stringValue, + int methodPosition, + int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + NameExpr clazz = new NameExpr(className); + FieldAccessExpr field = new FieldAccessExpr(clazz, fieldName); + MethodCallExpr call = new MethodCallExpr(field, methodName); + call.addArgument(new StringLiteralExpr(stringValue)); + method.getBody().get().addStatement(call); + } + + @When("method $methodPosition in class $classPosition has it's name converted to uppercase") + public void whenMethodInClassHasItsNameConvertedToUppercase(int methodPosition, int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + method.setName(method.getNameAsString().toUpperCase()); + } + + @When("method $methodPosition in class $classPosition has an int parameter called \"$paramName\" added") + public void whenMethodInClassHasAnIntArgumentCalledAdded(int methodPosition, int classPosition, String paramName) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + method.addParameter(intType(), paramName); + } + + @When("the compilation unit is cloned") + public void whenTheCompilationUnitIsCloned() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + state.put("cu1", compilationUnit.clone()); + } + + @When("the ChangeNameToUpperCaseVisitor visits to compilation unit") + public void whenTheVisitorVisitsToCompilationUnit() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + changeMethodNameToUpperCaseVisitor.visit(compilationUnit, null); + state.put("cu1", compilationUnit); + } + + @When("the AddNewIntParameterCalledValueVisitor visits to compilation unit") + public void whenTheAddNewParameterCalledValueVisitorVisitsToCompilationUnit() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + addNewIntParameterCalledValueVisitor.visit(compilationUnit, null); + state.put("cu1", compilationUnit); + } + + @Then("is not equal to null") + public void thenIsNotEqualToNull() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + assertNotEquals(compilationUnit, null); + } + + @Then("is not equal to $value") + public void thenIsNotEqualTo(String value) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + assertNotEquals(compilationUnit, value); + } + + @Then("Statement $position in BlockStmt toString is \"$expectedContent\"") + public void thenTheBlockStmtContentIs(int position, String expectedContent) { + Statement statementUnderTest = blockStmt.getStatement(position - 1); + assertThat(statementUnderTest.toString(), is(expectedContent)); + } + + @Then("Statement toString is \"$expectedContent\"") + public void thenStatementToStringIsxXy(String expectedContent) { + assertThat(statement.toString(), is(expectedContent)); + } + + @Then("all the VariableDeclarations parent is the TryStmt") + public void thenAllTheVariableDeclarationsParentIsTheTryStmt() { + variableDeclarationExprList.forEach( + expr -> assertThat(expr.getParentNode().get(), is(tryStmt))); + } + + @Then("the TryStmt has no child nodes") + public void thenTheTryStmtHasNotChildNodes() { + assertThat(tryStmt.getChildNodes().size(), is(0)); + } + + @Then("method $methodPosition in class $classPosition has the name \"$expectedName\"") + public void thenMethodInClassHasTheName(int methodPosition, int classPosition, String expectedName) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + assertThat(method.getNameAsString(), is(expectedName)); + } + + @Then("method $methodPosition in class $classPosition has $expectedCount parameters") + @Alias("method $methodPosition in class $classPosition has $expectedCount parameter") + public void thenMethodInClassHasArguments(int methodPosition, int classPosition, int expectedCount) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + + assertThat(method.getParameters().size(), is(expectedCount)); + } + + @Then( + "method $methodPosition in class $classPosition parameter $parameterPosition is type int called \"$expectedName\"") + public void thenMethodInClassParameterIsTypeIntCalled( + int methodPosition, int classPosition, int parameterPosition, String expectedName) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + Parameter parameter = method.getParameter(parameterPosition - 1); + assertThat(parameter.getType(), is(intType())); + assertThat(parameter.getNameAsString(), is(expectedName)); + } + + private static class ChangeMethodNameToUpperCaseVisitor extends VoidVisitorAdapter { + @Override + public void visit(MethodDeclaration n, Void arg) { + n.setName(n.getNameAsString().toUpperCase()); + } + } + + private static class AddNewIntParameterCalledValueVisitor extends VoidVisitorAdapter { + @Override + public void visit(MethodDeclaration n, Void arg) { + n.addParameter(intType(), "value"); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ParsingSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ParsingSteps.java new file mode 100644 index 0000000..452fb0c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/ParsingSteps.java @@ -0,0 +1,384 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.steps.SharedSteps.getMemberByTypeAndPosition; +import static com.github.javaparser.steps.SharedSteps.getMethodByPositionAndClassPosition; +import static java.lang.String.format; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.stmt.Statement; +import java.util.List; +import java.util.Map; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; + +public class ParsingSteps { + + private Map state; + + public ParsingSteps(Map state) { + this.state = state; + } + + private String sourceUnderTest; + + /* + * Given steps + */ + + @Given("the class:$classSrc") + public void givenTheClass(String classSrc) { + this.sourceUnderTest = classSrc.trim(); + } + + /* + * When steps + */ + + @When("I take the ArrayCreationExpr") + public void iTakeTheArrayCreationExpr() { + setSelectedNodeFromCompilationUnit(ArrayCreationExpr.class); + } + + @When("I take the PackageDeclaration") + public void iTakeThePackageDeclaration() { + setSelectedNodeFromCompilationUnit(PackageDeclaration.class); + } + + @When("I take the ObjectCreationExpr") + public void iTakeTheObjectCreationExpr() throws ClassNotFoundException { + setSelectedNodeFromCompilationUnit(ObjectCreationExpr.class); + } + + /* + * Then steps + */ + + @Then("constructor $constructorPosition in class $classPosition declaration as a String is \"$expectedString\"") + public void thenTheConstructorDeclarationAsAStringIs( + int constructorPosition, int classPosition, String expectedString) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1); + ConstructorDeclaration constructor = (ConstructorDeclaration) clazz.getMember(constructorPosition - 1); + assertThat(constructor.getDeclarationAsString(), is(expectedString)); + } + + @Then( + "constructor $constructorPosition in class $classPosition declaration short form as a String is \"$expectedString\"") + public void thenConstructorInClassDeclarationShortFormAsAStringIs( + int constructorPosition, int classPosition, String expectedString) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1); + ConstructorDeclaration constructor = (ConstructorDeclaration) clazz.getMember(constructorPosition - 1); + assertThat(constructor.getDeclarationAsString(false, false), is(expectedString)); + } + + @Then("method $methodPosition in class $classPosition declaration as a String is \"$expectedString\"") + public void thenMethod1InClass1DeclarationAsAStringIs( + int methodPosition, int classPosition, String expectedString) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1); + MethodDeclaration method = (MethodDeclaration) clazz.getMember(methodPosition - 1); + assertThat(method.getDeclarationAsString(), is(expectedString)); + } + + @Then("method $methodPosition in class $classPosition declaration as a String short form is \"$expectedString\"") + public void thenMethodInClassDeclarationAsAStringShortFormIs( + int methodPosition, int classPosition, String expectedString) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1); + MethodDeclaration method = (MethodDeclaration) clazz.getMember(methodPosition - 1); + assertThat(method.getDeclarationAsString(false, false), is(expectedString)); + } + + @Then( + "field $fieldPosition in class $classPosition contains annotation $annotationPosition value is \"$expectedValue\"") + public void thenFieldInClassContainsAnnotationValueIs( + int fieldPosition, int classPosition, int annotationPosition, String expectedValue) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + + TypeDeclaration classUnderTest = compilationUnit.getType(classPosition - 1); + FieldDeclaration fieldUnderTest = + getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1, FieldDeclaration.class); + AnnotationExpr annotationUnderTest = fieldUnderTest.getAnnotation(annotationPosition - 1); + assertThat(annotationUnderTest.getChildNodes().get(1).toString(), is(expectedValue)); + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition is called $expectedName") + public void thenLambdaInClassIsCalled( + int statementPosition, int methodPosition, int classPosition, String expectedName) { + Statement statement = getStatementInMethodInClass(statementPosition, methodPosition, classPosition); + VariableDeclarationExpr expression = (VariableDeclarationExpr) ((ExpressionStmt) statement).getExpression(); + VariableDeclarator variableDeclarator = expression.getVariable(0); + assertThat(variableDeclarator.getNameAsString(), is(expectedName)); + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition body is \"$expectedBody\"") + public void thenLambdaInStatementInMethodInClassBody( + int statementPosition, int methodPosition, int classPosition, String expectedBody) { + LambdaExpr lambdaExpr = + getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition); + assertThat(lambdaExpr.getBody().toString(), is(expectedBody)); + } + + @Then( + "lambda in method call in statement $statementPosition in method $methodPosition in class $classPosition body is \"$expectedBody\"") + public void thenLambdaInMethodCallInStatementInMethodInClassBody( + int statementPosition, int methodPosition, int classPosition, String expectedBody) { + ExpressionStmt statement = getStatementInMethodInClass(statementPosition, methodPosition, classPosition) + .asExpressionStmt(); + VariableDeclarationExpr variableDeclarationExpr = + statement.getExpression().asVariableDeclarationExpr(); + VariableDeclarator variableDeclarator = variableDeclarationExpr.getVariable(0); + MethodCallExpr methodCallExpr = + (MethodCallExpr) variableDeclarator.getInitializer().orElse(null); + CastExpr castExpr = methodCallExpr.getArgument(0).asCastExpr(); + LambdaExpr lambdaExpr = castExpr.getExpression().asLambdaExpr(); + assertThat(lambdaExpr.getBody().toString(), is(expectedBody)); + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition block statement is null") + public void thenLambdaInStatementInMethodInClassBlockStatementIsNull( + int statementPosition, int methodPosition, int classPosition) { + LambdaExpr lambdaExpr = + getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition); + BlockStmt blockStmt = lambdaExpr.getBody().asBlockStmt(); + assertEquals(true, blockStmt.getStatements().isEmpty()); + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition has parameters with non-null type") + public void thenLambdaInStatementInMethodInClassHasParametersWithNonNullType( + int statementPosition, int methodPosition, int classPosition) { + LambdaExpr lambdaExpr = + getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition); + for (Parameter parameter : lambdaExpr.getParameters()) { + assertThat(parameter.getType(), is(notNullValue())); + } + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition block statement is \"$expectedBody\"") + public void thenLambdaInStatementInMethodInClassBlockStatement( + int statementPosition, int methodPosition, int classPosition, String expectedBody) { + LambdaExpr lambdaExpr = + getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition); + BlockStmt blockStmt = lambdaExpr.getBody().asBlockStmt(); + Statement lambdaStmt = blockStmt.getStatement(0); + assertThat(lambdaStmt.toString(), is(expectedBody)); + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition is parent of contained body") + public void thenLambdaInStatementInMethodInClassIsParentOfContainedBody( + int statementPosition, int methodPosition, int classPosition) { + LambdaExpr lambdaExpr = + getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition); + Statement body = lambdaExpr.getBody(); + assertThat(body.getParentNode().get(), is(lambdaExpr)); + } + + @Then( + "lambda in statement $statementPosition in method $methodPosition in class $classPosition is parent of contained parameter") + public void thenLambdaInStatementInMethodInClassIsParentOfContainedParameter( + int statementPosition, int methodPosition, int classPosition) { + LambdaExpr lambdaExpr = + getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition); + Parameter parameter = lambdaExpr.getParameter(0); + assertThat(parameter.getParentNode().get(), is(lambdaExpr)); + } + + @Then( + "method reference in statement $statementPosition in method $methodPosition in class $classPosition scope is $expectedName") + public void thenMethodReferenceInStatementInMethodInClassIsScope( + int statementPosition, int methodPosition, int classPosition, String expectedName) { + ExpressionStmt statementUnderTest = getStatementInMethodInClass( + statementPosition, methodPosition, classPosition) + .asExpressionStmt(); + assertEquals(1, statementUnderTest.findAll(MethodReferenceExpr.class).size()); + MethodReferenceExpr methodReferenceUnderTest = + statementUnderTest.findFirst(MethodReferenceExpr.class).get(); + assertThat(methodReferenceUnderTest.getScope().toString(), is(expectedName)); + } + + @Then( + "method reference in statement $statementPosition in method $methodPosition in class $classPosition identifier is $expectedName") + public void thenMethodReferenceInStatementInMethodInClassIdentifierIsCompareByAge( + int statementPosition, int methodPosition, int classPosition, String expectedName) { + Statement statementUnderTest = getStatementInMethodInClass(statementPosition, methodPosition, classPosition); + assertEquals(1, statementUnderTest.findAll(MethodReferenceExpr.class).size()); + MethodReferenceExpr methodReferenceUnderTest = + statementUnderTest.findFirst(MethodReferenceExpr.class).get(); + assertThat(methodReferenceUnderTest.getIdentifier(), is(expectedName)); + } + + @Then("method $methodPosition class $classPosition is a default method") + public void thenMethodClassIsADefaultMethod(int methodPosition, int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration methodUnderTest = + getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + assertThat(methodUnderTest.isDefault(), is(true)); + } + + @Then("method $methodPosition class $classPosition is not a default method") + public void thenMethodClassIsNotADefaultMethod(int methodPosition, int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration methodUnderTest = + getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + assertThat(methodUnderTest.isDefault(), is(false)); + } + + private Statement getStatementInMethodInClass(int statementPosition, int methodPosition, int classPosition) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition); + return method.getBody().get().getStatement(statementPosition - 1); + } + + private LambdaExpr getLambdaExprInStatementInMethodInClass( + int statementPosition, int methodPosition, int classPosition) { + Statement statement = getStatementInMethodInClass(statementPosition, methodPosition, classPosition); + VariableDeclarationExpr expression = + ((ExpressionStmt) statement).getExpression().asVariableDeclarationExpr(); + VariableDeclarator variableDeclarator = expression.getVariable(0); + return (LambdaExpr) variableDeclarator.getInitializer().orElse(null); + } + + @Then("all nodes refer to their parent") + public void allNodesReferToTheirParent() { + assertAllNodesOfTheCompilationUnitHaveTheirParentSet("cu1"); + } + + @Then("all nodes of the second compilation unit refer to their parent") + public void thenAllNodesOfTheSecondCompilationUnitReferToTheirParent() { + assertAllNodesOfTheCompilationUnitHaveTheirParentSet("cu2"); + } + + private void assertAllNodesOfTheCompilationUnitHaveTheirParentSet(String stateKey) { + CompilationUnit compilationUnit = (CompilationUnit) state.get(stateKey); + ExistenceOfParentNodeVerifier parentVerifier = new ExistenceOfParentNodeVerifier(); + parentVerifier.verify(compilationUnit); + } + + @Then( + "ThenExpr in the conditional expression of the statement $statementPosition in method $methodPosition in class $classPosition is LambdaExpr") + public void thenLambdaInConditionalExpressionInMethodInClassIsParentOfContainedParameter( + int statementPosition, int methodPosition, int classPosition) { + ReturnStmt returnStmt = getStatementInMethodInClass(statementPosition, methodPosition, classPosition) + .asReturnStmt(); + ConditionalExpr conditionalExpr = + (ConditionalExpr) returnStmt.getExpression().orElse(null); + assertThat(conditionalExpr.getElseExpr().getClass().getName(), is(LambdaExpr.class.getName())); + } + + @Then("the begin line is $line") + public void thenTheBeginLineIs(int line) { + Node node = (Node) state.get("selectedNode"); + assertEquals(line, node.getBegin().get().line); + } + + @Then("the begin column is $column") + public void thenTheBeginColumnIs(int column) { + Node node = (Node) state.get("selectedNode"); + assertEquals(column, node.getBegin().get().column); + } + + @Then("the end line is $line") + public void thenTheEndLineIs(int line) { + Node node = (Node) state.get("selectedNode"); + assertEquals(line, node.getEnd().get().line); + } + + @Then("the end column is $column") + public void thenTheEndColumnIs(int column) { + Node node = (Node) state.get("selectedNode"); + assertEquals(column, node.getEnd().get().column); + } + + @Then("no errors are reported") + public void thenNoErrorsAreReported() { + // this is present just for readability in the scenario specification + // if the code is not parsed then exceptions are thrown before reaching this step + } + + @Then("the package name is $package") + public void thenThePackageNameIs(String expected) { + PackageDeclaration node = (PackageDeclaration) state.get("selectedNode"); + assertEquals(expected, node.getNameAsString()); + assertEquals(expected, node.getName().toString()); + } + + @Then("the type's diamond operator flag should be $expectedValue") + public void thenTheUsesDiamondOperatorShouldBeBooleanAsString(boolean expectedValue) { + ObjectCreationExpr expr = (ObjectCreationExpr) state.get("selectedNode"); + assertEquals(expectedValue, expr.getType().isUsingDiamondOperator()); + } + + @Then("the Java parser cannot parse it because of an error") + public void javaParserCannotParseBecauseOfLexicalErrors() { + ParseResult result = new JavaParser().parse(COMPILATION_UNIT, provider(sourceUnderTest)); + if (result.isSuccessful()) { + fail("Lexical error expected"); + } + } + + @Then("the assignExpr produced doesn't have a null target") + public void thenTheAssignExprProducedDoesntHaveANullTarget() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + ClassOrInterfaceDeclaration classDeclaration = + compilationUnit.getType(0).asClassOrInterfaceDeclaration(); + ConstructorDeclaration ctor = classDeclaration.getMember(1).asConstructorDeclaration(); + ExpressionStmt assignStmt = ctor.getBody().getStatement(0).asExpressionStmt(); + AssignExpr assignExpr = assignStmt.getExpression().asAssignExpr(); + assertNotNull(assignExpr.getTarget()); + assertEquals(NameExpr.class, assignExpr.getTarget().getClass()); + assertEquals(assignExpr.getTarget().asNameExpr().getNameAsString(), "mString"); + } + + private void setSelectedNodeFromCompilationUnit(Class nodeType) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + List nodes = compilationUnit.findAll(nodeType); + if (nodes.size() != 1) { + throw new RuntimeException(format("Exactly one %s expected", nodeType.getSimpleName())); + } + state.put("selectedNode", nodes.get(0)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/PositionRangeSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/PositionRangeSteps.java new file mode 100644 index 0000000..4857ce7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/PositionRangeSteps.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.Range.range; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.Position; +import com.github.javaparser.Range; +import org.jbehave.core.annotations.BeforeScenario; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; + +public class PositionRangeSteps { + + private Position position; + private Position secondPosition; + private Range range; + private Range secondRange; + + @BeforeScenario + public void reset() { + position = null; + secondPosition = null; + range = null; + secondRange = null; + } + /* + * Given steps + */ + + @Given("the position $line, $column") + public void givenThePosition(int line, int column) { + this.position = new Position(line, column); + } + + @Given("the range $line1, $column1 - $line2, $column2") + public void givenTheRange(int line1, int column1, int line2, int column2) { + this.range = range(line1, column1, line2, column2); + } + + /* + * When steps + */ + + @When("I compare to position $line, $column") + public void iCompareToPosition(int line, int column) { + secondPosition = new Position(line, column); + } + + @When("I compare to range $line1, $column1 - $line2, $column2") + public void whenICompareToRange(int line1, int column1, int line2, int column2) { + this.secondRange = range(line1, column1, line2, column2); + } + + /* + * Then steps + */ + + @Then("the positions are equal") + public void thenThePositionsAreEqual() { + assertTrue(position.equals(secondPosition)); + } + + @Then("it is after the {first|} position") + public void thenItIsAfterTheFirstPosition() { + if (secondPosition != null) { + assertTrue(secondPosition.isAfter(position)); + } else { + assertTrue(secondRange.isAfter(position)); + } + } + + @Then("it is before the {first|} position") + public void thenItIsBeforeTheFirstPosition() { + if (secondPosition != null) { + assertTrue(secondPosition.isBefore(position)); + } else { + assertTrue(secondRange.isBefore(position)); + } + } + + @Then("the positions are not equal") + public void thenThePositionsAreNotEqual() { + assertFalse(position.equals(secondPosition)); + } + + @Then("it is not after the {first|} position") + public void thenItIsNotAfterTheFirstPosition() { + assertFalse(secondPosition.isAfter(position)); + } + + @Then("it is not before the {first|} position") + public void thenItIsNotBeforeTheFirstPosition() { + assertFalse(secondPosition.isBefore(position)); + } + + @Then("the ranges are equal") + public void theRangesAreEqual() { + assertTrue(range.equals(secondRange)); + } + + @Then("it is contained in the first range") + public void itIsContainedInTheFirstRange() { + assertTrue(range.contains(secondRange)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/PrettyPrintingSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/PrettyPrintingSteps.java new file mode 100644 index 0000000..8210022 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/PrettyPrintingSteps.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.utils.Utils.normalizeEolInTextBlock; +import static com.github.javaparser.utils.Utils.readerToString; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.utils.LineSeparator; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; + +public class PrettyPrintingSteps { + + private Node resultNode; + private String sourceUnderTest; + + @Given( + "the {class|compilation unit|expression|block|statement|import|annotation|body|class body|interface body}:$classSrc") + public void givenTheClass(String classSrc) { + this.sourceUnderTest = classSrc.trim(); + } + + @Given( + "the {class|compilation unit|expression|block|statement|import|annotation|body|class body|interface body} in the file \"$classFile\"") + public void givenTheClassInTheFile(String classFile) throws URISyntaxException, IOException { + URL url = getClass().getResource("../samples/" + classFile); + sourceUnderTest = readerToString(new FileReader(new File(url.toURI()))).trim(); + } + + @When("the {class|compilation unit} is parsed by the Java parser") + public void whenTheClassIsParsedByTheJavaParser() { + resultNode = parse(sourceUnderTest); + } + + @When("the expression is parsed by the Java parser") + public void whenTheExpressionIsParsedByTheJavaParser() { + resultNode = parseExpression(sourceUnderTest); + } + + @When("the block is parsed by the Java parser") + public void whenTheBlockIsParsedByTheJavaParser() { + resultNode = parseBlock(sourceUnderTest); + } + + @When("the statement is parsed by the Java parser") + public void whenTheStatementIsParsedByTheJavaParser() { + resultNode = parseStatement(sourceUnderTest); + } + + @When("the import is parsed by the Java parser") + public void whenTheImportIsParsedByTheJavaParser() { + resultNode = parseImport(sourceUnderTest); + } + + @When("the annotation is parsed by the Java parser") + public void whenTheAnnotationIsParsedByTheJavaParser() { + resultNode = parseAnnotation(sourceUnderTest); + } + + @When("the annotation body declaration is parsed by the Java parser") + public void whenTheBodyDeclarationIsParsedByTheJavaParser() { + resultNode = parseAnnotationBodyDeclaration(sourceUnderTest); + } + + @When("the class body declaration is parsed by the Java parser") + public void whenTheClassBodyDeclarationIsParsedByTheJavaParser() { + resultNode = parseBodyDeclaration(sourceUnderTest); + } + + @When("the interface body declaration is parsed by the Java parser") + public void whenTheInterfaceBodyDeclarationIsParsedByTheJavaParser() { + resultNode = parseBodyDeclaration(sourceUnderTest); + } + + @When("the class is visited by an empty ModifierVisitorAdapter") + public void whenTheClassIsVisitedByAnEmptyModifierVisitorAdapter() { + (new ModifierVisitor() {}).visit((CompilationUnit) resultNode, null); + } + + @Then("it is printed as:$src") + public void isPrintedAs(String src) { + assertEquals( + normalizeEolInTextBlock(src.trim(), LineSeparator.ARBITRARY), + normalizeEolInTextBlock(resultNode.toString().trim(), LineSeparator.ARBITRARY)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/SharedSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/SharedSteps.java new file mode 100644 index 0000000..16dbe53 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/SharedSteps.java @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.text.IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.TypeDeclaration; +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Map; +import org.hamcrest.CoreMatchers; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; + +public class SharedSteps { + + /* Map that maintains shares state across step classes. If manipulating the objects in the map you must update the state */ + private Map state; + + public SharedSteps(Map state) { + this.state = state; + } + + /* + * Given steps + */ + + @Given("a CompilationUnit") + public void givenACompilationUnit() { + state.put("cu1", new CompilationUnit()); + } + + @Given("a second CompilationUnit") + public void givenASecondCompilationUnit() { + state.put("cu2", new CompilationUnit()); + } + + /* + * When steps + */ + + @When("the following source is parsed:$classSrc") + public void whenTheFollowingSourceIsParsed(String classSrc) { + state.put("cu1", parse(classSrc.trim())); + } + + @When("the following source is parsed (trimming space):$classSrc") + public void whenTheFollowingSourceIsParsedTrimmingSpace(String classSrc) { + state.put("cu1", parse(classSrc.trim())); + } + + @When("the following sources is parsed by the second CompilationUnit:$classSrc") + public void whenTheFollowingSourcesIsParsedBytTheSecondCompilationUnit(String classSrc) { + state.put("cu2", parse(classSrc.trim())); + } + + @When("file \"$fileName\" is parsed") + public void whenTheJavaFileIsParsed(String fileName) throws IOException, URISyntaxException { + URL url = getClass().getResource("../samples/" + fileName); + CompilationUnit compilationUnit = parse(new File(url.toURI())); + state.put("cu1", compilationUnit); + } + + @Then("the CompilationUnit is equal to the second CompilationUnit") + public void thenTheCompilationUnitIsEqualToTheSecondCompilationUnit() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + CompilationUnit compilationUnit2 = (CompilationUnit) state.get("cu2"); + + assertThat(compilationUnit, is(equalTo(compilationUnit2))); + } + + @Then("the CompilationUnit has the same hashcode to the second CompilationUnit") + public void thenTheCompilationUnitHasTheSameHashcodeToTheSecondCompilationUnit() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + CompilationUnit compilationUnit2 = (CompilationUnit) state.get("cu2"); + + assertThat(compilationUnit.hashCode(), is(equalTo(compilationUnit2.hashCode()))); + } + + @Then("the CompilationUnit is not equal to the second CompilationUnit") + public void thenTheCompilationUnitIsNotEqualToTheSecondCompilationUnit() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + CompilationUnit compilationUnit2 = (CompilationUnit) state.get("cu2"); + + assertThat(compilationUnit, not(equalTo(compilationUnit2))); + } + + @Then("the CompilationUnit has a different hashcode to the second CompilationUnit") + public void thenTheCompilationUnitHasADifferentHashcodeToTheSecondCompilationUnit() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + CompilationUnit compilationUnit2 = (CompilationUnit) state.get("cu2"); + + assertThat(compilationUnit.hashCode(), not(equalTo(compilationUnit2.hashCode()))); + } + + @Then("the expected source should be:$classSrc") + public void thenTheExpectedSourcesShouldBe(String classSrc) { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + assertThat(compilationUnit.toString(), CoreMatchers.is(equalToCompressingWhiteSpace(classSrc))); + } + + public static > T getMemberByTypeAndPosition( + TypeDeclaration typeDeclaration, int position, Class typeClass) { + int typeCount = 0; + for (BodyDeclaration declaration : typeDeclaration.getMembers()) { + if (declaration.getClass().equals(typeClass)) { + if (typeCount == position) { + return (T) declaration; + } + typeCount++; + } + } + throw new IllegalArgumentException("No member " + typeClass + " at position: " + position); + } + + public static MethodDeclaration getMethodByPositionAndClassPosition( + CompilationUnit compilationUnit, int methodPosition, int classPosition) { + TypeDeclaration type = compilationUnit.getType(classPosition - 1); + + int memberCount = 0; + int methodCount = 0; + for (BodyDeclaration bodyDeclaration : type.getMembers()) { + if (bodyDeclaration instanceof MethodDeclaration) { + if (methodCount == methodPosition - 1) { + return (MethodDeclaration) type.getMember(memberCount); + } + methodCount++; + } + memberCount++; + } + throw new IllegalArgumentException( + "Method not found at position " + methodPosition + "in class " + classPosition); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/VisitorSteps.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/VisitorSteps.java new file mode 100644 index 0000000..4bdc4f8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/steps/VisitorSteps.java @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.steps; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.visitor.CloneVisitor; +import com.github.javaparser.ast.visitor.GenericListVisitorAdapter; +import com.github.javaparser.ast.visitor.GenericVisitorAdapter; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import com.github.javaparser.visitors.PositionTestVisitor; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; +import org.jbehave.core.annotations.Given; +import org.jbehave.core.annotations.Then; +import org.jbehave.core.annotations.When; + +public class VisitorSteps { + + /* Fields used to maintain step state within this step class */ + private VoidVisitorAdapter> toUpperCaseVariableNameVisitor; + private VoidVisitorAdapter> collectVariableNameVisitor; + private PositionTestVisitor positionTestVisitor; + private GenericVisitorAdapter nameReturningVisitor; + private GenericListVisitorAdapter allNameReturningVisitor; + private AtomicReference collectedVariableName; + private String returnedVariableName; + private List returnedVariableNames; + + /* Map that maintains shares state across step classes. If manipulating the objects in the map you must update the state */ + private Map state; + + public VisitorSteps(Map state) { + this.state = state; + } + + @Given("a VoidVisitorAdapter with a visit method that changes variable names to uppercase") + public void givenAVoidVisitorAdapterWithAVisitMethodThatChangesVariableNamesToUppercase() { + toUpperCaseVariableNameVisitor = new VoidVisitorAdapter>() { + @Override + public void visit(VariableDeclarator n, AtomicReference arg) { + n.setName(n.getNameAsString().toUpperCase()); + } + }; + } + + @Given("a VoidVisitorAdapter with a visit method and collects the variable names") + public void givenAVoidVisitorAdapterWithAVisitMethodThatCollectsTheVariableName() { + collectVariableNameVisitor = new VoidVisitorAdapter>() { + @Override + public void visit(VariableDeclarator n, AtomicReference arg) { + arg.set(arg.get() + n.getName() + ";"); + } + + @Override + public void visit(Parameter n, AtomicReference arg) { + arg.set(arg.get() + n.getName() + ";"); + } + }; + } + + @Given("a GenericVisitorAdapter with a visit method that returns variable names") + public void givenAGenericVisitorAdapterWithAVisitMethodThatReturnsVariableNames() { + nameReturningVisitor = new GenericVisitorAdapter() { + @Override + public String visit(VariableDeclarator n, Void arg) { + return n.getNameAsString(); + } + }; + } + + @Given("a GenericListVisitorAdapter with a visit method that returns all variable names") + public void givenAGenericListVisitorAdapterWithAVisitMethodThatReturnsAllVariableNames() { + allNameReturningVisitor = new GenericListVisitorAdapter() { + @Override + public List visit(VariableDeclarator n, Void arg) { + return Collections.singletonList(n.getNameAsString()); + } + }; + } + + @Given("a VoidVisitorAdapter with a visit method that asserts sensible line positions") + public void givenAVoidVisitorAdapterWithAVisitMethodThatAssertsSensibleLinePositions() { + positionTestVisitor = new PositionTestVisitor(); + } + + @When("the CompilationUnit is cloned to the second CompilationUnit") + public void whenTheSecondCompilationUnitIsCloned() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + CompilationUnit compilationUnit2 = (CompilationUnit) compilationUnit.accept(new CloneVisitor(), null); + state.put("cu2", compilationUnit2); + } + + @When("the CompilationUnit is visited by the to uppercase visitor") + public void whenTheCompilationUnitIsVisitedByTheVistor() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + toUpperCaseVariableNameVisitor.visit(compilationUnit, null); + state.put("cu1", compilationUnit); + } + + @When("the CompilationUnit is visited by the variable name collector visitor") + public void whenTheCompilationUnitIsVisitedByTheVariableNameCollectorVisitor() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + collectedVariableName = new AtomicReference<>(""); + collectVariableNameVisitor.visit(compilationUnit, collectedVariableName); + } + + @When("the CompilationUnit is visited by the visitor that returns variable names") + public void whenTheCompilationUnitIsVisitedByTheVisitorThatReturnsVariableNames() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + returnedVariableName = nameReturningVisitor.visit(compilationUnit, null); + } + + @When("the CompilationUnit is visited by the visitor that returns all variable names") + public void whenTheCompilationUnitIsVisitedByTheVisitorThatReturnsAllVariableNames() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + returnedVariableNames = allNameReturningVisitor.visit(compilationUnit, null); + } + + @When("the CompilationUnit is visited by the PositionTestVisitor") + public void whenTheCompilationUnitIsVisitedByThePositionTestVisitor() { + CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1"); + compilationUnit.accept(positionTestVisitor, null); + } + + @Then("the collected variable name is \"$nameUnderTest\"") + public void thenTheCollectedVariableNameIs(String nameUnderTest) { + assertThat(collectedVariableName.get(), is(nameUnderTest)); + } + + @Then("the return variable name is \"$nameUnderTest\"") + public void thenTheReturnVariableNameIs(String nameUnderTest) { + assertThat(returnedVariableName, is(nameUnderTest)); + } + + @Then("the first return variable name is \"$nameUnderTest\"") + public void thenTheFirstReturnVariableNameIs(String nameUnderTest) { + assertThat(returnedVariableNames.get(0), is(nameUnderTest)); + } + + @Then("the total number of nodes visited is $expectedCount") + public void thenTheTotalNumberOfNodesVisitedIs(int expectedCount) { + assertThat(positionTestVisitor.getNumberOfNodesVisited(), is(expectedCount)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/visitors/PositionTestVisitor.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/visitors/PositionTestVisitor.java new file mode 100644 index 0000000..368a02c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/java/com/github/javaparser/visitors/PositionTestVisitor.java @@ -0,0 +1,562 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.visitors; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.lessThanOrEqualTo; +import static org.hamcrest.core.Is.is; + +import com.github.javaparser.Position; +import com.github.javaparser.ast.ArrayCreationLevel; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; + +public class PositionTestVisitor extends VoidVisitorAdapter { + + private int numberOfNodesVisited; + + @Override + public void visit(final AnnotationDeclaration n, final Object arg) { + doTest(n); + doTest(n.getName()); + super.visit(n, arg); + } + + @Override + public void visit(final AnnotationMemberDeclaration n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ArrayAccessExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ArrayCreationExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ArrayInitializerExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final AssertStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final AssignExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final BinaryExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final BlockComment n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final BlockStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final BooleanLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final BreakStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final CastExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final CatchClause n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(LambdaExpr n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(MethodReferenceExpr n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(TypeExpr n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final CharLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ClassExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ClassOrInterfaceDeclaration n, final Object arg) { + doTest(n); + doTest(n.getName()); + super.visit(n, arg); + } + + @Override + public void visit(final ClassOrInterfaceType n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final CompilationUnit n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ConditionalExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ConstructorDeclaration n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ContinueStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final DoStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final DoubleLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final EmptyStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final EnclosedExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final EnumConstantDeclaration n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final EnumDeclaration n, final Object arg) { + doTest(n); + doTest(n.getName()); + super.visit(n, arg); + } + + @Override + public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ExpressionStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final FieldAccessExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final FieldDeclaration n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ForEachStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ForStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final IfStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final InitializerDeclaration n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final InstanceOfExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final IntegerLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final JavadocComment n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final LabeledStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final LineComment n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final LongLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final MarkerAnnotationExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final MemberValuePair n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final MethodCallExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final MethodDeclaration n, final Object arg) { + doTest(n); + doTest(n.getName()); + super.visit(n, arg); + } + + @Override + public void visit(final NameExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final NormalAnnotationExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final NullLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ObjectCreationExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final PackageDeclaration n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final Parameter n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final PrimitiveType n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final Name n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(SimpleName n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayType n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(ArrayCreationLevel n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final IntersectionType n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(UnionType n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ReturnStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final SingleMemberAnnotationExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final StringLiteralExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final SuperExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final SwitchEntry n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final SwitchStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final SynchronizedStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ThisExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final ThrowStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final TryStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final LocalClassDeclarationStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final LocalRecordDeclarationStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final TypeParameter n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final UnaryExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final VariableDeclarationExpr n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final VariableDeclarator n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final VoidType n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final WhileStmt n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(final WildcardType n, final Object arg) { + doTest(n); + super.visit(n, arg); + } + + @Override + public void visit(UnknownType n, Object arg) { + doTest(n); + super.visit(n, arg); + } + + private void doTest(final Node node) { + Position begin = node.getRange().get().begin; + Position end = node.getRange().get().end; + assertThat(begin.line, is(greaterThanOrEqualTo(0))); + assertThat(begin.column, is(greaterThanOrEqualTo(0))); + assertThat(end.line, is(greaterThanOrEqualTo(0))); + assertThat(end.column, is(greaterThanOrEqualTo(0))); + + if (begin.line == end.line) { + assertThat(begin.column, is(lessThanOrEqualTo(end.column))); + } else { + assertThat(begin.line, is(lessThanOrEqualTo(end.line))); + } + numberOfNodesVisited++; + } + + public int getNumberOfNodesVisited() { + return numberOfNodesVisited; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comment_attribution_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comment_attribution_scenarios.story new file mode 100644 index 0000000..c3724ce --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comment_attribution_scenarios.story @@ -0,0 +1,498 @@ +Scenario: A Class With Line Comments is processed by the Java Parser + +Given the class: +package japa.parser.comments; + +public class ClassWithLineComments { + + public void aMethod(){ + // first comment + int a=0; // second comment + // third comment + // fourth comment + } +} +When the class is parsed by the Java parser +Then the compilation unit is not commented +Then the compilation unit has 0 orphan comments +Then class 1 has 4 total contained comments +Then method 1 in class 1 has 4 total contained comments +Then method 1 in class 1 has 0 orphan comments +Then block statement in method 1 in class 1 has 4 total contained comments +Then block statement in method 1 in class 1 has 3 orphan comments + + + +Scenario: A Class With Line Comments is processed by the Java Parser + +Given the class: +package japa.parser.comments; + +/**Javadoc associated with the class*/ +public class ClassWithOrphanComments { + //a first comment floating in the class + + //comment associated to the method + void foo(){ + /*comment floating inside the method*/ + } + + //a second comment floating in the class +} + +//Orphan comment inside the CompilationUnit +When the class is parsed by the Java parser +Then the compilation unit is not commented +Then the compilation unit has 6 contained comments +Then the compilation unit orphan comment 1 is "Orphan comment inside the CompilationUnit" +Then class 1 orphan comment 1 is "a first comment floating in the class" +Then class 1 orphan comment 2 is "a second comment floating in the class" +Then class 1 is commented "Javadoc associated with the class" +Then class 1 has 4 total contained comments +Then method 1 in class 1 has 0 orphan comments +Then method 1 in class 1 is commented "comment associated to the method" +Then comment 1 in method 1 in class 1 is "comment floating inside the method" +Then block statement in method 1 in class 1 orphan comment 1 is "comment floating inside the method" + + +Scenario: A Class With Orphan Comment in Class Declaration is parsed by the Java Parser + +Given the class: +class /*Comment1*/ A { + //comment2 + // comment3 + int a; + /**comment4 + * + * */ + //comment5 +} +When the class is parsed by the Java parser +Then class 1 is not commented +Then class 1 orphan comment 1 is "comment2" + + +Scenario: A Class With Line Comments in Multiple Methods is parsed by the Java Parser + +Given the class: +package japa.parser.comments; + +public class ClassWithLineCommentsInMultipleMethods { + + public void aMethod() { + // first comment + int a = 0; //second comment + // third comment + // fourth comment + } + + public void anotherMethod() { + // a unique comment + // first comment + int a = 0; //second comment + // third comment + // fourth comment + } +} +When the class is parsed by the Java parser +Then the compilation unit has 9 contained comments +Then the compilation unit has 0 orphan comments +Then class 1 is not commented +Then class 1 has 9 total contained comments +Then method 1 in class 1 has 4 total contained comments +Then method 1 in class 1 has 0 orphan comments +Then block statement in method 1 in class 1 has 4 total contained comments +Then block statement in method 1 in class 1 has 3 orphan comments +Then method 2 in class 1 has 5 total contained comments +Then method 2 in class 1 has 0 orphan comments +Then block statement in method 2 in class 1 has 5 total contained comments +Then block statement in method 2 in class 1 has 4 orphan comments + + + +Scenario: A Class With Line Comments in Multiple Methods is parsed by the Java Parser + +Given the class: +package japa.parser.comments; + +public class ClassWithLineCommentInsideBlockComment { + + /* comment to a method */ + void foo(){} + + /*// Line Comment put immediately after block comment + + //// Comment debauchery + + another orphan. + It spans over more lines */ +} +When the class is parsed by the Java parser +Then method 1 in class 1 is commented " comment to a method " +Then class 1 orphan comment 1 is "// Line Comment put immediately after block comment + + //// Comment debauchery + + another orphan. + It spans over more lines " + + + +Scenario: A Class With Line Comments on Fields is parsed by the Java Parser + +Given the class: +package japa.parser.comments; + +public class Issue43 { + //Case 1 + private String field1 = null; //field1 + + //Case 2 + private String field2 + = null; //field2 + +} +When the class is parsed by the Java parser +Then the compilation unit has 4 contained comments +Then class 1 has 4 total contained comments +Then class 1 has 1 orphan comment +Then class 1 orphan comment 1 is "Case 1" +Then field 1 in class 1 contains 0 comments +!-- Then field 2 in class 1 contains 0 comments +Then field 1 in class 1 is commented "field1" +Then field 2 in class 1 is commented "Case 2" +Then variable 1 value of field 2 in class 1 is commented "field2" + + +Scenario: Another Class With Line Comments on Fields is parsed by the Java Parser + +Given the class: +package japa.parser.comments; + +public class Issue43variant { + private String field1 = null; //field1 + + private String field2 + = null; //field2 + +} +When the class is parsed by the Java parser +Then the compilation unit has 2 contained comments +Then class 1 has 2 total contained comments +Then field 1 in class 1 contains 0 comments +!-- Then field 2 in class 1 contains 0 comments +Then field 1 in class 1 is commented "field1" +Then variable 1 value of field 2 in class 1 is commented "field2" + + +Scenario: A Class With Mixed Comments on Fields is parsed by the Java Parser + +Given the class: +package japa.parser.javacc; +public class Teste { + //line comment1 + int a = 0; //line comment2 + int b = 0; //line comment3 + int c = 0; /* multi-line + * comment + */ + int d = 0; /** multi-line + * javadoc */ + int e = 0; +} +//final comment +When the class is parsed by the Java parser +Then the compilation unit has 6 contained comments +Then class 1 has 5 total contained comments +Then class 1 orphan comment 1 is "line comment1" +Then field 1 in class 1 is commented "line comment2" +Then field 2 in class 1 is commented "line comment3" +Then field 3 in class 1 is not commented + + + +Scenario: Comment with a preceding line space is an orphan + +Given the class: +//comment + +class A {} +When the class is parsed by the Java parser +Then the compilation unit orphan comment 1 is "comment" + + +Scenario: Comment without a preceding line space is associated to class + +Given the class: +//comment +class A {} +When the class is parsed by the Java parser +Then class 1 is commented "comment" + + +Scenario: Comments after Javadoc are attributed to the method if flag is active + +Given the class: +class Issue40{ + @GET + @Path("original") + /** + * Return the original user. + */ + public User getOriginalUser(String userName) { + return userService.getOriginalUser(userName); + } +} +When the do not consider annotations as node start for code attribution is true on the Java parser +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is not an orphan +Then method 1 in class 1 is commented "* Return the original user." + + + +Scenario: Comments after Javadoc are attributed to the method if flag is not active + +Given the class: +class Issue40{ + @GET + @Path("original") + /** + * Return the original user. + */ + public User getOriginalUser(String userName) { + return userService.getOriginalUser(userName); + } +} +When the do not consider annotations as node start for code attribution is false on the Java parser +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is not an orphan +Then type of method 1 in class 1 is commented "* Return the original user." + + +Scenario: A Class With Line Comments is processed by the Java Parser + +Given the class: +/*CompilationUnitComment*/ +package japa.parser.comments; + +public class ClassWithMixedStyleComments { + // line comment + int a = 0; + // another line comment + int b = 0; + // line comment + int c = 0; + /* multi-line + comment + */ + int d = 0; + /** + * multi-line + */ + int e = 0; + // final comment +} +When the class is parsed by the Java parser +Then the compilation is commented "CompilationUnitComment" +Then class 1 is not commented +Then class 1 has 6 total contained comments +Then class 1 orphan comment 1 is " final comment" +Then field 1 in class 1 is commented " line comment" +Then field 1 in class 1 contains 0 comments +Then field 2 in class 1 is commented " another line comment" +Then field 2 in class 1 contains 0 comments +Then field 3 in class 1 is commented " line comment" +Then field 3 in class 1 contains 0 comments +Then field 4 in class 1 is commented " multi-line comment" +Then field 4 in class 1 contains 0 comments +Then field 5 in class 1 is commented " * multi-line" +Then field 5 in class 1 contains 0 comments + + +Scenario: A class with only an orphan comment is processed by the Java Parser + +Given the class: +class A { + // orphan comment" +} +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is an orphan +Then comment 1 in compilation unit parent is ClassOrInterfaceDeclaration + + + +Scenario: A class with only a class comment is processed by the Java Parser + +Given the class: +/* Comment of the class */ +class A { +} +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is not an orphan +Then comment 1 in compilation unit commented node is ClassOrInterfaceDeclaration + + + +Scenario: A Class With two comments at class level is processed by the Java Parser + +Given the class: +/* Orphan comment */ +/* Comment of the class */ +class A { +} +When the class is parsed by the Java parser +Then the compilation unit has 2 contained comments +Then comment 1 in compilation unit is an orphan +Then the compilation unit orphan comment 1 is "Orphan comment" +Then comment 2 in compilation unit is not an orphan +Then comment 2 in compilation unit commented node is ClassOrInterfaceDeclaration + + +Scenario: A Class has a comment associated to a field when processed by the Java Parser + +Given the class: +class A { + int a = 0; // comment associated to the field +} +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is not an orphan +Then comment 1 in compilation unit commented node is FieldDeclaration + + +Scenario: A Class has a comment associated to a the literal when processed by the Java Parser + +Given the class: +class A { + int a + = 0; // comment associated to the field +} +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is not an orphan +Then comment 1 in compilation unit commented node is IntegerLiteralExpr + + + +Scenario: A Class with two line comment within a method when processed by the Java Parser + +Given the class: +class A { + void foo() { + // a comment + int b; // another comment + } +} +When the class is parsed by the Java parser +Then the compilation unit has 2 contained comments +Then comment 1 in compilation unit is an orphan +Then comment 1 in compilation unit is "a comment" +Then comment 2 in compilation unit is not an orphan +Then comment 2 in compilation unit is "another comment" +Then comment 2 in compilation unit commented node is ExpressionStmt + + +Scenario: A Class with an inline comment inside a block comment is parsed by the Java Parser + +Given the class: +class A { + /* A block comment that + // Contains a line comment + */ + public static void main(String args[]) { + } +} +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit is "A block comment that // Contains a line comment" + + +Scenario: A Class with an inline comment inbetween annotation a method declaration is parsed Java Parser + +Given the class: +class A { + @Override + // Returns number of vowels in a name + public int countVowels(String name) { + } +} +When the class is parsed by the Java parser +Then the compilation unit has 1 contained comments +Then comment 1 in compilation unit commented node is PrimitiveType + +Scenario: We print correctly two consecutive line-comments in a class + +Given the class: +class A { + // foo + // bar + void aMethod(){} +} +When the class is parsed by the Java parser +Then it is printed as: +class A { + + // foo + // bar + void aMethod() { + } +} + +Scenario: We print correctly two consecutive line-comments in a method + +Given the class: +class A { + void aMethod(){ + // foo + // bar + int a; + } +} +When the class is parsed by the Java parser +Then it is printed as: +class A { + + void aMethod() { + // foo + // bar + int a; + } +} + +Scenario: We print correctly orphan comments in a for loop +Given the class: +class A { + public static List calcularResultadoFinal(List avaliacoes) throws SQLException, ClassNotFoundException{ + for(Avaliacao avaliacao: avaliacoes){ + // if(avaliacao.obterAprovacao()){ + // avaliacao.setResultadoFinal("Aprovado"); + // }else{ + // avaliacao.setResultadoFinal("Reprovado"); + // } + avaliacao.setEmAberto(false); + avaliacao.editar(); + } + return avaliacoes; + } +} +When the class is parsed by the Java parser +Then it is printed as: +class A { + + public static List calcularResultadoFinal(List avaliacoes) throws SQLException, ClassNotFoundException { + for (Avaliacao avaliacao : avaliacoes) { + // if(avaliacao.obterAprovacao()){ + // avaliacao.setResultadoFinal("Aprovado"); + // }else{ + // avaliacao.setResultadoFinal("Reprovado"); + // } + avaliacao.setEmAberto(false); + avaliacao.editar(); + } + return avaliacoes; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comment_parsing_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comment_parsing_scenarios.story new file mode 100644 index 0000000..bfcd5ed --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comment_parsing_scenarios.story @@ -0,0 +1,281 @@ +Scenario: A Class With Line Comments is processed by the Comments Parser + +Given the class: +package japa.parser.comments; + +public class ClassWithLineComments { + + public void aMethod(){ + // first comment + int a=0; // second comment + // third comment + // fourth comment + } +} +When the class is parsed by the comment parser +Then the total number of comments is 4 +Then line comment 1 is " first comment" +Then line comment 2 is " second comment" +Then line comment 3 is " third comment" +Then line comment 4 is " fourth comment" +Then the line comments have the following positions: +|beginLine|beginColumn|endLine|endColumn| +|6|9|6|24| +|7|18|7|34| +|8|9|8|24| +|9|9|9|25| + +Scenario: A Class With Block Comments is processed by the Comments Parser + +Given the class: +package japa.parser.comments; + +/* comment which is not attributed to the class, it floats around as an orphan */ +/* comment to a class */ +public class ClassWithBlockComments { + + /* comment to a method */ + void foo(){}; + + /* comment put randomly in class: + + another orphan. + It spans over more lines */ + +} + +/* a comment lost inside a compilation unit. It is orphan, I am sure you got this one */ +When the class is parsed by the comment parser +Then the total number of comments is 5 +Then block comment 1 is " comment which is not attributed to the class, it floats around as an orphan " +Then block comment 2 is " comment to a class " +Then block comment 3 is " comment to a method " +Then block comment 4 is " comment put randomly in class: another orphan. It spans over more lines " +Then block comment 5 is " a comment lost inside a compilation unit. It is orphan, I am sure you got this one " +Then the block comments have the following positions: +|beginLine|beginColumn|endLine|endColumn| +|3|1|3|81| +|4|1|4|24| +|7|5|7|29| +|10|5|13|31| +|17|1|17|88| + + +Scenario: A Class With Javadoc Comments is processed by the Comments Parser + +Given the class: +package japa.parser.comments; + +/** a proper javadoc comment */ +public class ClassWithJavadocComments { + + void foo(){}; + + +} +/** a floating javadoc comment */ +When the class is parsed by the comment parser +Then the total number of comments is 2 +Then Javadoc comment 1 is " a proper javadoc comment " +Then Javadoc comment 2 is " a floating javadoc comment " +Then the Javadoc comments have the following positions: +|beginLine|beginColumn|endLine|endColumn| +|3|1|3|31| +|10|1|10|33| + + + +Scenario: A Class With Orphan Comments is processed by the Comments Parser + +Given the class: +package japa.parser.comments; + +/**Javadoc associated with the class*/ +public class ClassWithOrphanComments { + //a first comment floating in the class + + //comment associated to the method + void foo(){ + /*comment floating inside the method*/ + } + + //a second comment floating in the class +} + +//Orphan comment inside the CompilationUnit +When the class is parsed by the comment parser +Then the total number of comments is 6 +Then line comment 1 is "a first comment floating in the class" +Then line comment 2 is "comment associated to the method" +Then line comment 3 is "a second comment floating in the class" +Then block comment 1 is "comment floating inside the method" +Then Javadoc comment 1 is "Javadoc associated with the class" + + +Scenario: A Class With Orphan Comments is processed by the Comments Parser + +Given the class: +/*CompilationUnitComment*/ +package japa.parser.comments; + +public class ClassWithMixedStyleComments { + // line comment + int a = 0; + // another line comment + int b = 0; + // line comment + int c = 0; + /* multi-line + comment + */ + int d = 0; + /** + * multi-line + */ + int e = 0; + // final comment +} +When the class is parsed by the comment parser +Then the total number of comments is 7 +Then the line comments have the following positions: +|beginLine|beginColumn|endLine|endColumn| +|5|5|5|19| +|7|5|7|27| +|9|5|9|19| +|19|5|19|20| +Then the block comments have the following positions: +|beginLine|beginColumn|endLine|endColumn| +|1|1|1|26| +|11|5|13|6| +Then the Javadoc comments have the following positions: +|beginLine|beginColumn|endLine|endColumn| +|15|5|17|7| + +Scenario: A method containing two consecutive line comments is parsed correctly + +Given the class: +class A { + void aMethod(){ + // foo + // bar + int a; + } +} +When the class is parsed by the comment parser +Then the total number of comments is 2 +Then line comment 1 is " foo" +Then line comment 2 is " bar" + +Scenario: Comments from a file with an non-UTF-8 encoding are parsed correctly + +When read sample "ClassInLatin1" using encoding "ISO-8859-1" +Then the total number of comments is 3 +Then line comment 2 is " A l'émej in piasì che sent dësgust." + +Scenario: Should not recognize /*/ as a comment + +Given the class: +/*/ +class Foo {} +When the class is parsed by the comment parser +Then the total number of comments is 0 + +Given the class: +/*/ +class Foo {} +Then the Java parser cannot parse it because of an error + +Scenario: Should recognize /*/ inside a block comment + +Given the class: +/* Foo /*/ +When the class is parsed by the comment parser +Then the total number of comments is 1 +Then block comment 1 is " Foo /" + +Scenario: A Class With Character Literal is processed by the Comments Parser +Given the class: +class A { + /** comment1 */ + private char c = '"'; + /** comment2 */ + private String d; +} +When the class is parsed by the comment parser +Then the total number of comments is 2 +Then Javadoc comment 1 is "comment1" +Then Javadoc comment 2 is "comment2" + +Scenario: Double slash in string does not mess up comments parsing +Given the class: +public class b { + + public void m1() { + String s = "\\"; + } + + /** + * Comment + */ + public void m2() { + return; + } +} +When the class is parsed by the comment parser +Then the total number of comments is 1 + +Scenario: Triple slash in string does not mess up comments parsing +Given the class: +public class b { + + public void m1() { + String s = "\\\" // still in string"; + } + + /** + * Comment + */ + public void m2() { + return; + } +} +When the class is parsed by the comment parser +Then the total number of comments is 1 + +Scenario: Four slashes in string does not mess up comments parsing +Given the class: +public class b { + + public void m1() { + String s = "\\\\" // out of the string"; + ; + } + + /** + * Comment + */ + public void m2() { + return; + } +} +When the class is parsed by the comment parser +Then the total number of comments is 2 + +Scenario: Five slashes in string does not mess up comments parsing +Given the class: +public class b { + + public void m1() { + String s = "\\\\\" // still in string"; + ; + } + + /** + * Comment + */ + public void m2() { + return; + } +} +When the class is parsed by the comment parser +Then the total number of comments is 1 diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comparing_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comparing_scenarios.story new file mode 100644 index 0000000..fea7785 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/comparing_scenarios.story @@ -0,0 +1,19 @@ +Scenario: Compare CUs containing lambdas should not crash awfully + +Given the first class: +public class ArrayListGenericDemo { + + public static void main(String[] args) { + ArrayList data = new ArrayList(); + data.forEach( s -> System.out.println(s)); + } +} +Given the second class: +public class ArrayListGenericDemo { + + public static void main(String[] args) { + ArrayList data = new ArrayList(); + data.forEach( s -> System.out.println(s)); + } +} +Then they are equals diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/manipulation_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/manipulation_scenarios.story new file mode 100644 index 0000000..ea28279 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/manipulation_scenarios.story @@ -0,0 +1,137 @@ +Scenario: A Node can only ever be equal to a class that extends Node + +Given a CompilationUnit +Then is not equal to null +Then is not equal to "Some String Value" + + +Scenario: A BlockStmt can be created by a provided String + +Given a BlockStmt +When is the String "{return x+y;}" is parsed by the JavaParser using parseBlock +Then Statement 1 in BlockStmt toString is "return x + y;" + + +Scenario: A Statement can be created by a provided String + +Given a Statement +When is the String "x = x+y;" is parsed by the JavaParser using parseStatement +Then Statement toString is "x = x + y;" + + +Scenario: Adding declarations to a TryStmt it is set as the parent of all provided declarations + +Given a TryStmt +Given a List of VariableDeclarations +When the List of VariableDeclarations are set as the resources on TryStmt +Then all the VariableDeclarations parent is the TryStmt + + +Scenario: Creating a complete CompilationUnit + +Given a CompilationUnit +When the package declaration is set to "japa.parser.ast.manipulation" +When a public class called "CreateClass" is added to the CompilationUnit +When a public static method called "main" returning void is added to class 1 in the compilation unit +When String varargs called "args" are added to method 1 in class 1 +When a BlockStmt is added to method 1 in class 1 +When System.out.println("Hello World!"); is added to the body of method 1 in class 1 +Then the expected source should be: +package japa.parser.ast.manipulation; + +public class CreateClass { + + public static void main(String... args) { + System.out.println("Hello World!"); + } +} + + +Scenario: Change the name of a method to be uppercase + +Given a CompilationUnit +When the following source is parsed: +package japa.parser.ast.manipulation; + +public class UpdateMethod { + + public void changeToUpperCase(){} + + public void anotherMethodToChange(){} +} +When method 1 in class 1 has it's name converted to uppercase +Then method 1 in class 1 has the name "CHANGETOUPPERCASE" + + +Scenario: Change the name of all methods to be uppercase using a visitor + +Given a CompilationUnit +When the following source is parsed: +package japa.parser.ast.manipulation; + +public class UpdateMethod { + + public void changeToUpperCase(){} + + public void anotherMethodToChange(){} +} +Given a ChangeNameToUpperCaseVisitor +When the ChangeNameToUpperCaseVisitor visits to compilation unit +Then method 1 in class 1 has the name "CHANGETOUPPERCASE" +Then method 2 in class 1 has the name "ANOTHERMETHODTOCHANGE" + + +Scenario: Add int arguments to a method + +Given a CompilationUnit +When the following source is parsed: +package japa.parser.ast.manipulation; + +public class UpdateMethod { + + public void changeToUpperCase(String parameter){} + + public void anotherMethodToChange(){} +} +When method 2 in class 1 has an int parameter called "value" added +Then method 1 in class 1 has 1 parameters +Then method 2 in class 1 has 1 parameter +Then method 2 in class 1 parameter 1 is type int called "value" + + +Scenario: Add int arguments to all methods using a visitor + +Given a CompilationUnit +When the following source is parsed: +package japa.parser.ast.manipulation; + +public class UpdateMethod { + + public void changeToUpperCase(String parameter){} + + public void anotherMethodToChange(){} +} +Given a AddNewIntParameterCalledValueVisitor +When the AddNewIntParameterCalledValueVisitor visits to compilation unit +Then method 1 in class 1 has 2 parameters +Then method 2 in class 1 has 1 parameter +Then method 1 in class 1 parameter 2 is type int called "value" +Then method 2 in class 1 parameter 1 is type int called "value" + + +Scenario: Clone a compilation unit + +Given a CompilationUnit +When the following source is parsed: +package japa.parser.ast.manipulation; + +public class UpdateMethod { + + public void changeToUpperCase(String parameter){} + + public void anotherMethodToChange(){} +} +When the compilation unit is cloned +Then method 1 in class 1 has the name "changeToUpperCase" +Then method 1 in class 1 has 1 parameters +Then method 2 in class 1 has 0 parameter \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/parsing_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/parsing_scenarios.story new file mode 100644 index 0000000..9f6ee24 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/parsing_scenarios.story @@ -0,0 +1,500 @@ +Scenario: Test declaration as String for constructor on parsed class + +Given a CompilationUnit +When the following source is parsed: +class ClassWithAConstructor { + protected ClassWithAConstructor(int a, String b) throws This, AndThat, AndWhatElse { + } +} +Then constructor 1 in class 1 declaration as a String is "protected ClassWithAConstructor(int a, String b) throws This, AndThat, AndWhatElse" +Then all nodes refer to their parent + + +Scenario: Test declaration as String exclusing modifiers and throws for constructor on parsed class + +Given a CompilationUnit +When the following source is parsed: +class ClassWithAConstructor { + protected ClassWithAConstructor(int a, String b) throws This, AndThat, AndWhatElse { + } +} +Then constructor 1 in class 1 declaration short form as a String is "ClassWithAConstructor(int a, String b)" +Then all nodes refer to their parent + + +Scenario: Test declaration as String exclusing modifiers and throws for method on parsed class + +Given a CompilationUnit +When the following source is parsed: +class ClassWithAMethod { + /*comment1*/ + final protected /*comment2*/ native List /*comment2*/ aMethod(int a, String b) throws /*comment3*/ This, AndThat, AndWhatElse { + + } +} +Then method 1 in class 1 declaration as a String is "protected final native List aMethod(int a, String b) throws This, AndThat, AndWhatElse" +Then all nodes refer to their parent + + +Scenario: Test declaration as String exclusing modifiers and throws for method on parsed class + +Given a CompilationUnit +When the following source is parsed: +class ClassWithAMethod { + /*comment1*/ + final protected /*comment2*/ native List /*comment2*/ aMethod(int a, String b) throws /*comment3*/ This, AndThat, AndWhatElse { + + } +} +Then method 1 in class 1 declaration as a String short form is "List aMethod(int a, String b)" +Then all nodes refer to their parent + + +Scenario: The same class source is parsed by two different compilation units and should therefore be equal + +Given a CompilationUnit +Given a second CompilationUnit +When the following source is parsed: +package japa.parser.comments; +public class ClassEquality { + + public void aMethod(){ + // first comment + int a=0; // second comment + } +} +When the following sources is parsed by the second CompilationUnit: +package japa.parser.comments; +public class ClassEquality { + + public void aMethod(){ + // first comment + int a=0; // second comment + } +} +Then the CompilationUnit is equal to the second CompilationUnit +Then the CompilationUnit has the same hashcode to the second CompilationUnit +Then all nodes refer to their parent +Then all nodes of the second compilation unit refer to their parent + + +Scenario: Two different class sources are parsed by two different compilation units and should not be equal + +Given a CompilationUnit +Given a second CompilationUnit +When the following source is parsed: +package japa.parser.comments; +public class ClassEquality { + + public void aMethod(){ + // first comment + int a=0; // second comment + } +} +When the following sources is parsed by the second CompilationUnit: +package japa.parser.comments; +public class DifferentClass { + + public void aMethod(){ + // first comment + int a=0; // second comment + } +} +Then the CompilationUnit is not equal to the second CompilationUnit +Then the CompilationUnit has a different hashcode to the second CompilationUnit +Then all nodes refer to their parent +Then all nodes of the second compilation unit refer to their parent + + +Scenario: Classes that only differ by comments should not be equal or have the same hashcode + +Given a CompilationUnit +Given a second CompilationUnit +When the following source is parsed: +package japa.parser.comments; +public class ClassEquality { + + public void aMethod(){ + // first comment + int a=0; // second comment + } +} +When the following sources is parsed by the second CompilationUnit: +package japa.parser.comments; +public class ClassEquality { + + public void aMethod(){ + // first comment + int a=0; + } +} +Then the CompilationUnit is not equal to the second CompilationUnit +Then the CompilationUnit has a different hashcode to the second CompilationUnit +Then all nodes refer to their parent +Then all nodes of the second compilation unit refer to their parent + + +Scenario: A class with a colon in the annoation value is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +package japa.parser.ast; +import org.junit.Test; +public class Issue37 { + public static @interface SomeAnnotation { + String value(); + } + // Parser bug: the type of this field + @SomeAnnotation("http://someURL.org/") + protected Test test; +} +Then field 1 in class 1 contains annotation 1 value is ""http://someURL.org/"" +Then all nodes refer to their parent + + +Scenario: A class with a Lambda is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +package bdd.samples; +import java.util.stream.Stream; +public class Lambdas { + + public static void main(String[] args) { + // Lambda Runnable + Runnable r1 = () -> System.out.println("Hello world!"); + Runnable r2 = () -> {}; + Runnable r3 = () -> { System.out.println("Hello world two!"); }; + + Stream stream = Stream.generate((Supplier) () -> "foo"); + } +} +Then lambda in statement 1 in method 1 in class 1 is called r1 +Then lambda in statement 2 in method 1 in class 1 is called r2 +Then lambda in statement 3 in method 1 in class 1 is called r3 +Then lambda in statement 1 in method 1 in class 1 body is "System.out.println("Hello world!");" +Then lambda in statement 2 in method 1 in class 1 block statement is null +Then lambda in statement 3 in method 1 in class 1 block statement is "System.out.println("Hello world two!");" +Then lambda in statement 1 in method 1 in class 1 is parent of contained body +Then lambda in statement 3 in method 1 in class 1 is parent of contained body +Then all nodes refer to their parent +Then lambda in method call in statement 4 in method 1 in class 1 body is ""foo";" + + +Scenario: A class with parameterized Lambdas is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +package com.github.javapasrser.bdd.parsing; +import java.util.function.Function; +public class ParameterizedLambdas { + public static void main(String[] args) { + Function f1 = (Integer i) -> String.valueOf(i); + Function f2 = (i) -> String.valueOf(i); + Function f3 = i -> String.valueOf(i); + } +} +Then lambda in statement 1 in method 1 in class 1 is parent of contained parameter +Then lambda in statement 2 in method 1 in class 1 is parent of contained parameter +Then lambda in statement 3 in method 1 in class 1 is parent of contained parameter +Then lambda in statement 1 in method 1 in class 1 is parent of contained body +Then lambda in statement 2 in method 1 in class 1 is parent of contained body +Then lambda in statement 3 in method 1 in class 1 is parent of contained body +Then lambda in statement 1 in method 1 in class 1 has parameters with non-null type +Then lambda in statement 2 in method 1 in class 1 has parameters with non-null type +Then lambda in statement 3 in method 1 in class 1 has parameters with non-null type + + +Scenario: A class with multi-parameters Lambdas is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +package com.github.javapasrser.bdd.parsing; +import java.util.function.Function; +public class MultiParameterizedLambdas { + public static void main(String[] args) { + BiFunction f = (a, b) -> String.valueOf(a) + String.valueOf(b); + } +} +Then lambda in statement 1 in method 1 in class 1 has parameters with non-null type + + +Scenario: A class with a method reference is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +public class Person { + + String name; + LocalDate birthday; + + public void sortByAge(Person[] people){ + Arrays.sort(people, Person::compareByAge); + } + + public static int compareByAge(Person a, Person b) { + return a.birthday.compareTo(b.birthday); + } +} +Then method reference in statement 1 in method 1 in class 1 scope is Person +Then method reference in statement 1 in method 1 in class 1 identifier is compareByAge +Then all nodes refer to their parent + + +Scenario: An interface with a default method is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +interface MyInterface { + default String doSomething(){ + return "implementation in an interface!"; + } + + String doSomethingElse(); +} +Then method 1 class 1 is a default method +Then method 2 class 1 is not a default method +Then all nodes refer to their parent + +Scenario: A lambda expression inside a conditional expression is parsed by the Java Parser + +Given a CompilationUnit +When the following source is parsed: +public class A{ + static Predicate isEqual(Object targetRef) { + return (null == targetRef)? Objects::isNull : object -> targetRef.equals(object); + } +} +Then ThenExpr in the conditional expression of the statement 1 in method 1 in class 1 is LambdaExpr + +Scenario: Parsing array creation expressions the positions are correct + +Given a CompilationUnit +When the following source is parsed (trimming space): +public class A{ + int[][] a = new int[][]{}; +} +When I take the ArrayCreationExpr +Then the begin line is 2 +Then the begin column is 17 +Then the end line is 2 +Then the end column is 29 + +Scenario: simple cast on lambda expression can be parsed + +Given a CompilationUnit +When the following source is parsed: +class A { + static final Comparator DATE_ORDER = + (Comparator) (date1, date2) -> { + return Long.compare(date1.toEpochDay(), date2.toEpochDay()); + }; +} +Then all nodes refer to their parent + + +Scenario: a combined cast on lambda expression can be parsed + +Given a CompilationUnit +When the following source is parsed: +class A { + static final Comparator DATE_ORDER = + (Comparator & Serializable) (date1, date2) -> { + return Long.compare(date1.toEpochDay(), date2.toEpochDay()); + }; +} +Then all nodes refer to their parent + + +Scenario: a combined cast on a literal can be parsed + +Given a CompilationUnit +When the following source is parsed: +class A { + static int a = (Comparator & Serializable) 1; +} +Then all nodes refer to their parent + + +Scenario: Parsing excess semicolons on CompilationUnit level should work +Given a CompilationUnit +When the following source is parsed: +; +package a; +; +import foo.a; +; +class A { } +; +Then no errors are reported + +Scenario: Parsing excess semicolons in an AnnotationTypeDeclaration should work +Given a CompilationUnit +When the following source is parsed: +@interface A { + ; + ; +} +Then no errors are reported + +Scenario: Classes that are thrown from a method can be annotated + +Given a CompilationUnit +When the following source is parsed: +class A { + void a() throws @Abc X { + } +} +Then no errors are reported + +Scenario: Classes that are thrown from a constructor can be annotated + +Given a CompilationUnit +When the following source is parsed: +class A { + A() throws @Abc X { + } +} +Then no errors are reported + + +Scenario: Parsing trailing semicolons inside the imports area should work + +Given a CompilationUnit +When the following source is parsed: +import foo.a;; +import foo.b; + +class A { +} +Then no errors are reported + + +Scenario: Full package name should be parsed + +Given a CompilationUnit +When the following source is parsed: +package com.github.javaparser.bdd; +class C {} +When I take the PackageDeclaration +Then the package name is com.github.javaparser.bdd + + +Scenario: Strings with unescaped newlines are illegal (issue 211) +Given the class: +class A { + public void helloWorld(String greeting, String name) { + return "hello + world"; + } +} +Then the Java parser cannot parse it because of an error + +Scenario: Chars with unescaped newlines are illegal (issue 211) +Given the class: +class A { + public void helloWorld(String greeting, String name) { + return ' +'; + } +} +Then the Java parser cannot parse it because of an error + +Scenario: Diamond Operator information is exposed + +Given a CompilationUnit +When the following source is parsed: +class A { + List args = new ArrayList<>(); +} +When I take the ObjectCreationExpr +Then the type's diamond operator flag should be true + +Scenario: Diamond Operator can be parsed also with space and comments + +Given a CompilationUnit +When the following source is parsed: +class A { + List args = new ArrayList< /*hello*/ >(); +} +When I take the ObjectCreationExpr +Then the type's diamond operator flag should be true + +Scenario: Type Arguments are not specified + +Given a CompilationUnit +When the following source is parsed: +class A { + List args = new ArrayList(); +} +When I take the ObjectCreationExpr +Then the type's diamond operator flag should be false + +Scenario: Type Arguments are specified + +Given a CompilationUnit +When the following source is parsed: +class A { + Either either = new Either(); +} +When I take the ObjectCreationExpr +Then the type's diamond operator flag should be false + +Scenario: A method reference with type arguments is parsed correctly +Given a CompilationUnit +When the following source is parsed: +class X { + void x() { + a.orElseGet( Stream::>empty ); + } +} +Then no errors are reported + +Scenario: The target of this assignExpr is not null +Given a CompilationUnit +When the following source is parsed: +public class Example { + private String mString; + public Example(String arg) { + mString = arg; + } +} +Then the assignExpr produced doesn't have a null target + +Scenario: Two comments in one line, and a unicode space +Given a CompilationUnit +When the following source is parsed: +public class Example { + Object mAvailablePrimaryConnection; + public Example(String arg) { + ​mAvailablePrimaryConnection = openConnectionLocked(mConfiguration, + true /*primaryConnection*/); // comment + } +} +Then no errors are reported + +Scenario: alternative [] placings +Given a CompilationUnit +When the following source is parsed: +class I{int[]bar(int[]x[])[]{return new int[][]{};}} +Then no errors are reported + +Scenario: try requires resources, a finally or a catch (issue 442) +Given the class: +class A { + public void helloWorld() { + try { + } + } +} +Then the Java parser cannot parse it because of an error + + +Scenario: Partially dimensioned arrays are fine +Given a CompilationUnit +When the following source is parsed: +class X { + int a = new int @A [10] @A [20] @A [] []; + int b = new int @A [] @A []{{1}}; +} +Then no errors are reported diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/position_range_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/position_range_scenarios.story new file mode 100644 index 0000000..410e456 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/position_range_scenarios.story @@ -0,0 +1,55 @@ +Scenario: a position is equal to another position at the same place +Given the position 10, 10 +When I compare to position 10, 10 +Then the positions are equal +And it is not before the first position +And it is not after the first position + +Scenario: a position is after another position +Given the position 10, 10 +When I compare to position 20, 20 +Then it is after the first position +And the positions are not equal +And it is not before the first position + +Scenario: a position is directly after another position +Given the position 10, 10 +When I compare to position 10, 11 +Then it is after the first position +And the positions are not equal +And it is not before the first position + +Scenario: a position is before another position +Given the position 10, 10 +When I compare to position 5, 5 +Then it is before the first position +And the positions are not equal +And it is not after the first position + +Scenario: a position is directly before another position +Given the position 10, 10 +When I compare to position 10, 9 +Then it is before the first position +And the positions are not equal +And it is not after the first position + +Scenario: a range is equal to another range +Given the range 10, 10 - 20, 20 +When I compare to range 10, 10 - 20, 20 +Then the ranges are equal + +Scenario: a range is before a position +Given the position 20, 21 +When I compare to range 10, 10 - 20, 20 +Then it is before the position + +Scenario: a range is after a position +Given the position 10, 9 +When I compare to range 10, 10 - 20, 20 +Then it is after the position + +Scenario: a range is contained in another range +Given the range 10, 10 - 20, 20 +When I compare to range 11, 11 - 19, 19 +Then it is contained in the first range + diff --git a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/classes/DumperTestClass.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/pretty_printing_java_concepts.story similarity index 52% rename from Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/classes/DumperTestClass.java rename to Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/pretty_printing_java_concepts.story index 0d3e6cc..ebcf824 100644 --- a/Assignment-2/javaparser-1.0.0-src/test/japa/parser/ast/test/classes/DumperTestClass.java +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/pretty_printing_java_concepts.story @@ -1,301 +1,400 @@ -package japa.parser.ast.test.classes; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import java.io.File; -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; - -@Deprecated -public class DumperTestClass, X> extends Base implements Serializable { - - static Class clz1 = String.class; - - Class clz2 = (String.class); - - Class clz3 = int.class; - - Class clz4 = (int.class); - - int[] arr = new int[10]; - - ; - - @Deprecated() - static class Ugly { - - int x = 0; - - public static void main(String[] args) { - } - } - - ; - - @Deprecated() - int[][][][] arr2 = new int[10][2][1][0]; - - float fff = 0x1.fffeP+127f; - - char cc = 'a'; - - int[][] arr3 = { { 1, 2 }, { 3, 4 } }; - - static int[] arr4[] = {}; - - public static DumperTestClass t; - - static { - arr4 = new int[][] { { 2 }, { 1 } }; - } - - { - arr3 = new int[][] { { 2 }, { 1 } }; - } - - public enum Teste { - - asc, def - } - - public static enum Sexo { - - m, @Deprecated - f; - - public static enum Sexo_ implements Serializable { - } - - private Sexo() { - } - } - - public static enum Enum { - - m(1) { - - @Override - void mm() { - } - } - , f(2) { - - void mm() { - } - } - ; - - int x; - - private Enum(int x) { - this.x = x; - } - - abstract void mm(); - } - - public DumperTestClass(int x) { - this.arr[0] = x; - T val1 = null; - E val2 = null; - super.check2(val1, val2); - boolean b = true, y = false; - abstract class X { - - public X() { - } - - public void m() { - } - } - @Deprecated - final class Y extends X { - - public Y() { - super(); - Y.super.m(); - } - - public Y(int y) { - t.super(); - } - - public Y(long x) { - this(); - } - } - } - - public DumperTestClass(String str) { - } - - private class QWE extends DumperTestClass, String> { - - @Deprecated - final int z = 0; - - int i = (int) -1; - - public QWE(String... x) { - super(x[0]); - } - - public QWE(int... x) { - super(x[0]); - i = x[0]; - assert true; - assert 1 == 1 : 2; - { - int iii = 3; - iii += 3; - } - label: { - int iii = 1; - } - ; - ; - switch(i) { - } - ll: switch(i) { - case 1: - System.out.println(1); - break ll; - default: - { - System.out.println("default"); - break; - } - case 2: - System.out.println(1); - i++; - ++i; - } - } - - private synchronized int doSomething()[] { - List x = new ArrayList(); - return new int[] { 1 }; - } - } - - public static void main(String[] args) throws ParseException, IOException { - int x = 2; - CompilationUnit cu = parse(new File("src/japa/parser/javacc/Parser.java")); - System.out.println(cu); - DumperTestClass teste = new DumperTestClass(2); - DumperTestClass.QWE qwe = teste.new QWE(1); - if (1 + 1 == 2) { - teste = null; - teste = new DumperTestClass(1); - } else { - x = 3; - teste = new DumperTestClass(1); - x = 2; - } - if (true) x = 1; else x = 3; - while (true) { - while (x == 3) continue; - break; - } - do { - x++; - } while (x < 100); - do x++; while (x < 100); - for (@Deprecated int i : arr4[0]) { - x--; - } - for (@Deprecated final int i = 0, j = 1; i < 10; x++) { - break; - } - int i, j; - for (i = 0, j = 1; i < 10 && j < 2; i++, j--) { - break; - } - } - - @AnnotationTest(value = "x") - public static CompilationUnit parse(@Deprecated File file) throws ParseException, IOException { - String a = ((String) "qwe"); - String x = ((String) clz1.getName()); - int y = ((Integer) (Object) x).intValue(); - synchronized (file) { - file = null; - file = new File(""); - } - try { - if (file == null) { - throw new NullPointerException("blah"); - } - } catch (final NullPointerException e) { - System.out.println("catch"); - } catch (RuntimeException e) { - System.out.println("catch"); - } finally { - System.out.println("finally"); - } - try { - if (file == null) { - throw new NullPointerException("blah"); - } - } finally { - System.out.println("finally"); - } - try { - if (file == null) { - throw new NullPointerException("blah"); - } - } catch (RuntimeException e) { - System.out.println("catch"); - } - return JavaParser.parse(file); - } - - class A { - - public A(Integer integer, ABC string) { - } - } - - private void x(Map x) { - @Deprecated Comparator c = new Comparator() { - - public int compare(Object o1, Object o2) { - A a = new A(new Integer(11), "foo") { - }; - return 0; - } - - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - }; - } - - public @interface AnnotationTest { - - String value() default "asd"; - - @Deprecated - int[] valueI() default { 1, 2 }; - - AnnotationTest valueA1() default @AnnotationTest; - - AnnotationTest valueA2() default @AnnotationTest("qwe"); - - AnnotationTest valueA3() default @AnnotationTest(value = "qwe", valueI = { 1 }); - } - - ; -} - -class Base { - - public void check2(A val1, B val2) { - } -} \ No newline at end of file +Scenario: Check a whole lot of things at once that should be separate tests + +Given the class in the file "JavaConcepts.java" +When the class is parsed by the Java parser +Then it is printed as: +package japa.bdd.samples; + +import com.github.javaparser.JavaParser; +import japa.parser.ParseException; +import com.github.javaparser.ast.CompilationUnit; +import org.junit.Ignore; +import java.io.*; +import java.util.*; + +@Ignore +@Deprecated +public class JavaConcepts, X> extends Base implements Serializable { + + static Class clz1 = String.class; + + protected Class clz2 = (String.class); + + Class clz3 = int.class; + + Class clz4 = (int.class); + + int[] arr = new int[10]; + + byte bye = 0; + + byte[] byebye = null; + + short sh1, sh2 = 1; + + int intWithUnderscore = 1234_5678; + + long longWithUnderscore = 1234_5678L; + + float floatWithUnderscore = 1_234.5_678f; + + float floatWithUnderscoreAndExponent = 1_234e1_0f; + + double doubleWithUnderscore = 1_234.5_678; + + double doubleWithUnderscoreAndExponent = 1_234e1_0; + + int binaryLiteral = 0b101101; + + List[][] arrLS = (List[][]) new List[10][]; + + { + int z = 0, y = 0; + int a = (z) + y; + a = (+z) + y; + byte b = (byte) +y; + } + + List diamond1 = new LinkedList<>(); + + @Deprecated() + static class Ugly { + + static int x = 0; + + public static void main(String[] args) { + x = +x; + x = ~x; + --x; + boolean b = !false; + x &= 2; + x |= 2; + x ^= 2; + x -= 2; + x %= 2; + x /= 2; + x *= 2; + x <<= 2; + x >>= 2; + x >>>= 2; + b = b || false; + b = b | false; + b = b & false; + b = b ^ false; + b = b != false; + b = x > 1; + b = x < 1; + b = x >= 1; + b = x <= 1; + x = x << 1; + x = x >> 1; + x = x >>> 1; + x = x - 1; + x = x * 1; + x = x % 1; + x = x / 1; + } + } + + @Deprecated() + int[][][][] arr2 = new int[10][2][1][0]; + + volatile float fff = 0x1.fffeP+127f; + + char cc = 'a'; + + int[][] arr3 = { { 1, 2 }, { 3, 4 } }; + + static int[][] arr4 = {}; + + public static JavaConcepts t; + + static { + arr4 = new int[][] { { 2 }, { 1 } }; + } + + { + arr3 = new int[][] { { 2 }, { 1 } }; + } + + public enum Teste { + + asc, def + } + + public enum Sexo { + + m, @Deprecated + f; + + public enum Sexo_ implements Serializable, Cloneable { + } + + private Sexo() { + } + } + + @Deprecated + public enum Enum { + + m(1) { + + @Override + void mm() { + } + } + , f(2) { + + void mm() { + } + } + ; + + native void nnn(); + + transient int x; + + private Enum(int x) { + this.x = x; + } + + abstract void mm(); + } + + strictfp double ddd() { + return 0.0; + } + + public JavaConcepts(int x) { + this.arr[0] = x; + T val1 = null; + E val2 = null; + super.check2(val1, val2); + boolean b = true, y = false; + abstract class X { + + int i = 0; + + public X() { + } + + public void m() { + } + } + @Deprecated + final class Y extends X { + + public Y() { + super(); + JavaConcepts.this.cc = 'c'; + super.i = 1; + Y.super.m(); + } + + public Y(int y) { + super(); + } + + public Y(long x) { + this(); + } + } + } + + public JavaConcepts(String str) { + } + + private class QWE extends JavaConcepts, String> { + + @Deprecated + final int z = 0; + + int i = (int) -1; + + public QWE(String... x) { + super(x[0]); + } + + public QWE(int... x) { + super(x[0]); + i = x[0]; + assert true; + assert 1 == 1 : 2; + { + int iii = 3; + iii += 3; + } + label: { + int iii = 1; + } + ; + ; + int min = -2147483648; + long sl = 123123123123l; + long minl = -9223372036854775808L; + switch(i) { + } + ll: switch(i) { + case 1: + System.out.println(1); + break ll; + default: + { + System.out.println("default"); + break; + } + case 2: + if (t instanceof Base) { + System.out.println(1); + } + i++; + ++i; + } + } + + private synchronized int[] doSomething() { + List x = new ArrayList(); + return new int[] { 1 }; + } + } + + public static void main(String[] args) throws ParseException, IOException { + int x = 2; + CompilationUnit cu = parse(new File("src/japa/parser/javacc/Parser.java")); + System.out.println(cu); + JavaConcepts teste = new JavaConcepts(2); + JavaConcepts.QWE qwe = teste.new QWE(1); + if (1 + 1 == 2) { + teste = null; + teste = new JavaConcepts(1); + } else { + x = 3; + teste = new JavaConcepts(1); + x = x == 0 ? 2 : 4; + } + if (true) + x = 1; + else + x = 3; + if (true) + x = 1; + else if (false) + x = 3; + else + x = 2; + while (true) { + xxx: while (x == 3) continue xxx; + break; + } + do { + x++; + } while (x < 100); + do x++; while (x < 100); + for (@Deprecated int i : arr4[0]) { + x--; + } + for (@Deprecated final int i = 0, j = 1; i < 10; x++) { + break; + } + int i, j; + for (i = 0, j = 1; i < 10 && j < 2; i++, j--) { + break; + } + } + + public static CompilationUnit parse(@Deprecated File file) throws ParseException, IOException { + String a = ((String) "qwe"); + String x = ((String) clz1.getName()); + int y = ((Integer) (Object) x).intValue(); + synchronized (file) { + file = null; + file = new File(""); + } + try { + if (file == null) { + throw new NullPointerException("blah"); + } + } catch (final NullPointerException e) { + System.out.println("catch"); + } catch (RuntimeException e) { + System.out.println("catch"); + } finally { + System.out.println("finally"); + } + try { + if (file == null) { + throw new NullPointerException("blah"); + } + } finally { + System.out.println("finally"); + } + try { + if (file == null) { + throw new NullPointerException("blah"); + } + } catch (RuntimeException e) { + System.out.println("catch"); + } + try (InputStream in = createInputStream()) { + System.out.println(in); + } catch (IOException e) { + System.out.println("catch"); + } + try (InputStream in = createInputStream(); + InputStream in2 = createInputStream()) { + System.out.println(in); + } catch (IOException e) { + System.out.println("catch"); + } + try (InputStream in = createInputStream()) { + System.out.println(in); + } + try { + System.out.println("whatever"); + } catch (RuntimeException e) { + System.out.println(e); + } catch (final Exception | Error e) { + System.out.println(e); + } + return JavaParser.parse(file); + } + + class A implements XXX, Serializable { + + public A(Integer integer, ABC string) throws Exception, IOException { + } + } + + private void x(Map x) { + @Deprecated + Comparator c = new Comparator() { + + public int compare(Object o1, Object o2) { + try { + A a = new A(new Integer(11), "foo") { + }; + } catch (Exception e) { + } + return 0; + } + + @Override + public boolean equals(Object obj) { + return super.equals(obj); + } + }; + } + + private static InputStream createInputStream() { + return new ByteArrayInputStream(null); + } +} + +class Base { + + public void check2(A val1, B val2) { + } +} + +interface XXX extends Serializable, Cloneable { +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/pretty_printing_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/pretty_printing_scenarios.story new file mode 100644 index 0000000..0613443 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/pretty_printing_scenarios.story @@ -0,0 +1,520 @@ +Scenario: When printing the instantiation we should use the right amount of spaces + +Given the class: +public class A { + Object foo = new Object(); +} +When the class is parsed by the Java parser +Then it is printed as: +public class A { + + Object foo = new Object(); +} + + +Scenario: When printing the lambda expression we should use the right indentation + +Given the class: +public class B { + Runnable runnable = ()-> System.out.println("running"); + Consumer consumer = i->{ i+=1; System.out.println(i);}; +} +When the class is parsed by the Java parser +Then it is printed as: +public class B { + + Runnable runnable = () -> System.out.println("running"); + + Consumer consumer = i -> { + i += 1; + System.out.println(i); + }; +} + + +Scenario: Printing orphan comments in empty method +Given the class: +class A { + public void helloWorld(String greeting, String name) { + //sdfsdfsdf + //sdfds + /* + dgfdgfdgfdgfdgfd + */ + } +} +When the class is parsed by the Java parser +Then it is printed as: +class A { + + public void helloWorld(String greeting, String name) { + //sdfsdfsdf + //sdfds + /* + dgfdgfdgfdgfdgfd + */ + } +} + + + +Scenario: Printing orphan comments in empty method (issue 192) +Given the class: +public class StepImplementation { + @Step("A step") + public void contextStep() { + // Foo bar + } +} +When the class is parsed by the Java parser +Then it is printed as: +public class StepImplementation { + + @Step("A step") + public void contextStep() { + // Foo bar + } +} + + +Scenario: Printing orphan comments in for loop (issue 192) +Given the class: +public class StepImplementation { + public void contextStep() { + for (int i = 0; i < 5; i++) { + // foo bar + } + } +} +When the class is parsed by the Java parser +Then it is printed as: +public class StepImplementation { + + public void contextStep() { + for (int i = 0; i < 5; i++) { + // foo bar + } + } +} + + +Scenario: Printing orphan and attributed comments in for loop (issue 192) +Given the class: +public class StepImplementation { +public void contextStep() { + for (int i = 0; i < 5; i++) { + // foo bar + System.out.println(); + // another foo bar + } + } +} +When the class is parsed by the Java parser +Then it is printed as: +public class StepImplementation { + + public void contextStep() { + for (int i = 0; i < 5; i++) { + // foo bar + System.out.println(); + // another foo bar + } + } +} + + +Scenario: An empty Enum is printed correctly +Given the compilation unit: +package test; enum XYZ {} +When the class is parsed by the Java parser +Then it is printed as: +package test; + +enum XYZ { +} + +Scenario: An enum without fields has no () on its members +Given the compilation unit: +package test; enum XYZ {A,B,C} +When the class is parsed by the Java parser +Then it is printed as: +package test; + +enum XYZ { + + A, B, C +} + +Scenario: Strings with escaped newlines are parsed correctly +Given the class: +class A { + public void helloWorld(String greeting, String name) { + return "hello\nworld"; + } +} +When the class is parsed by the Java parser +Then it is printed as: +class A { + + public void helloWorld(String greeting, String name) { + return "hello\nworld"; + } +} + +Scenario: A multi-catch is printed correctly +Given the class: +class A { + public void a() { + try { + } catch (IndexOutOfBoundException | IOException e) { + } + } +} +When the class is parsed by the Java parser +Then it is printed as: +class A { + + public void a() { + try { + } catch (IndexOutOfBoundException | IOException e) { + } + } +} + +Scenario: An empty import does not fail +Given the class: +package a.b.c; + +; +When the class is parsed by the Java parser +Then it is printed as: +package a.b.c; + +Scenario: we can parse blocks +Given the block: +{ + a=2+1; + b=3+1; +} +When the block is parsed by the Java parser +Then it is printed as: +{ + a = 2 + 1; + b = 3 + 1; +} + +Scenario: we can parse statements +Given the statement: +while (true) { +} +When the statement is parsed by the Java parser +Then it is printed as: +while (true) { +} + +Scenario: we can parse static on demand imports +Given the import: +import static a.b.c.Abc.*; +When the import is parsed by the Java parser +Then it is printed as: +import static a.b.c.Abc.*; + +Scenario: we can parse static type imports +Given the import: +import static a.b.c.Abc; +When the import is parsed by the Java parser +Then it is printed as: +import static a.b.c.Abc; + +Scenario: we can parse on demand imports +Given the import: +import a.b.c.*; +When the import is parsed by the Java parser +Then it is printed as: +import a.b.c.*; + +Scenario: we can parse type imports +Given the import: +import a.b.c.Abc; +When the import is parsed by the Java parser +Then it is printed as: +import a.b.c.Abc; + +Scenario: we can parse annotations +Given the annotation: +@Abc +When the annotation is parsed by the Java parser +Then it is printed as: +@Abc + +Scenario: we can parse body declarations +Given the body: +String author(); +When the annotation body declaration is parsed by the Java parser +Then it is printed as: +String author(); + +Scenario: we can parse class body declarations +Given the body: +public int xyz() {} +When the class body declaration is parsed by the Java parser +Then it is printed as: +public int xyz() { +} + +Scenario: we can parse interface body declarations +Given the body: +int xyz(); +When the interface body declaration is parsed by the Java parser +Then it is printed as: +int xyz(); + +Scenario: It doesn't throw NPE when using a modifierVisitorAdapter +Given the class: +public class Example { + private String mString; + public Example(String arg) { + mString = arg; + } +} +When the class is parsed by the Java parser +When the class is visited by an empty ModifierVisitorAdapter +Then it is printed as: +public class Example { + + private String mString; + + public Example(String arg) { + mString = arg; + } +} + +Scenario: JavaDoc OR comment is printed, not both. +Given the class: +public class Foo { + /** This line gets duplicated */ + public void foo() { + } +} +When the class is parsed by the Java parser +Then it is printed as: +public class Foo { + + /** + * This line gets duplicated + */ + public void foo() { + } +} + +Scenario: various lamba casts (issue 418) +Given the class: +public class TestLambda { + void okMethod() { + return (ITF) () -> { + return true; + }; + } + void faliingMethod() { + testThis(check ? null : (ITF) () -> { + return true; + }); + } +} +When the class body declaration is parsed by the Java parser +Then it is printed as: +public class TestLambda { + + void okMethod() { + return (ITF) () -> { + return true; + }; + } + + void faliingMethod() { + testThis(check ? null : (ITF) () -> { + return true; + }); + } +} + +Scenario: Duplicate methods are not a parsing error (#416) +Given the class: +public class Foo { + public void foo() { + } + public void foo() { + } + public void foo() { + } +} +When the class is parsed by the Java parser +Then it is printed as: +public class Foo { + + public void foo() { + } + + public void foo() { + } + + public void foo() { + } +} + +Scenario: Both array syntaxes are supported (#416) +Given the class: +public class Foo { + public void m1(boolean[] boolArray) {} + public void m1(boolean boolArray[]) {} + public void m1(boolean[] boolArray[]) {} +} +When the class is parsed by the Java parser +Then it is printed as: +public class Foo { + + public void m1(boolean[] boolArray) { + } + + public void m1(boolean[] boolArray) { + } + + public void m1(boolean[][] boolArray) { + } +} + + +Scenario: Array parts can be annotated +Given the class: +class Foo { + void m1(@Boo boolean @Index1 [] @ Index2 [] boolArray) {} +} +When the class is parsed by the Java parser +Then it is printed as: +class Foo { + + void m1(@Boo boolean @Index1 [] @Index2 [] boolArray) { + } +} + +Scenario: Annotations are supported on annotations +Given the class: +@C @interface D { +} +When the class is parsed by the Java parser +Then it is printed as: +@C +@interface D { +} + +Scenario: Annotations are supported on interfaces +Given the class: +@C interface Abc { +} +When the class is parsed by the Java parser +Then it is printed as: +@C +interface Abc { +} + +Scenario: Annotations are supported on enums +Given the class: +@C enum Abc { +} +When the class is parsed by the Java parser +Then it is printed as: +@C +enum Abc { +} + +Scenario: Annotations are supported on classes (issue 436 is the commented part) +Given the compilation unit: +@C +public class Abc<@C A, @C X extends @C String & @C Serializable> { + + @C int @C[] @C []f; + + @C + public Abc(@C int p, List<@C ? extends Object> aa){ + @C int b; + } + public @C void a(@C int o) { +/* try { + throw new IOException(); + } catch (@C NullPointerException | @C IOException e) { + } +*/ } +} +When the compilation unit is parsed by the Java parser +Then it is printed as: +@C +public class Abc<@C A, @C X extends @C String & @C Serializable> { + + @C + int @C [] @C [] f; + + @C + public Abc(@C int p, List<@C ? extends Object> aa) { + @C + int b; + } + + @C + public void a(@C int o) { + /* try { + throw new IOException(); + } catch (@C NullPointerException | @C IOException e) { + } +*/ + } +} + + +Scenario: Annotations are supported inside catch (issue 436) +Given the compilation unit: +public class Abc { + public void a() { + try { + } catch (@C NullPointerException | @C IOException e) { + } + } +} +When the compilation unit is parsed by the Java parser +Then it is printed as: +public class Abc { + + public void a() { + try { + } catch (@C NullPointerException | @C IOException e) { + } + } +} + +Scenario: Inner class notation does not confuse annotations (#107) +Given the class: +class A extends @Ann1 B.@Ann2 C { +} +When the class is parsed by the Java parser +Then it is printed as: +class A extends @Ann1 B.@Ann2 C { +} + +Scenario: Make sure interface extends can be annotated +Given the class: +interface A extends @X B, @Y C, @Z D { +} +When the class is parsed by the Java parser +Then it is printed as: +interface A extends @X B, @Y C, @Z D { +} + +Scenario: default modifier isn't printed twice +Given the class: +interface X {default String author(){}} +When the annotation body declaration is parsed by the Java parser +Then it is printed as: +interface X { + + default String author() { + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/ClassInLatin1.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/ClassInLatin1.java new file mode 100644 index 0000000..096c70a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/ClassInLatin1.java @@ -0,0 +1,6 @@ +// Comment in Latin1: +// A l'émej in piasì che sent dësgust. +// For the curios reader, this is Piedmontese dialect +class A { + +} \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/JavaConcepts.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/JavaConcepts.java new file mode 100644 index 0000000..8e6dc92 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/JavaConcepts.java @@ -0,0 +1,397 @@ +package japa.bdd.samples; + +import com.github.javaparser.JavaParser; +import japa.parser.ParseException; +import com.github.javaparser.ast.CompilationUnit; +import org.junit.Ignore; + +import java.io.*; +import java.util.*; + +@Ignore +@Deprecated +public class JavaConcepts, X> extends Base implements Serializable { + + static Class clz1 = String.class; + + protected Class clz2 = (String.class); + + Class clz3 = int.class; + + Class clz4 = (int.class); + + int[] arr = new int[10]; + + byte bye = 0; + + byte byebye[] = null; + + short sh1, sh2 = 1; + + int intWithUnderscore = 1234_5678; + + long longWithUnderscore = 1234_5678L; + + float floatWithUnderscore = 1_234.5_678f; + + float floatWithUnderscoreAndExponent = 1_234e1_0f; + + double doubleWithUnderscore = 1_234.5_678; + + double doubleWithUnderscoreAndExponent = 1_234e1_0; + + int binaryLiteral = 0b101101; + + List[][] arrLS = (List[][]) new List[10][]; + + ; + + { + int z = 0, y = 0; + int a = (z) + y; + a = (+z) + y; + byte b = (byte) +y; + } + + List diamond1 = new LinkedList<>(); + + @Deprecated() + static class Ugly { + + static int x = 0; + + public static void main(String[] args) { + x = +x; + x = ~x; + --x; + boolean b = !false; + x &= 2; + x |= 2; + x ^= 2; + x -= 2; + x %= 2; + x /= 2; + x *= 2; + x <<= 2; + x >>= 2; + x >>>= 2; + b = b || false; + b = b | false; + b = b & false; + b = b ^ false; + b = b != false; + b = x > 1; + b = x < 1; + b = x >= 1; + b = x <= 1; + x = x << 1; + x = x >> 1; + x = x >>> 1; + x = x - 1; + x = x * 1; + x = x % 1; + x = x / 1; + } + } + + ; + + @Deprecated() + int[][][][] arr2 = new int[10][2][1][0]; + + volatile float fff = 0x1.fffeP+127f; + + char cc = 'a'; + + int[][] arr3 = {{1, 2}, {3, 4}}; + + static int[] arr4[] = {}; + + public static JavaConcepts t; + + static { + arr4 = new int[][]{{2}, {1}}; + } + + { + arr3 = new int[][]{{2}, {1}}; + } + + public enum Teste { + + asc, def + } + + public enum Sexo { + + m, @Deprecated + f; + + public enum Sexo_ implements Serializable, Cloneable { + } + + private Sexo() { + } + } + + @Deprecated + public enum Enum { + + m(1) { + @Override + void mm() { + } + }, f(2) { + void mm() { + } + }; + + native void nnn(); + + transient int x; + + private Enum(int x) { + this.x = x; + } + + abstract void mm(); + } + + strictfp double ddd() { + return 0.0; + } + + public JavaConcepts(int x) { + this.arr[0] = x; + T val1 = null; + E val2 = null; + super.check2(val1, val2); + boolean b = true, y = false; + abstract class X { + + int i = 0; + + public X() { + } + + public void m() { + } + } + @Deprecated + final class Y extends X { + + public Y() { + super(); + JavaConcepts.this.cc = 'c'; + super.i = 1; + Y.super.m(); + } + + public Y(int y) { + super(); + } + + public Y(long x) { + this(); + } + } + } + + public JavaConcepts(String str) { + } + + private class QWE extends JavaConcepts, String> { + + @Deprecated + final int z = 0; + + int i = (int) -1; + + public QWE(String... x) { + super(x[0]); + } + + public QWE(int... x) { + super(x[0]); + i = x[0]; + assert true; + assert 1 == 1 : 2; + { + int iii = 3; + iii += 3; + } + label: + { + int iii = 1; + } + ; + ; + int min = -2147483648; + long sl = 123123123123l; + long minl = -9223372036854775808L; + switch (i) { + } + ll: + switch (i) { + case 1: + System.out.println(1); + break ll; + default: { + System.out.println("default"); + break; + } + case 2: + if (t instanceof Base) { + System.out.println(1); + } + i++; + ++i; + } + } + + private synchronized int doSomething()[] { + List x = new ArrayList(); + return new int[]{1}; + } + } + + public static void main(String[] args) throws ParseException, IOException { + int x = 2; + CompilationUnit cu = parse(new File("src/japa/parser/javacc/Parser.java")); + System.out.println(cu); + JavaConcepts teste = new JavaConcepts(2); + JavaConcepts.QWE qwe = teste.new QWE(1); + if (1 + 1 == 2) { + teste = null; + teste = new JavaConcepts(1); + } else { + x = 3; + teste = new JavaConcepts(1); + x = x == 0 ? 2 : 4; + } + if (true) + x = 1; + else + x = 3; + if (true) + x = 1; + else if (false) + x = 3; + else + x = 2; + while (true) { + xxx: + while (x == 3) continue xxx; + break; + } + do { + x++; + } while (x < 100); + do x++; while (x < 100); + for (@Deprecated int i : arr4[0]) { + x--; + } + for (@Deprecated final int i = 0, j = 1; i < 10; x++) { + break; + } + int i, j; + for (i = 0, j = 1; i < 10 && j < 2; i++, j--) { + break; + } + } + + public static CompilationUnit parse(@Deprecated File file) throws ParseException, IOException { + String a = ((String) "qwe"); + String x = ((String) clz1.getName()); + int y = ((Integer) (Object) x).intValue(); + synchronized (file) { + file = null; + file = new File(""); + } + try { + if (file == null) { + throw new NullPointerException("blah"); + } + } catch (final NullPointerException e) { + System.out.println("catch"); + } catch (RuntimeException e) { + System.out.println("catch"); + } finally { + System.out.println("finally"); + } + try { + if (file == null) { + throw new NullPointerException("blah"); + } + } finally { + System.out.println("finally"); + } + try { + if (file == null) { + throw new NullPointerException("blah"); + } + } catch (RuntimeException e) { + System.out.println("catch"); + } + try (InputStream in = createInputStream()) { + System.out.println(in); + } catch (IOException e) { + System.out.println("catch"); + } + try (InputStream in = createInputStream(); + InputStream in2 = createInputStream()) { + System.out.println(in); + } catch (IOException e) { + System.out.println("catch"); + } + try (InputStream in = createInputStream()) { + System.out.println(in); + } + try { + System.out.println("whatever"); + } catch (RuntimeException e) { + System.out.println(e); + } catch (final Exception | Error e) { + System.out.println(e); + } + return JavaParser.parse(file); + } + + class A implements XXX, Serializable { + + public A(Integer integer, ABC string) throws Exception, IOException { + } + } + + private void x(Map x) { + @Deprecated Comparator c = new Comparator() { + + public int compare(Object o1, Object o2) { + try { + A a = new A(new Integer(11), "foo") { + }; + } catch (Exception e) { + } + return 0; + } + + @Override + public boolean equals(Object obj) { + return super.equals(obj); + } + }; + } + + private static InputStream createInputStream() { + return new ByteArrayInputStream(null); + } +} + +class Base { + + public void check2(A val1, B val2) { + } +} + +interface XXX extends Serializable, Cloneable { +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/package-info.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/package-info.java new file mode 100644 index 0000000..5703eb4 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/samples/package-info.java @@ -0,0 +1,5 @@ +/** + * This package contains class for doing some stuff. + */ +@C +package com.company.stuff; \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/visitor_scenarios.story b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/visitor_scenarios.story new file mode 100644 index 0000000..634a9f2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing-bdd/src/test/resources/com/github/javaparser/visitor_scenarios.story @@ -0,0 +1,67 @@ +Scenario: A class that is replicated using a CloneVisitor should be equal to the source + +Given a CompilationUnit +Given a second CompilationUnit +When the following source is parsed: +package japa.parser; +public class ClassEquality { + + public void aMethod(){ + int a=0; // second comment + } +} +When the CompilationUnit is cloned to the second CompilationUnit +Then the CompilationUnit is equal to the second CompilationUnit +Then the CompilationUnit has the same hashcode to the second CompilationUnit + + +Scenario: A classes variable name is changed to uppercase VoidVisitorAdapter + +Given a CompilationUnit +Given a VoidVisitorAdapter with a visit method that changes variable names to uppercase +When the following source is parsed: +package japa.parser; +public class ToUpperClass { + private int zero = 0; +} +When the CompilationUnit is visited by the to uppercase visitor +Then the expected source should be: +package japa.parser; +public class ToUpperClass { + private int ZERO = 0; +} + +Scenario: A class with a try statement is visited using by a VoidVisitorAdapter + +Given a CompilationUnit +Given a VoidVisitorAdapter with a visit method and collects the variable names +When the following source is parsed: +package japa.parser; +public class ToUpperClass { + public void aMethod(){ + try { + int zero = 0; + }catch (Exception exception) { + } + } +} +When the CompilationUnit is visited by the variable name collector visitor +Then the collected variable name is "exception;zero;" + + +Scenario: A class with a try statement is visited using by a GenericVisitorAdapter + +Given a CompilationUnit +Given a GenericVisitorAdapter with a visit method that returns variable names +When the following source is parsed: +package japa.parser; +public class ToUpperClass { + public void aMethod(){ + try { + int zero = 0; + }catch (Exception exception) { + } + } +} +When the CompilationUnit is visited by the visitor that returns variable names +Then the return variable name is "zero" diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/pom.xml b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/pom.xml new file mode 100644 index 0000000..9a3a03e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/pom.xml @@ -0,0 +1,89 @@ + + + javaparser-parent + com.github.javaparser + 3.27.0 + + 4.0.0 + + javaparser-core-testing + The test suite for javaparser-core + + + + GNU Lesser General Public License + http://www.gnu.org/licenses/lgpl-3.0.html + repo + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + + org.jacoco + jacoco-maven-plugin + + + org.apache.maven.plugins + maven-deploy-plugin + + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + plain + true + @{jacoco.javaagent} + + + + + + + com.github.javaparser + javaparser-core + ${project.version} + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.hamcrest + hamcrest + test + + + org.assertj + assertj-core + 3.27.3 + test + + + com.squareup.okhttp3 + okhttp + 4.12.0 + test + + + org.mockito + mockito-inline + + + + diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/CommentsInserterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/CommentsInserterTest.java new file mode 100644 index 0000000..248bfce --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/CommentsInserterTest.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.utils.TestUtils.assertEqualToTextResourceNoEol; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.comments.CommentsCollection; +import com.github.javaparser.utils.LineSeparator; +import com.github.javaparser.utils.TestParser; +import java.io.IOException; +import org.junit.jupiter.api.Test; + +class CommentsInserterTest { + private String makeFilename(String sampleName) { + return "com/github/javaparser/issue_samples/" + sampleName + ".java.txt"; + } + + private String makeExpectedFilename(String sampleName) { + return "/com/github/javaparser/issue_samples/" + sampleName + ".java.expected.txt"; + } + + private ParseResult parseSample(String sampleName) throws IOException { + Provider p = Providers.resourceProvider(makeFilename(sampleName)); + return new JavaParser().parse(ParseStart.COMPILATION_UNIT, p); + } + + /** + * Issue: "When there is a String constant "\\" compilationUnit ignores all further comments" + */ + @Test + void issue290() throws IOException { + ParseResult result = this.parseSample("Issue290"); + CommentsCollection cc = result.getCommentsCollection().get(); + assertEquals(1, cc.getLineComments().size()); + assertEquals(1, cc.getJavadocComments().size()); + } + + @Test + void issue624() throws IOException { + this.parseSample("Issue624"); + // Should not fail + } + + @Test + void issue200EnumConstantsWithCommentsForceVerticalAlignment() { + CompilationUnit cu = + TestParser.parseCompilationUnit("public enum X {" + LineSeparator.SYSTEM + " /** const1 javadoc */" + + LineSeparator.SYSTEM + " BORDER_CONSTANT," + + LineSeparator.SYSTEM + " /** const2 javadoc */" + + LineSeparator.SYSTEM + " ANOTHER_CONSTANT" + + LineSeparator.SYSTEM + "}"); + assertEqualsStringIgnoringEol( + "public enum X {\n" + "\n" + + " /**\n" + + " * const1 javadoc\n" + + " */\n" + + " BORDER_CONSTANT,\n" + + " /**\n" + + " * const2 javadoc\n" + + " */\n" + + " ANOTHER_CONSTANT\n" + + "}\n", + cu.toString()); + } + + @Test + void issue234LosingCommentsInArrayInitializerExpr() { + CompilationUnit cu = TestParser.parseCompilationUnit("@Anno(stuff={" + LineSeparator.SYSTEM + " // Just," + + LineSeparator.SYSTEM + " // an," + + LineSeparator.SYSTEM + " // example" + + LineSeparator.SYSTEM + "})" + + LineSeparator.SYSTEM + "class ABC {" + + LineSeparator.SYSTEM + "" + + LineSeparator.SYSTEM + "}"); + + assertEqualsStringIgnoringEol( + "@Anno(stuff = {// Just,\n" + "// an,\n" + "// example\n" + "})\n" + "class ABC {\n" + "}\n", + cu.toString()); + } + + @Test + void issue412() throws IOException { + CompilationUnit cu = parseSample("Issue412").getResult().get(); + assertEqualToTextResourceNoEol(makeExpectedFilename("Issue412"), cu.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ExpectedTokensTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ExpectedTokensTest.java new file mode 100644 index 0000000..372c2af --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ExpectedTokensTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.utils.TestUtils.getNodeStartingAtPosition; +import static com.github.javaparser.utils.TestUtils.parseFile; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.CharLiteralExpr; +import com.github.javaparser.utils.ExtractingVisitors; +import java.util.List; +import org.junit.jupiter.api.Test; + +class ExpectedTokensTest { + + @Test + void testCharEscapeSequences() { + CompilationUnit compilationUnit = parseFile("/com/github/javaparser/EscapeSequences.java"); + List chars = ExtractingVisitors.extractCharLiteralExprs(compilationUnit); + assertEquals(23, chars.size()); + + assertTokenValue(chars, 7, 17, "\\\\"); + assertTokenValue(chars, 7, 23, "\\u005C\\u005C"); + assertTokenValue(chars, 7, 39, "\\u005c\\u005c"); + assertTokenValue(chars, 9, 17, "\\n"); + assertTokenValue(chars, 9, 23, "\\u005cn"); + assertTokenValue(chars, 9, 34, "\\u005Cn"); + assertTokenValue(chars, 11, 17, "\\r"); + assertTokenValue(chars, 11, 23, "\\u005cr"); + assertTokenValue(chars, 11, 34, "\\u005Cr"); + assertTokenValue(chars, 13, 17, "\\t"); + assertTokenValue(chars, 13, 23, "\\u005ct"); + assertTokenValue(chars, 13, 34, "\\u005Ct"); + assertTokenValue(chars, 15, 17, "\\b"); + assertTokenValue(chars, 15, 23, "\\u005cb"); + assertTokenValue(chars, 15, 34, "\\u005Cb"); + assertTokenValue(chars, 17, 17, "\\f"); + assertTokenValue(chars, 17, 23, "\\u005cf"); + assertTokenValue(chars, 17, 34, "\\u005Cf"); + assertTokenValue(chars, 19, 17, "\\'"); + assertTokenValue(chars, 19, 23, "\\u005c'"); + assertTokenValue(chars, 21, 17, "\\\""); + assertTokenValue(chars, 21, 23, "\\u005c\""); + assertTokenValue(chars, 21, 34, "\\u005C\""); + } + + private void assertTokenValue(List chars, int line, int col, String expectedTokenValue) { + CharLiteralExpr expr = getNodeStartingAtPosition(chars, line, col); + assertEquals(expectedTokenValue, expr.getValue(), "Node at " + line + "," + col); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/GeneratedJavaParserTokenManagerTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/GeneratedJavaParserTokenManagerTest.java new file mode 100644 index 0000000..95a73b3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/GeneratedJavaParserTokenManagerTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.StaticJavaParser.parseResource; + +import java.io.IOException; +import org.junit.jupiter.api.Test; + +class GeneratedJavaParserTokenManagerTest { + private String makeFilename(String sampleName) { + return "com/github/javaparser/issue_samples/" + sampleName + ".java.txt"; + } + + @Test + void issue1003() throws IOException { + parseResource(makeFilename("issue1003")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue1017Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue1017Test.java new file mode 100644 index 0000000..721ff08 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue1017Test.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import com.github.javaparser.ast.CompilationUnit; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class Issue1017Test { + + @Test() + void test() { + String code = "class X{int x(){ a(1+1 -> 10);}}"; + + Assertions.assertThrows(ParseProblemException.class, () -> { + CompilationUnit cu = StaticJavaParser.parse(code); + }); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue2482Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue2482Test.java new file mode 100644 index 0000000..428f6ca --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue2482Test.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.expr.LambdaExpr; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +/** + * Tests related to https://github.com/javaparser/javaparser/issues/2482. + */ +public class Issue2482Test { + @Test + public void commentBeforeLambda() { + LambdaExpr le = StaticJavaParser.parseExpression( + "// a comment before parent" + System.lineSeparator() + "()->{return 1;}"); + + assertTrue(le.getComment().isPresent()); + assertTrue(le.getOrphanComments().isEmpty()); + assertEquals(0, le.getAllContainedComments().size()); + } + + @Test + public void commentBeforeBlock() { + Statement st = StaticJavaParser.parseBlock( + "// a comment before parent" + System.lineSeparator() + "{ if (file != null) {} }"); + assertTrue(st.getComment().isPresent()); + assertTrue(st.getOrphanComments().isEmpty()); + assertEquals(0, st.getAllContainedComments().size()); + } + + @Test + public void commentBeforeIfStatement() { + Statement st = StaticJavaParser.parseStatement( + "// a comment before parent" + System.lineSeparator() + "if (file != null) {}"); + assertTrue(st.getComment().isPresent()); + assertTrue(st.getOrphanComments().isEmpty()); + assertEquals(0, st.getAllContainedComments().size()); + } + + @Test + public void commentBeforeAssignment() { + Statement st = StaticJavaParser.parseStatement("// a comment" + System.lineSeparator() + "int x = 3;"); + + assertTrue(st.getComment().isPresent()); + assertTrue(st.getOrphanComments().isEmpty()); + assertEquals(0, st.getAllContainedComments().size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue3064Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue3064Test.java new file mode 100644 index 0000000..0eaf276 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue3064Test.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import java.io.StringReader; +import org.junit.jupiter.api.Test; + +public class Issue3064Test { + + @Test + public void test0() { + String str = "import java.util.function.Supplier;\n" + "\n" + + "public class MyClass {\n" + + "\n" + + " public MyClass() {\n" + + " Supplier aStringSupplier = false ? () -> \"\" : true ? () -> \"\" : () -> \"path\";\n" + + " }\n" + + "}\n"; + + JavaParser parser = new JavaParser(); + ParseResult unitOpt = parser.parse(new StringReader(str)); + unitOpt.getProblems().stream().forEach(p -> System.err.println(p.toString())); + CompilationUnit unit = unitOpt.getResult().orElseThrow(() -> new IllegalStateException("Could not parse file")); + + assertEquals(str, unit.toString()); + } + + @Test + public void test1() { + String str = "public class MyClass {\n" + " {\n" + + " Supplier aStringSupplier = false ? () -> \"F\" : true ? () -> \"T\" : () -> \"path\";\n" + + " }\n" + + "}"; + CompilationUnit unit = StaticJavaParser.parse(str); + assertEquals(str.replace("\n", ""), unit.toString().replace("\n", "")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue3577Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue3577Test.java new file mode 100755 index 0000000..752630b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/Issue3577Test.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + +import com.github.javaparser.ParserConfiguration.LanguageLevel; +import org.junit.jupiter.api.Test; + +public class Issue3577Test { + + @Test + public void test() { + String str = "public class MyClass {\n" + + " public static void main(String args[]) {\n" + + " System.out.println(\"Hello\\sWorld\");\n" + + " }\n" + + "}"; + + ParserConfiguration config = new ParserConfiguration().setLanguageLevel(LanguageLevel.JAVA_15); + StaticJavaParser.setConfiguration(config); + + assertDoesNotThrow(() -> StaticJavaParser.parse(str)); + // unitOpt.getProblems().stream().forEach(p -> System.err.println(p.toString())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaParserAdapterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaParserAdapterTest.java new file mode 100644 index 0000000..9902681 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaParserAdapterTest.java @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.ModuleDeclaration; +import com.github.javaparser.ast.modules.ModuleDirective; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.ast.type.TypeParameter; +import java.io.ByteArrayInputStream; +import java.io.CharArrayReader; +import java.io.InputStream; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.util.Optional; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +class JavaParserAdapterTest { + + private final JavaParser javaParser = Mockito.spy(JavaParser.class); + + private final JavaParserAdapter adapter = new JavaParserAdapter(javaParser); + + @Test + void of_withValidParser() { + JavaParserAdapter actualAdapter = JavaParserAdapter.of(javaParser); + assertSame(javaParser, actualAdapter.getParser()); + assertSame(javaParser.getParserConfiguration(), adapter.getParserConfiguration()); + } + + @Test + void parse_withSourceCode() { + + CompilationUnit cu = adapter.parse("class A {}"); + + Optional classA = cu.findFirst(ClassOrInterfaceDeclaration.class); + assertTrue(classA.isPresent()); + assertEquals("A", classA.get().getNameAsString()); + + Mockito.verify(javaParser).parse("class A {}"); + } + + @Test + void parse_withInvalidSourceCode() { + assertThrows(ParseProblemException.class, () -> adapter.parse("class A")); + } + + @Test + void parse_withSourceCodeFromInputStream() { + + InputStream is = new ByteArrayInputStream("class A {}".getBytes(StandardCharsets.UTF_8)); + + CompilationUnit cu = adapter.parse(is); + + Optional classA = cu.findFirst(ClassOrInterfaceDeclaration.class); + assertTrue(classA.isPresent()); + assertEquals("A", classA.get().getNameAsString()); + + Mockito.verify(javaParser).parse(is); + } + + @Test + void parse_withSourceCodeFromReader() { + + Reader reader = new CharArrayReader("class A {}".toCharArray()); + + CompilationUnit cu = adapter.parse(reader); + + Optional classA = cu.findFirst(ClassOrInterfaceDeclaration.class); + assertTrue(classA.isPresent()); + assertEquals("A", classA.get().getNameAsString()); + + Mockito.verify(javaParser).parse(reader); + } + + @Test + void parseBlock_withValidSource() { + BlockStmt block = adapter.parseBlock("{ System.out.println(\"Hello world!\"); }"); + + assertEquals(1, block.getStatements().size()); + + Mockito.verify(javaParser).parseBlock("{ System.out.println(\"Hello world!\"); }"); + } + + @Test + void parseStatement_withValidSource() { + Statement statement = adapter.parseStatement("break;"); + + assertTrue(statement.isBreakStmt()); + + Mockito.verify(javaParser).parseStatement("break;"); + } + + @Test + void parseImport_withValidSource() { + ImportDeclaration importDecl = adapter.parseImport("import java.util.Optional;"); + + assertEquals("Optional", importDecl.getName().getIdentifier()); + + Mockito.verify(javaParser).parseImport("import java.util.Optional;"); + } + + @Test + void parseExpression_withValidSource() { + Expression expression = adapter.parseExpression("System.out.println(\"Hello world!\")"); + + assertTrue(expression.isMethodCallExpr()); + + Mockito.verify(javaParser).parseExpression("System.out.println(\"Hello world!\")"); + } + + @Test + void parseAnnotation_withValidSource() { + AnnotationExpr annotation = adapter.parseAnnotation("@Test"); + + assertEquals("Test", annotation.getNameAsString()); + + Mockito.verify(javaParser).parseAnnotation("@Test"); + } + + @Test + void parseAnnotationBodyDeclaration_withValidSource() { + BodyDeclaration annotationBody = adapter.parseAnnotationBodyDeclaration("@interface Test{}"); + + assertTrue(annotationBody.isAnnotationDeclaration()); + + Mockito.verify(javaParser).parseAnnotationBodyDeclaration("@interface Test{}"); + } + + @Test + void parseBodyDeclaration_withValidSource() { + BodyDeclaration interfaceBody = adapter.parseBodyDeclaration("interface CustomInterface {}"); + + assertTrue(interfaceBody.isClassOrInterfaceDeclaration()); + + Mockito.verify(javaParser).parseBodyDeclaration("interface CustomInterface {}"); + } + + @Test + void parseClassOrInterfaceType_withValidSource() { + ClassOrInterfaceType customType = adapter.parseClassOrInterfaceType("CustomInterface"); + + assertTrue(customType.isClassOrInterfaceType()); + + Mockito.verify(javaParser).parseClassOrInterfaceType("CustomInterface"); + } + + @Test + void parseType_withValidSource() { + Type customType = adapter.parseType("int"); + + assertTrue(customType.isPrimitiveType()); + + Mockito.verify(javaParser).parseType("int"); + } + + @Test + void parseVariableDeclarationExpr_withValidSource() { + VariableDeclarationExpr variable = adapter.parseVariableDeclarationExpr("final int x = 0"); + + assertTrue(variable.isFinal()); + + Mockito.verify(javaParser).parseVariableDeclarationExpr("final int x = 0"); + } + + @Test + void parseExplicitConstructorInvocationStmt_withValidSource() { + ExplicitConstructorInvocationStmt statement = adapter.parseExplicitConstructorInvocationStmt("super();"); + + assertTrue(statement.getArguments().isEmpty()); + + Mockito.verify(javaParser).parseExplicitConstructorInvocationStmt("super();"); + } + + @Test + void parseName_withValidSource() { + Name name = adapter.parseName("com.github.javaparser.JavaParser"); + + assertEquals("JavaParser", name.getIdentifier()); + + Mockito.verify(javaParser).parseName("com.github.javaparser.JavaParser"); + } + + @Test + void parseSimpleName_withValidSource() { + SimpleName name = adapter.parseSimpleName("JavaParser"); + + assertEquals("JavaParser", name.getIdentifier()); + + Mockito.verify(javaParser).parseSimpleName("JavaParser"); + } + + @Test + void parseParameter_withValidSource() { + Parameter parameter = adapter.parseParameter("String foo"); + + assertEquals("foo", parameter.getNameAsString()); + + Mockito.verify(javaParser).parseParameter("String foo"); + } + + @Test + void parsePackageDeclaration_withValidSource() { + PackageDeclaration packageDeclaration = adapter.parsePackageDeclaration("package com.github.javaparser;"); + + assertEquals("com.github.javaparser", packageDeclaration.getNameAsString()); + + Mockito.verify(javaParser).parsePackageDeclaration("package com.github.javaparser;"); + } + + @Test + void parseTypeDeclaration_withValidSource() { + TypeDeclaration typeDeclaration = adapter.parseTypeDeclaration("class A {}"); + + assertEquals("A", typeDeclaration.getNameAsString()); + + Mockito.verify(javaParser).parseTypeDeclaration("class A {}"); + } + + @Test + void parseModuleDeclaration_withValidSource() { + ModuleDeclaration moduleDeclaration = adapter.parseModuleDeclaration("module X {}"); + + assertEquals("X", moduleDeclaration.getNameAsString()); + + Mockito.verify(javaParser).parseModuleDeclaration("module X {}"); + } + + @Test + void parseModuleDirective_withValidSource() { + ModuleDirective moduleDirective = adapter.parseModuleDirective("opens X;"); + + assertTrue(moduleDirective.isModuleOpensDirective()); + + Mockito.verify(javaParser).parseModuleDirective("opens X;"); + } + + @Test + void parseTypeParameter_withValidSource() { + TypeParameter typeParameter = adapter.parseTypeParameter("T extends Object"); + + assertEquals("T", typeParameter.getNameAsString()); + + Mockito.verify(javaParser).parseTypeParameter("T extends Object"); + } + + @Test + void parseMethodDeclaration_withValidSource() { + MethodDeclaration methodDeclaration = adapter.parseMethodDeclaration("void test() {}"); + + assertEquals("test", methodDeclaration.getNameAsString()); + + Mockito.verify(javaParser).parseMethodDeclaration("void test() {}"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaParserTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaParserTest.java new file mode 100644 index 0000000..1c8ce1f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaParserTest.java @@ -0,0 +1,426 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.BLEEDING_EDGE; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.CURRENT; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.Range.range; +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.utils.TestUtils.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.AnnotationMemberDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ForStmt; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.IntersectionType; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.printer.YamlPrinter; +import com.github.javaparser.utils.LineSeparator; +import java.util.Optional; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class JavaParserTest { + + @BeforeEach + void setToLatestJava() { + StaticJavaParser.getConfiguration().setLanguageLevel(BLEEDING_EDGE); + } + + @AfterEach + void resetJavaLevel() { + StaticJavaParser.getConfiguration().setLanguageLevel(CURRENT); + } + + @Test + void rangeOfAnnotationMemberDeclarationIsCorrect() { + String code = "@interface AD { String foo(); }"; + CompilationUnit cu = parse(code); + AnnotationMemberDeclaration memberDeclaration = + cu.getAnnotationDeclarationByName("AD").get().getMember(0).asAnnotationMemberDeclaration(); + assertTrue(memberDeclaration.hasRange()); + assertEquals( + new Range(new Position(1, 17), new Position(1, 29)), + memberDeclaration.getRange().get()); + } + + @Test + void testSourcePositionsWithUnicodeEscapes() { + String code = "@interface AD \\u007B String foo(); \\u007D"; + CompilationUnit cu = parseWithUnicodeEscapes(code).getResult().get(); + AnnotationMemberDeclaration memberDeclaration = + cu.getAnnotationDeclarationByName("AD").get().getMember(0).asAnnotationMemberDeclaration(); + assertTrue(memberDeclaration.hasRange()); + assertEquals( + new Range(new Position(1, 22), new Position(1, 34)), + memberDeclaration.getRange().get()); + } + + @Test + void testSourcePositionsWithBrokenUnicodeEscapes() { + // Source positions + // 111111111122222222 2 22333 3333 + // 123456789012345678901234567 8 90123 4567 + String code = "@interface AD { String X = \"\\uABC\"; }"; + ParseResult cu = parseWithUnicodeEscapes(code); + assertFalse(cu.getResult().isPresent()); + assertEquals( + "Lexical error at line 1, column 34. Encountered: \"\\\"\" (34), after : \"\\\"\\\\uABC\"", + cu.getProblem(0).getMessage()); + } + + private static ParseResult parseWithUnicodeEscapes(String code) { + ParserConfiguration config = new ParserConfiguration(); + config.setPreprocessUnicodeEscapes(true); + return new JavaParser(config).parse(code); + } + + @Test + void rangeOfAnnotationMemberDeclarationWithArrayTypeIsCorrect() { + String code = "@interface AD { String[] foo(); }"; + CompilationUnit cu = parse(code); + AnnotationMemberDeclaration memberDeclaration = + cu.getAnnotationDeclarationByName("AD").get().getMember(0).asAnnotationMemberDeclaration(); + assertTrue(memberDeclaration.hasRange()); + assertEquals( + new Range(new Position(1, 17), new Position(1, 31)), + memberDeclaration.getRange().get()); + } + + @Test + void rangeOfArrayCreationLevelWithExpressionIsCorrect() { + String code = "new int[123][456]"; + ArrayCreationExpr expression = parseExpression(code); + Optional range; + + range = expression.getLevels().get(0).getRange(); + assertTrue(range.isPresent()); + assertEquals(new Range(new Position(1, 8), new Position(1, 12)), range.get()); + + range = expression.getLevels().get(1).getRange(); + assertTrue(range.isPresent()); + assertEquals(new Range(new Position(1, 13), new Position(1, 17)), range.get()); + } + + @Test + void rangeOfArrayCreationLevelWithoutExpressionIsCorrect() { + String code = "new int[][]"; + ArrayCreationExpr expression = parseExpression(code); + Optional range; + + range = expression.getLevels().get(0).getRange(); + assertTrue(range.isPresent()); + assertEquals(new Range(new Position(1, 8), new Position(1, 9)), range.get()); + + range = expression.getLevels().get(1).getRange(); + assertTrue(range.isPresent()); + assertEquals(new Range(new Position(1, 10), new Position(1, 11)), range.get()); + } + + @Test + void parseErrorContainsLocation() { + ParseResult result = new JavaParser().parse(COMPILATION_UNIT, provider("class X { // blah")); + + Problem problem = result.getProblem(0); + assertEquals(range(1, 9, 1, 17), problem.getLocation().get().toRange().get()); + assertEquals( + "Parse error. Found , expected one of \";\" \"<\" \"@\" \"abstract\" \"boolean\" \"byte\" \"char\" \"class\" \"default\" \"double\" \"enum\" \"exports\" \"final\" \"float\" \"int\" \"interface\" \"long\" \"module\" \"native\" \"non-sealed\" \"open\" \"opens\" \"permits\" \"private\" \"protected\" \"provides\" \"public\" \"record\" \"requires\" \"sealed\" \"short\" \"static\" \"strictfp\" \"synchronized\" \"to\" \"transient\" \"transitive\" \"uses\" \"void\" \"volatile\" \"when\" \"with\" \"yield\" \"{\" \"}\" ", + problem.getMessage()); + assertInstanceOf(ParseException.class, problem.getCause().get()); + } + + @Test + void parseIntersectionType() { + String code = "(Runnable & Serializable) (() -> {})"; + Expression expression = parseExpression(code); + Type type = expression.asCastExpr().getType(); + + assertTrue(type instanceof IntersectionType); + IntersectionType intersectionType = type.asIntersectionType(); + assertEquals(2, intersectionType.getElements().size()); + assertTrue(intersectionType.getElements().get(0) instanceof ClassOrInterfaceType); + assertEquals( + "Runnable", + intersectionType.getElements().get(0).asClassOrInterfaceType().getNameAsString()); + assertTrue(intersectionType.getElements().get(1) instanceof ClassOrInterfaceType); + assertEquals( + "Serializable", + intersectionType.getElements().get(1).asClassOrInterfaceType().getNameAsString()); + } + + @Test + void parseArrayInitialization() { + String code = "{1,2,3}"; + ArrayInitializerExpr expression = parseArrayInitializerExpr(code); + + assertEquals(3, expression.getValues().size()); + } + + @Test + void rangeOfIntersectionType() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = + cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + ReturnStmt returnStmt = + methodDeclaration.getBody().get().getStatement(0).asReturnStmt(); + CastExpr castExpr = returnStmt.getExpression().get().asCastExpr(); + Type type = castExpr.getType(); + assertEquals(range(3, 13, 3, 54), type.getRange().get()); + } + + @Test + void rangeOfCast() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = + cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + ReturnStmt returnStmt = + methodDeclaration.getBody().get().getStatement(0).asReturnStmt(); + CastExpr castExpr = returnStmt.getExpression().get().asCastExpr(); + assertEquals(range(3, 12, 3, 101), castExpr.getRange().get()); + } + + @Test + void rangeOfCastNonIntersection() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> )(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = + cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + ReturnStmt returnStmt = + methodDeclaration.getBody().get().getStatement(0).asReturnStmt(); + CastExpr castExpr = returnStmt.getExpression().get().asCastExpr(); + assertEquals(range(3, 12, 3, 101), castExpr.getRange().get()); + } + + @Test + void rangeOfLambda() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = + cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + ReturnStmt returnStmt = + methodDeclaration.getBody().get().getStatement(0).asReturnStmt(); + CastExpr castExpr = returnStmt.getExpression().get().asCastExpr(); + LambdaExpr lambdaExpr = castExpr.getExpression().asLambdaExpr(); + assertEquals(range(3, 56, 3, 101), lambdaExpr.getRange().get()); + assertEquals( + GeneratedJavaParserConstants.LPAREN, + lambdaExpr.getTokenRange().get().getBegin().getKind()); + assertEquals( + GeneratedJavaParserConstants.RPAREN, + lambdaExpr.getTokenRange().get().getEnd().getKind()); + } + + @Test + void rangeOfLambdaBody() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = + cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + ReturnStmt returnStmt = + methodDeclaration.getBody().get().getStatement(0).asReturnStmt(); + CastExpr castExpr = returnStmt.getExpression().get().asCastExpr(); + LambdaExpr lambdaExpr = castExpr.getExpression().asLambdaExpr(); + Statement lambdaBody = lambdaExpr.getBody(); + assertEquals(range(3, 68, 3, 101), lambdaBody.getRange().get()); + } + + @Test + void testNotStoringTokens() { + JavaParser javaParser = new JavaParser(new ParserConfiguration().setStoreTokens(false)); + ParseResult result = javaParser.parse(ParseStart.COMPILATION_UNIT, provider("class X{}")); + assertFalse(result.getResult().get().getTokenRange().isPresent()); + } + + @Test + void trailingCodeIsAnError() { + assertThrows(ParseProblemException.class, () -> parseBlock("{} efijqoifjqefj")); + } + + @Test + void trailingWhitespaceIsIgnored() { + BlockStmt blockStmt = parseBlock("{} // hello"); + assertEquals("{}", blockStmt.getTokenRange().get().toString()); + } + + @Test + void parsingInitializedAndUnitializedVarsInForStmt() { + ForStmt forStmt = parseStatement("for(int a,b=0;;){}").asForStmt(); + assertEquals(1, forStmt.getInitialization().size()); + assertTrue(forStmt.getInitialization().get(0).isVariableDeclarationExpr()); + assertEquals( + 2, + forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .size()); + assertEquals( + "a", + forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(0) + .getNameAsString()); + assertEquals( + "b", + forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(1) + .getNameAsString()); + assertFalse(forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(0) + .getInitializer() + .isPresent()); + assertTrue(forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(1) + .getInitializer() + .isPresent()); + } + + @Test + void parsingInitializedAndUnitializedVarsInForStmtComplexCase() { + // See issue 1281 + ForStmt forStmt = + parseStatement("for(int i, j = array2.length - 1;;){}").asForStmt(); + assertEquals(1, forStmt.getInitialization().size()); + assertTrue(forStmt.getInitialization().get(0).isVariableDeclarationExpr()); + assertEquals( + 2, + forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .size()); + assertEquals( + "i", + forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(0) + .getNameAsString()); + assertEquals( + "j", + forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(1) + .getNameAsString()); + assertFalse(forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(0) + .getInitializer() + .isPresent()); + assertTrue(forStmt.getInitialization() + .get(0) + .asVariableDeclarationExpr() + .getVariables() + .get(1) + .getInitializer() + .isPresent()); + } + + @Test + void creatingNewObjectCreationExprShouldDefaultToParsing() { + String className = String.class.getCanonicalName(); + ClassOrInterfaceType type = parseClassOrInterfaceType(className); + ObjectCreationExpr expected = parseExpression("new " + className + "()"); + ObjectCreationExpr actual = new ObjectCreationExpr(null, type, NodeList.nodeList()); + assertEquals(expected, actual); + } + + @Test + void parseModuleDeclaration() { + StaticJavaParser.parseModuleDeclaration("module X {}"); + } + + @Test + void parseModuleDirective() { + StaticJavaParser.parseModuleDirective("opens C;"); + } + + @Test + void parseTypeParameter() { + StaticJavaParser.parseTypeParameter("T extends Serializable & AttachableListener"); + } + + @Test + void parseTypeDeclaration() { + StaticJavaParser.parseTypeDeclaration("enum Z {A, B}"); + } + + @Test + void xxx() { + YamlPrinter.print(StaticJavaParser.parse("class X{}")); + } + + @Test + void issue2879() { + StaticJavaParser.parse("public class Test {" + " public void method(int @MyAnno ... param) {}" + + "}" + + "@Target(java.lang.annotation.ElementType.TYPE_USE) @interface MyAnno {}"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaTokenTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaTokenTest.java new file mode 100644 index 0000000..20c0c07 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavaTokenTest.java @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.GeneratedJavaParserConstants.*; +import static com.github.javaparser.JavaToken.Category.*; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.Range.range; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.expr.Expression; +import java.lang.reflect.Field; +import java.util.Iterator; +import org.junit.jupiter.api.Test; + +class JavaTokenTest { + + @Test + void testAFewTokens() { + ParseResult result = new JavaParser().parse(ParseStart.EXPRESSION, provider("1 +/*2*/1 ")); + Iterator iterator = + result.getResult().get().getTokenRange().get().iterator(); + assertToken("1", range(1, 1, 1, 1), INTEGER_LITERAL, LITERAL, iterator.next()); + assertToken(" ", range(1, 2, 1, 2), SPACE, WHITESPACE_NO_EOL, iterator.next()); + assertToken("+", range(1, 3, 1, 3), PLUS, OPERATOR, iterator.next()); + assertToken("/*2*/", range(1, 4, 1, 8), MULTI_LINE_COMMENT, COMMENT, iterator.next()); + assertToken("1", range(1, 9, 1, 9), INTEGER_LITERAL, LITERAL, iterator.next()); + assertToken(" ", range(1, 10, 1, 10), SPACE, WHITESPACE_NO_EOL, iterator.next()); + assertToken("", range(1, 10, 1, 10), EOF, WHITESPACE_NO_EOL, iterator.next()); + assertFalse(iterator.hasNext()); + } + + private void assertToken(String image, Range range, int kind, JavaToken.Category category, JavaToken token) { + assertEquals(image, token.getText()); + assertEquals(range, token.getRange().get()); + assertEquals(kind, token.getKind()); + assertEquals(category, token.getCategory()); + token.getNextToken() + .ifPresent(nt -> assertEquals(token, nt.getPreviousToken().get())); + token.getPreviousToken() + .ifPresent(pt -> assertEquals(token, pt.getNextToken().get())); + assertTrue(token.getNextToken().isPresent() || token.getPreviousToken().isPresent()); + } + + @Test + void testAFewImagesForTokenKinds() { + assertEquals("=", new JavaToken(ASSIGN).getText()); + // TODO this shouldn't be a space. + assertEquals(" ", new JavaToken(EOF).getText()); + assertEquals("*/", new JavaToken(JAVADOC_COMMENT).getText()); + } + + @Test + void testKindEnum() { + JavaToken.Kind kind = JavaToken.Kind.valueOf(GeneratedJavaParserConstants.ASSERT); + + assertEquals(JavaToken.Kind.ASSERT, kind); + assertEquals(GeneratedJavaParserConstants.ASSERT, kind.getKind()); + } + + /** + * Two places where "generated" token types exist. + * - Firstly, {@link GeneratedJavaParserConstants} which is produced by JavaCC + * - Secondly, {@link JavaToken}, which is produced by JavaParser + *

+ * This test makes a best-effort attempt to ensure that the two are aligned. + */ + @Test + void test() throws NoSuchFieldException, IllegalAccessException { + + final int tokenCount = GeneratedJavaParserConstants.tokenImage.length; + assertEquals(tokenCount, JavaToken.Kind.values().length, "Error - mismatch between number of tokens."); + + // Iterate through the JP Tokens, and ensure that it matches the JavaCC tokens. + for (int i = 0; i < tokenCount; i++) { + + // Details about the Java Parser Token + JavaToken.Kind jpToken = JavaToken.Kind.valueOf(i); + String jpTokenName = jpToken.name(); + int jpTokenNumber = jpToken.getKind(); + + // Details about the JavaCC Token (using reflection) + Field declaredField = GeneratedJavaParserConstants.class.getDeclaredField(jpTokenName); + String javaCcTokenName = declaredField.getName(); + Object javaccTokenNumber = declaredField.get(null); // static fields, therefore null is okay + + // Optional printing -- for debugging purposes. + // System.out.println(i + " - " + + // jpTokenName + " (" + jpTokenNumber + ") - " + + // javaCcTokenName + " (" + javaccTokenNumber + ")" + // ); + + assertEquals(jpTokenName, javaCcTokenName); + assertEquals( + javaccTokenNumber, + jpTokenNumber, + "Error - Likely need to rerun JP Generators following a grammar change." + "\nProblem with `" + + jpTokenName + "`." + "\nNote mismatch between:" + + "\n - token #" + + javaccTokenNumber + " - GeneratedJavaParserConstants (generated using JavaCC)" + + "\n - token #" + + jpTokenNumber + " - JavaToken (generated using JP Generators)."); + } + } + + @Test + void testDeleteToken() { + ParseResult result = new JavaParser().parse(ParseStart.EXPRESSION, provider("1+/*2*/1\n")); + TokenRange tokenRange = result.getResult().get().getTokenRange().get(); + + JavaToken tokenToBeDeleted = tokenRange.getBegin().getNextToken().get(); + tokenToBeDeleted.deleteToken(); + JavaToken nextTokenAfterDelete = tokenRange.getBegin().getNextToken().get(); + JavaToken previous = nextTokenAfterDelete.getPreviousToken().get(); + + assertNotEquals(tokenToBeDeleted, nextTokenAfterDelete); + assertEquals("/*2*/", nextTokenAfterDelete.getText()); + assertEquals("1", previous.getText()); + } + + @Test + void testFindLastToken() { + ParseResult result = new JavaParser().parse(ParseStart.EXPRESSION, provider("1 +/*2*/3 ")); + TokenRange tokenRange = result.getResult().get().getTokenRange().get(); + Iterator iterator = tokenRange.iterator(); + assertToken( + "", range(1, 10, 1, 10), EOF, WHITESPACE_NO_EOL, iterator.next().findLastToken()); + + // getEnd token in TokenRange is not the same as the last token from findLastToken() + // assertEquals(tokenRange.getEnd(), tokenRange.getBegin().findLastToken()); + } + + @Test + void testFindFirstToken() { + ParseResult result = new JavaParser().parse(ParseStart.EXPRESSION, provider("1 +/*2*/3+4")); + Iterator iterator = + result.getResult().get().getTokenRange().get().iterator(); + iterator.next(); + iterator.next(); + iterator.next(); + assertEquals("/*2*/", iterator.next().getText()); + assertToken( + "1", + range(1, 1, 1, 1), + INTEGER_LITERAL, + LITERAL, + iterator.next().findFirstToken()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavadocParserTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavadocParserTest.java new file mode 100644 index 0000000..bbf13e2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/JavadocParserTest.java @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.JavadocBlockTag; +import com.github.javaparser.javadoc.description.JavadocDescription; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class JavadocParserTest { + + @Test + void parseSimplestContent() { + Assertions.assertEquals( + new Javadoc(JavadocDescription.parseText("A simple line of text")), + JavadocParser.parse("A simple line of text")); + } + + @Test + void parseEmptySingleLine() { + Assertions.assertEquals( + new Javadoc(JavadocDescription.parseText("")), JavadocParser.parse(LineSeparator.SYSTEM.asRawString())); + } + + @Test + void parseSingleLineWithSpacing() { + assertEquals( + new Javadoc(JavadocDescription.parseText("The line number of the first character of this Token.")), + JavadocParser.parse(" The line number of the first character of this Token. ")); + } + + @Test + void parseSingleLineWithNewLines() { + assertEquals( + new Javadoc(JavadocDescription.parseText("The string image of the token.")), + JavadocParser.parse( + LineSeparator.SYSTEM + " * The string image of the token." + LineSeparator.SYSTEM + " ")); + } + + @Test + void parseCommentWithNewLines() { + String text = LineSeparator.SYSTEM + " * The version identifier for this Serializable class." + + LineSeparator.SYSTEM + " * Increment only if the serialized form of the" + + LineSeparator.SYSTEM + " * class changes." + + LineSeparator.SYSTEM + " "; + assertEquals( + new Javadoc(JavadocDescription.parseText("The version identifier for this Serializable class." + + LineSeparator.SYSTEM + "Increment only if the serialized form of the" + + LineSeparator.SYSTEM + "class changes.")), + JavadocParser.parse(text)); + } + + @Test + void parseCommentWithIndentation() { + String text = "Returns a new Token object, by default." + LineSeparator.SYSTEM + + " * However, if you want, you can create and return subclass objects based on the value of ofKind." + + LineSeparator.SYSTEM + " *" + + LineSeparator.SYSTEM + " * case MyParserConstants.ID : return new IDToken(ofKind, image);" + + LineSeparator.SYSTEM + " *" + + LineSeparator.SYSTEM + " * to the following switch statement. Then you can cast matchedToken"; + assertEquals( + new Javadoc( + JavadocDescription.parseText("Returns a new Token object, by default." + LineSeparator.SYSTEM + + "However, if you want, you can create and return subclass objects based on the value of ofKind." + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " case MyParserConstants.ID : return new IDToken(ofKind, image);" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + "to the following switch statement. Then you can cast matchedToken")), + JavadocParser.parse(text)); + } + + @Test + void parseBlockTagsAndEmptyDescription() { + String text = LineSeparator.SYSTEM + " * @deprecated" + + LineSeparator.SYSTEM + " * @see #getEndColumn" + + LineSeparator.SYSTEM + " "; + assertEquals( + new Javadoc(JavadocDescription.parseText("")) + .addBlockTag(new JavadocBlockTag(JavadocBlockTag.Type.DEPRECATED, "")) + .addBlockTag(new JavadocBlockTag(JavadocBlockTag.Type.SEE, "#getEndColumn")), + JavadocParser.parse(text)); + } + + @Test + void parseBlockTagsAndProvideTagName() { + String expectedText = LineSeparator.SYSTEM + " * @unofficial" + LineSeparator.SYSTEM + " " + " "; + + Javadoc underTest = + new Javadoc(JavadocDescription.parseText("")).addBlockTag(new JavadocBlockTag("unofficial", "")); + + assertEquals(underTest, JavadocParser.parse(expectedText)); + assertEquals(1, underTest.getBlockTags().size()); + assertEquals("unofficial", underTest.getBlockTags().get(0).getTagName()); + } + + @Test + void parseParamBlockTags() { + String text = LineSeparator.SYSTEM + + " * Add a field to this and automatically add the import of the type if needed" + + LineSeparator.SYSTEM + " *" + + LineSeparator.SYSTEM + " * @param typeClass the type of the field" + + LineSeparator.SYSTEM + " * @param name the name of the field" + + LineSeparator.SYSTEM + " * @param modifiers the modifiers like {@link Modifier#PUBLIC}" + + LineSeparator.SYSTEM + " * @return the {@link FieldDeclaration} created" + + LineSeparator.SYSTEM + " "; + Javadoc res = JavadocParser.parse(text); + assertEquals( + new Javadoc(JavadocDescription.parseText( + "Add a field to this and automatically add the import of the type if needed")) + .addBlockTag(JavadocBlockTag.createParamBlockTag("typeClass", "the type of the field")) + .addBlockTag(JavadocBlockTag.createParamBlockTag("name", "the name of the field")) + .addBlockTag(JavadocBlockTag.createParamBlockTag( + "modifiers", "the modifiers like {@link Modifier#PUBLIC}")) + .addBlockTag(new JavadocBlockTag( + JavadocBlockTag.Type.RETURN, "the {@link FieldDeclaration} created")), + res); + } + + @Test + void parseMultilineParamBlockTags() { + String text = LineSeparator.SYSTEM + + " * Add a field to this and automatically add the import of the type if needed" + + LineSeparator.SYSTEM + " *" + + LineSeparator.SYSTEM + " * @param typeClass the type of the field" + + LineSeparator.SYSTEM + " * continued in a second line" + + LineSeparator.SYSTEM + " * @param name the name of the field" + + LineSeparator.SYSTEM + " * @param modifiers the modifiers like {@link Modifier#PUBLIC}" + + LineSeparator.SYSTEM + " * @return the {@link FieldDeclaration} created" + + LineSeparator.SYSTEM + " "; + Javadoc res = JavadocParser.parse(text); + assertEquals( + new Javadoc(JavadocDescription.parseText( + "Add a field to this and automatically add the import of the type if needed")) + .addBlockTag(JavadocBlockTag.createParamBlockTag( + "typeClass", + "the type of the field" + LineSeparator.SYSTEM + " continued in a second line")) + .addBlockTag(JavadocBlockTag.createParamBlockTag("name", "the name of the field")) + .addBlockTag(JavadocBlockTag.createParamBlockTag( + "modifiers", "the modifiers like {@link Modifier#PUBLIC}")) + .addBlockTag(new JavadocBlockTag( + JavadocBlockTag.Type.RETURN, "the {@link FieldDeclaration} created")), + res); + } + + @Test + void startsWithAsteriskEmpty() { + assertEquals(-1, JavadocParser.startsWithAsterisk("")); + } + + @Test + void startsWithAsteriskNoAsterisk() { + assertEquals(-1, JavadocParser.startsWithAsterisk(" ciao")); + } + + @Test + void startsWithAsteriskAtTheBeginning() { + assertEquals(0, JavadocParser.startsWithAsterisk("* ciao")); + } + + @Test + void startsWithAsteriskAfterSpaces() { + assertEquals(3, JavadocParser.startsWithAsterisk(" * ciao")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/LineSeparatorProcessorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/LineSeparatorProcessorTest.java new file mode 100644 index 0000000..bd10543 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/LineSeparatorProcessorTest.java @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import com.github.javaparser.utils.LineSeparator; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class LineSeparatorProcessorTest extends AbstractLexicalPreservingTest { + + // TODO: Add more tests outside the "happy path" (e.g. mixed EOL, no EOL, etc.) + + /* + * This test case must prevent an UnsupportedOperation Removed throwed by LexicalPreservation when we try to replace an expression + */ + public void doTest(LineSeparator lineSeparator) { + String eol = lineSeparator.asRawString(); + + considerCode("" + " public class Foo { //comment" + + eol + " private String a;" + + eol + " private String b;" + + eol + " private String c;" + + eol + " private String d;" + + eol + " }"); + + // Note: Expect the platform's EOL character when printing + String expected = "" + " public class Foo { //comment" + + eol + " private String newField;" + + eol + " " + + eol + " private String a;" + + eol + " private String b;" + + eol + " private String c;" + + eol + " private String d;" + + eol + " }"; + + // create a new field declaration + VariableDeclarator variable = new VariableDeclarator(new ClassOrInterfaceType("String"), "newField"); + FieldDeclaration fd = new FieldDeclaration(new NodeList(Modifier.privateModifier()), variable); + Optional cd = cu.findFirst(ClassOrInterfaceDeclaration.class); + + // add the new variable + cd.get().getMembers().addFirst(fd); + + // should be printed like this + // System.out.println("\n\nOriginal:\n" + original); + // System.out.println("\n\nExpected:\n" + expected); + + // but the result is + final String actual = LexicalPreservingPrinter.print(cu); + // System.out.println("\n\nActual:\n" + actual); + + // The LineEndingProcessingProvider sets the line ending to the root node. + // Child nodes should then "inherit" then line ending style. + LineSeparator lineSeparator_cu = cu.getLineEndingStyle(); + LineSeparator lineSeparator_fd = fd.getLineEndingStyle(); + + // System.out.println("lineSeparator_cu.describe() = " + lineSeparator_cu.describe()); + // System.out.println("lineSeparator_fd.describe() = " + lineSeparator_fd.describe()); + + // Assert that it has been detected and injected correctly. + LineSeparator detectedLineSeparator = LineSeparator.detect(actual); + assertEquals(lineSeparator, detectedLineSeparator); + assertEquals(lineSeparator, lineSeparator_cu); + assertEquals(lineSeparator, lineSeparator_fd); + + // The line ending data is injected at the root node, thus should only exist there. + assertTrue( + cu.containsData(Node.LINE_SEPARATOR_KEY), + "Expected the processor provider to have set the data on the root node."); + assertFalse( + fd.containsData(Node.LINE_SEPARATOR_KEY), + "Expected the line ending value to have been inherited, not set directly"); + } + + @Test + public void testWithCr() { + doTest(LineSeparator.CR); + } + + @Test + public void testWithCrLf() { + doTest(LineSeparator.CRLF); + } + + @Test + public void testWithLf() { + doTest(LineSeparator.LF); + } + + // TODO: Test for textblocks + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ParseErrorRecoveryTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ParseErrorRecoveryTest.java new file mode 100644 index 0000000..9bb4146 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ParseErrorRecoveryTest.java @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.ast.Node.Parsedness.UNPARSABLE; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.LabeledStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.UnparsableStmt; +import org.junit.jupiter.api.Test; + +class ParseErrorRecoveryTest { + private final JavaParser parser = new JavaParser(); + + @Test + void compilationUnitRecovery() { + CompilationUnit cu = parser.parse(ParseStart.COMPILATION_UNIT, provider("XXX")) + .getResult() + .get(); + assertEquals(UNPARSABLE, cu.getParsed()); + } + + @Test + void bodystatementSemicolonRecovery() { + MethodDeclaration cu = parser.parse(ParseStart.CLASS_BODY, provider("int x(){X X X;}")) + .getResult() + .get() + .asMethodDeclaration(); + Statement xxx = cu.getBody().get().getStatements().get(0); + assertEquals(UNPARSABLE, xxx.getParsed()); + } + + @Test + void bodystatementClosingBraceRecovery() { + MethodDeclaration cu = parser.parse(ParseStart.CLASS_BODY, provider("int x(){X X X}")) + .getResult() + .get() + .asMethodDeclaration(); + Statement xxx = cu.getBody().get(); + assertEquals(1, xxx.getChildNodes().size()); + assertTrue(xxx.getChildNodes().get(0) instanceof UnparsableStmt); + } + + @Test + void labeledStatementSemicolonRecovery() { + CompilationUnit cu = parser.parse(ParseStart.COMPILATION_UNIT, provider("class X{int x(){aaa:X X X;}}")) + .getResult() + .get(); + LabeledStmt xxx = cu.getClassByName("X") + .get() + .getMethods() + .get(0) + .getBody() + .get() + .getStatements() + .get(0) + .asLabeledStmt(); + assertEquals(UNPARSABLE, xxx.getStatement().getParsed()); + } + + @Test + void testIncompleteClassParse() { + CompilationUnit compilationUnit = parser.parse(getClass().getResourceAsStream("Sample.java")) + .getResult() + .get(); + assertFalse(compilationUnit.getTypes().isEmpty()); + assertFalse(compilationUnit.getTypes().get(0).getMembers().isEmpty()); + } + + @Test + void testBodyRecoverIf() { + CompilationUnit compilationUnit = parser.parse( + ParseStart.COMPILATION_UNIT, provider("class A { int a() { if() }}")) + .getResult() + .get(); + assertFalse(compilationUnit.getTypes().isEmpty()); + assertEquals(1, compilationUnit.getTypes().get(0).getMembers().size()); + } + + @Test + void testBodyRecoverLevel() { + CompilationUnit compilationUnit = parser.parse( + ParseStart.COMPILATION_UNIT, provider("class A { int a() { int b = if (true) {int c = 5;} }}")) + .getResult() + .get(); + assertFalse(compilationUnit.getTypes().isEmpty()); + assertEquals(1, compilationUnit.getTypes().get(0).getMembers().size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ParserConfigurationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ParserConfigurationTest.java new file mode 100644 index 0000000..08e04ca --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ParserConfigurationTest.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.RAW; +import static com.github.javaparser.Providers.provider; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class ParserConfigurationTest { + @Test + void storeNoTokens() { + ParseResult result = new JavaParser(new ParserConfiguration().setStoreTokens(false)) + .parse(ParseStart.COMPILATION_UNIT, provider("class X{}")); + + assertFalse(result.getResult().get().getTokenRange().isPresent()); + assertTrue(result.getResult().get().findAll(Node.class).stream() + .noneMatch(node -> node.getTokenRange().isPresent())); + } + + @Test + void noProblemsHere() { + ParseResult result = + new JavaParser(new ParserConfiguration().setLanguageLevel(RAW)).parse(STATEMENT, provider("try{}")); + assertTrue(result.isSuccessful()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/PositionMappingTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/PositionMappingTest.java new file mode 100644 index 0000000..43ea33b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/PositionMappingTest.java @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser; + +import static com.github.javaparser.UnicodeEscapeProcessingProviderTest.process; +import static com.github.javaparser.UnicodeEscapeProcessingProviderTest.provider; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.UnicodeEscapeProcessingProvider.PositionMapping; +import java.io.IOException; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.junit.jupiter.api.Test; + +/** + * Test case for {@link PositionMapping}. + * + * @author Bernhard Haumacher + */ +@SuppressWarnings("javadoc") +public class PositionMappingTest { + + @Test + public void testNoMapping() throws IOException { + List> input = + lines(line("Hello World !\n"), line("Next Line\r"), line("Third Line\r\n"), line("Fourth Line.")); + String inputText = text(input); + UnicodeEscapeProcessingProvider provider = provider(inputText); + String outputText = process(provider); + assertEquals(inputText, outputText); + PositionMapping mapping = provider.getPositionMapping(); + assertTrue(mapping.isEmpty()); + assertEquals(4, provider.getInputCounter().getLine()); + assertEquals(4, provider.getOutputCounter().getLine()); + assertSame(PositionMapping.PositionUpdate.NONE, mapping.lookup(new Position(10000, 1))); + } + + @Test + public void testEncodedLineFeed() throws IOException { + List> input = lines(line("B", "\\u000A", "C")); + List> output = lines(line("B", "\n"), line("C")); + + checkConvert(input, output); + } + + @Test + public void testComplexMapping() throws IOException { + List> input = lines( + // Character positions: + // 111 1 11111 1222 2 2222 2 + // 1 2 34567 89012 3 45678 9012 3 45678 9 + line( + "H", + "\\u00E4", + "llo W", + "\\u00F6", + "rld!", + "\\u000A", + "123 N", + "\\u00E4", + "xt Line", + "\\u000D", + "Third Line", + "\r\n"), + line("Fo", "\\u00FC", "rth Line.")); + List> output = lines( + line("H", "ä", "llo W", "ö", "rld!", "\n"), + line("123 N", "ä", "xt Line", "\r"), + line("Third Line", "\r\n"), + line("Fo", "ü", "rth Line.")); + + checkConvert(input, output); + } + + private void checkConvert(List> input, List> output) throws IOException { + UnicodeEscapeProcessingProvider provider = provider(text(input)); + String decoded = process(provider); + assertEquals(text(output), decoded); + + PositionMapping mapping = provider.getPositionMapping(); + + // Coarse grained test. + assertEquals(input.size(), provider.getInputCounter().getLine()); + assertEquals(output.size(), provider.getOutputCounter().getLine()); + + // Fine grained test. + int inPosLine = 1; + int inPosColumn = 1; + int outPosLine = 1; + int outPosColumn = 1; + Iterator> outLineIt = output.iterator(); + List outLine = outLineIt.next(); + Iterator outPartIt = outLine.iterator(); + String outPart = outPartIt.next(); + boolean outFinished = false; + for (List inLine : input) { + for (String inPart : inLine) { + assertFalse(outFinished); + + Position inPos = new Position(inPosLine, inPosColumn); + Position outPos = new Position(outPosLine, outPosColumn); + Position transfomedOutPos = mapping.transform(outPos); + + assertEquals( + inPos, + transfomedOutPos, + "Position mismatch at '" + outPart + "' " + outPos + " -> '" + inPart + "' " + inPos + "."); + + outPosColumn += outPart.length(); + inPosColumn += inPart.length(); + + if (!outPartIt.hasNext()) { + if (outLineIt.hasNext()) { + outPartIt = outLineIt.next().iterator(); + outPosLine++; + outPosColumn = 1; + + outPart = outPartIt.next(); + } else { + outFinished = true; + } + } else { + outPart = outPartIt.next(); + } + } + + inPosColumn = 1; + inPosLine++; + } + } + + private static String text(List> input) { + StringBuilder result = new StringBuilder(); + for (List line : input) { + for (String part : line) { + result.append(part); + } + } + return result.toString(); + } + + @SafeVarargs + private static List line(String... parts) { + return Arrays.asList(parts); + } + + @SafeVarargs + private static List> lines(List... lines) { + return Arrays.asList(lines); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/PositionTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/PositionTest.java new file mode 100644 index 0000000..587ea64 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/PositionTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class PositionTest { + + @Test + public void testOrIfInvalid() { + Position p1 = new Position(1, 1); + Position p2 = new Position(2, 2); + + assertEquals(p1, p1.orIfInvalid(p2)); + + Position invalid = new Position(0, 0); + Position invalid2 = new Position(0, 1); + + assertEquals(p1, invalid.orIfInvalid(p1)); + assertEquals(invalid2, invalid2.orIfInvalid(invalid)); + } + + @Test + public void testPositionExceptionFormat() { + IllegalArgumentException thrown1 = + Assertions.assertThrows(IllegalArgumentException.class, () -> new Position(-10, 1)); + + assertEquals("Can't position at line -10", thrown1.getMessage()); + + IllegalArgumentException thrown2 = + Assertions.assertThrows(IllegalArgumentException.class, () -> new Position(1, -10)); + + assertEquals("Can't position at column -10", thrown2.getMessage()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ProblemTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ProblemTest.java new file mode 100644 index 0000000..050c2a7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ProblemTest.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.utils.TestUtils.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class ProblemTest { + @Test + void testSimpleGetters() { + Problem problem = new Problem("Parse error", TokenRange.INVALID, new Exception()); + + assertEquals(TokenRange.INVALID, problem.getLocation().get()); + assertEquals("Parse error", problem.getMessage()); + assertInstanceOf(Exception.class, problem.getCause().get()); + } + + @Test + void testVerboseMessage() { + Problem problem = new Problem("Parse error", TokenRange.INVALID, null); + + assertEquals("(line ?,col ?) Parse error", problem.getVerboseMessage()); + } + + @Test + void testVerboseMessageWithoutLocation() { + Problem problem = new Problem("Parse error", null, null); + + assertEquals("Parse error", problem.getVerboseMessage()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ProvidersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ProvidersTest.java new file mode 100644 index 0000000..4e356f7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ProvidersTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import java.io.IOException; +import java.nio.charset.Charset; +import org.junit.jupiter.api.Test; + +class ProvidersTest { + + @Test + void testResourceProvider() throws IOException { + Provider provider = Providers.resourceProvider("com/github/javaparser/issue_samples/Issue290.java.txt"); + assertNotNull(provider); + JavaParser parser = new JavaParser(); + ParseResult parse = parser.parse(ParseStart.COMPILATION_UNIT, provider); + assertTrue(parse.isSuccessful()); + } + + @Test + void testResourceProviderWithWrongEncoding() throws IOException { + Provider provider = Providers.resourceProvider("com/github/javaparser/TestFileIso88591.java"); + assertNotNull(provider); + JavaParser parser = new JavaParser(); + ParseResult parse = parser.parse(ParseStart.COMPILATION_UNIT, provider); + assertFalse(parse.isSuccessful()); + } + + @Test + void testResourceProviderWithEncoding() throws IOException { + Provider provider = Providers.resourceProvider( + "com/github/javaparser/TestFileIso88591.java", Charset.forName("ISO-8859-1")); + assertNotNull(provider); + JavaParser parser = new JavaParser(); + ParseResult parse = parser.parse(ParseStart.COMPILATION_UNIT, provider); + assertTrue(parse.isSuccessful()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/RangeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/RangeTest.java new file mode 100644 index 0000000..33bbbba --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/RangeTest.java @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class RangeTest { + + private final Position pos1 = new Position(10, 11); + private final Position pos2 = new Position(20, 21); + private final Range range_orderedPositions = Range.range(pos1, pos2); + private final Range range_reversedPositions = Range.range(pos2, pos1); + + private final Position posA1 = new Position(1, 1); + private final Position posB1 = new Position(2, 1); + private final Position posC1 = new Position(3, 1); + private final Position posD1 = new Position(4, 1); + private final Position posE1 = new Position(5, 1); + + private final Position posA5 = new Position(1, 5); + private final Position posB5 = new Position(2, 5); + private final Position posC5 = new Position(3, 5); + private final Position posD5 = new Position(4, 5); + private final Position posE5 = new Position(5, 5); + + private final Range arbitraryRange = Range.range(1, 1, 3, 10); + + // Potential expansion option for a larger variety of these categories of values to be provided to parameterised + // tests. + // @formatter:off + private Range[] rangePair_overlappingButNotContained = + new Range[] {Range.range(posA1, posC1), Range.range(posB1, posE1)}; + private Range[] rangePair_unrelated = new Range[] {Range.range(posA1, posB1), Range.range(posD1, posE1)}; + private Range[] rangePair_equalBeginEnd = new Range[] {Range.range(posA1, posB1), Range.range(posA1, posB1)}; + private Range[] rangePair_strictlyContained = new Range[] {Range.range(posA1, posE1), Range.range(posB1, posD1)}; + private Range[] rangePair_touchingLineAndColumn = + new Range[] {Range.range(posA1, posC1), Range.range(posC1, posE1)}; + private Range[] rangePair_touchingLineNotColumn = + new Range[] {Range.range(posA1, posC1), Range.range(posC5, posD1)}; + // @formatter:on + + @Test + void constructorWithOrderedPositions() { + assertEquals(10, range_orderedPositions.begin.line); + assertEquals(11, range_orderedPositions.begin.column); + assertEquals(20, range_orderedPositions.end.line); + assertEquals(21, range_orderedPositions.end.column); + } + + @Test + void constructorWithReversedPositions() { + assertEquals(10, range_reversedPositions.begin.line); + assertEquals(11, range_reversedPositions.begin.column); + assertEquals(20, range_reversedPositions.end.line); + assertEquals(21, range_reversedPositions.end.column); + } + + @Test + void rangePair_equalBeginEnd_contains_true() { + assertTrue(rangePair_equalBeginEnd[0].contains(rangePair_equalBeginEnd[1])); + } + + @Test + void rangePair_equalBeginEnd_strictlyContains_false() { + assertFalse(rangePair_equalBeginEnd[0].strictlyContains(rangePair_equalBeginEnd[1])); + } + + @Test + void rangePair_overlappingButNotContained_contains_false() { + Range r1 = rangePair_overlappingButNotContained[0]; + Range r2 = rangePair_overlappingButNotContained[1]; + assertFalse(r1.contains(r2)); + assertFalse(r2.contains(r1)); + } + + @Test + void rangePair_overlappingButNotContained_strictlyContains_false() { + Range r1 = rangePair_overlappingButNotContained[0]; + Range r2 = rangePair_overlappingButNotContained[1]; + assertFalse(r1.strictlyContains(r2)); + assertFalse(r2.strictlyContains(r1)); + } + + @Test + void rangePair_unrelated_contains_false() { + Range r1 = rangePair_unrelated[0]; + Range r2 = rangePair_unrelated[1]; + assertFalse(r1.contains(r2)); + assertFalse(r2.contains(r1)); + } + + @Test + void rangePair_unrelated_strictlyContains_false() { + Range r1 = rangePair_unrelated[0]; + Range r2 = rangePair_unrelated[1]; + assertFalse(r1.strictlyContains(r2)); + assertFalse(r2.strictlyContains(r1)); + } + + @Test + void rangePair_strictlyContained_contains() { + Range r1 = rangePair_strictlyContained[0]; + Range r2 = rangePair_strictlyContained[1]; + assertTrue(r1.contains(r2)); + assertFalse(r2.contains(r1)); + } + + @Test + void rangePair_strictlyContained_strictlyContains() { + Range r1 = rangePair_strictlyContained[0]; + Range r2 = rangePair_strictlyContained[1]; + assertTrue(r1.strictlyContains(r2)); + assertFalse(r2.strictlyContains(r1)); + } + + @Test + void rangePair_touchingLineAndColumn_contains() { + Range r1 = rangePair_touchingLineAndColumn[0]; + Range r2 = rangePair_touchingLineAndColumn[1]; + assertFalse(r1.contains(r2)); + assertFalse(r2.contains(r1)); + } + + @Test + void rangePair_touchingLineAndColumn_strictlyContains() { + Range r1 = rangePair_touchingLineAndColumn[0]; + Range r2 = rangePair_touchingLineAndColumn[1]; + assertFalse(r1.strictlyContains(r2)); + assertFalse(r2.strictlyContains(r1)); + } + + @Test + void containsConsiderLines() { + Range r1 = Range.range(22, 9, 22, 29); + Range r2 = Range.range(26, 19, 26, 28); + assertFalse(r1.contains(r2)); + assertFalse(r2.contains(r1)); + } + + @Test + void rangePair_touchingLineAndColumn_overlapsAccountsForColumn_true() { + Range r1 = rangePair_touchingLineAndColumn[0]; + Range r2 = rangePair_touchingLineAndColumn[1]; + assertTrue(r1.overlapsWith(r2)); + assertTrue(r2.overlapsWith(r1)); + } + + @Test + void rangePair_touchingLineNotColumn_overlapsAccountsForColumn_false() { + Range r1 = rangePair_touchingLineNotColumn[0]; + Range r2 = rangePair_touchingLineNotColumn[1]; + assertFalse(r1.overlapsWith(r2)); + assertFalse(r2.overlapsWith(r1)); + } + + @Test + void lineCountIsReturned() { + Range r1 = Range.range(1, 1, 5, 2); + assertEquals(5, r1.getLineCount()); + + Range r2 = Range.range(26, 5, 57, 6); + assertEquals(32, r2.getLineCount()); + } + + @Test + void arbitraryRange_containsItsBegin_true() { + Range r = arbitraryRange; + assertTrue(r.contains(r.begin)); + } + + @Test + void arbitraryRange_containsItsEnd_true() { + Range r = arbitraryRange; + assertTrue(r.contains(r.end)); + } + + @Test + void arbitraryRange_strictlyContainItsBegin_false() { + Range r = arbitraryRange; + assertFalse(r.strictlyContains(r.begin)); + } + + @Test + void arbitraryRange_strictlyContainItsEnd_false() { + Range r = arbitraryRange; + assertFalse(r.strictlyContains(r.end)); + } + + @Test + void touchingLineColumnRangesOverlap() { + Range r1 = Range.range(1, 1, 3, 10); + Range r2 = Range.range(3, 10, 5, 10); + assertTrue(r1.overlapsWith(r2)); + assertTrue(r2.overlapsWith(r1)); + } + + @Test + void touchingLineNotColumnRangesDoNotOverlap() { + Range r1 = Range.range(1, 1, 3, 5); + Range r2 = Range.range(3, 10, 5, 10); + assertFalse(r1.overlapsWith(r2)); + assertFalse(r2.overlapsWith(r1)); + } + + @Test + void rangePair_equalBeginEnd_overlap_true() { + Range r1 = rangePair_equalBeginEnd[0]; + Range r2 = rangePair_equalBeginEnd[1]; + assertTrue(r1.overlapsWith(r2)); + assertTrue(r2.overlapsWith(r1)); + } + + @Test + void rangePair_unrelated_overlap_false() { + Range r1 = rangePair_unrelated[0]; + Range r2 = rangePair_unrelated[1]; + assertFalse(r1.overlapsWith(r2)); + assertFalse(r2.overlapsWith(r1)); + } + + @Test + void rangePair_touchingLineAndColumn_overlap_false() { + Range r1 = rangePair_touchingLineAndColumn[0]; + Range r2 = rangePair_touchingLineAndColumn[1]; + assertTrue(r1.overlapsWith(r2)); + assertTrue(r2.overlapsWith(r1)); + } + + @Test + void rangePair_overlappingButNotContained_overlap_true() { + Range r1 = rangePair_overlappingButNotContained[0]; + Range r2 = rangePair_overlappingButNotContained[1]; + assertTrue(r1.overlapsWith(r2)); + assertTrue(r2.overlapsWith(r1)); + } + + @Test + void rangePair_strictlyContained_overlap_true() { + Range r1 = rangePair_strictlyContained[0]; + Range r2 = rangePair_strictlyContained[1]; + assertTrue(r1.overlapsWith(r2)); + assertTrue(r2.overlapsWith(r1)); + } + + @Test + void rangePair_is_before() { + Range r1 = Range.range(new Position(1, 1), new Position(1, 2)); + Range r2 = Range.range(new Position(1, 3), new Position(1, 4)); + assertTrue(r1.isBefore(r2)); + } + + @Test + void rangePair_is_not_before() { + Range r1 = Range.range(new Position(1, 1), new Position(1, 2)); + Range r2 = Range.range(new Position(1, 3), new Position(1, 4)); + Range r3 = Range.range(new Position(1, 1), new Position(1, 4)); + assertFalse(r2.isBefore(r1)); + assertFalse(r3.isBefore(r1)); + } + + @Test + void rangePair_is_after() { + Range r1 = Range.range(new Position(1, 1), new Position(1, 2)); + Range r2 = Range.range(new Position(1, 3), new Position(1, 4)); + assertTrue(r2.isAfter(r1)); + } + + @Test + void rangePair_is_not_after() { + Range r1 = Range.range(new Position(1, 1), new Position(1, 2)); + Range r2 = Range.range(new Position(1, 3), new Position(1, 4)); + Range r3 = Range.range(new Position(1, 1), new Position(1, 4)); + assertFalse(r1.isAfter(r2)); + assertFalse(r1.isAfter(r3)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/TokenRangeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/TokenRangeTest.java new file mode 100644 index 0000000..c22c992 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/TokenRangeTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class TokenRangeTest { + @Test + void toStringWorks() { + CompilationUnit cu = parse("class X {\n\tX(){\n// hello\n}\n}"); + assertEquals( + "X(){\n// hello\n}", + cu.getClassByName("X") + .get() + .getDefaultConstructor() + .get() + .getTokenRange() + .get() + .toString()); + } + + @Test + void renumberRangesWorks() { + CompilationUnit cu = parse("class X {\n\tX(){\n// hello\n}\n}"); + + assertEquals( + "1,1-5/6,1-1/7,1-1/8,1-1/9,1-1/10,1-1/1,2-1/2,2-1/3,2-1/4,2-1/5,2-1/6,2-1/1,3-8/9,3-1/1,4-1/2,4-1/1,5-1/1,5-1/", + makeRangesString(cu)); + + TokenRange tokenRange = cu.getTokenRange().get(); + tokenRange.getBegin().insertAfter(new JavaToken(1, "feif")); + tokenRange + .getBegin() + .getNextToken() + .get() + .getNextToken() + .get() + .insert(new JavaToken(JavaToken.Kind.WINDOWS_EOL.getKind(), "\r\n")); + cu.recalculatePositions(); + + assertEquals( + "1,1-5/6,1-4/10,1-2/1,2-1/2,2-1/3,2-1/4,2-1/5,2-1/1,3-1/2,3-1/3,3-1/4,3-1/5,3-1/6,3-1/1,4-8/9,4-1/1,5-1/2,5-1/1,6-1/2,6-1/", + makeRangesString(cu)); + } + + /** + * Make a compact String for comparing token range positions. + */ + private String makeRangesString(Node node) { + Optional token = node.getTokenRange().map(TokenRange::getBegin); + StringBuilder result = new StringBuilder(); + while (token.isPresent()) { + token = token.flatMap(t -> { + result.append(t.getRange() + .map(r -> r.begin.column + "," + r.begin.line + "-" + (r.end.column - r.begin.column + 1) + "/") + .orElse("?")); + return t.getNextToken(); + }); + } + return result.toString(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/TokenTypesTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/TokenTypesTest.java new file mode 100644 index 0000000..583e085 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/TokenTypesTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.utils.CodeGenerationUtils.mavenModuleRoot; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.stmt.SwitchEntry; +import java.io.IOException; +import java.nio.file.Path; +import org.junit.jupiter.api.Test; + +public class TokenTypesTest { + + @Test + void everyTokenHasACategory() throws IOException { + final int tokenCount = GeneratedJavaParserConstants.tokenImage.length; + Path tokenTypesPath = mavenModuleRoot(JavaParserTest.class) + .resolve("../javaparser-core/src/main/java/com/github/javaparser/TokenTypes.java"); + CompilationUnit tokenTypesCu = parse(tokenTypesPath); + + // -1 to take off the default: case. + int switchEntries = tokenTypesCu.findAll(SwitchEntry.class).size() - 1; + + // The amount of "case XXX:" in TokenTypes.java should be equal to the amount of tokens JavaCC knows about: + assertEquals(tokenCount, switchEntries); + } + + @Test + void throwOnUnrecognisedTokenType() { + assertThrows(AssertionError.class, () -> { + TokenTypes.getCategory(-1); + }); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/UnicodeEscapeProcessingProviderTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/UnicodeEscapeProcessingProviderTest.java new file mode 100644 index 0000000..cf83aea --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/UnicodeEscapeProcessingProviderTest.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.IOException; +import org.junit.jupiter.api.Test; + +/** + * Test case for {@link UnicodeEscapeProcessingProvider}. + */ +public class UnicodeEscapeProcessingProviderTest { + + @Test + void testUnicodeEscape() throws IOException { + assertEquals("13" + '\u12aA' + "98", new String(read("13\\u12aA98"))); + } + + @Test + void testEscapedUnicodeEscape() throws IOException { + assertEquals("13\\\\u12aA98", new String(read("13\\\\u12aA98"))); + } + + @Test + void testUnicodeEscapeWithMultipleUs() throws IOException { + assertEquals("13" + '\u12aA' + "98", new String(read("13\\uuuuuu12aA98"))); + } + + @Test + void testInputEndingInBackslash() throws IOException { + assertEquals("foobar\\", new String(read("foobar\\"))); + } + + @Test + void testInputEndingInBackslashU() throws IOException { + assertEquals("foobar\\u", new String(read("foobar\\u"))); + } + + @Test + void testInputEndingInBackslashUs() throws IOException { + assertEquals("foobar\\uuuuuu", new String(read("foobar\\uuuuuu"))); + } + + @Test + void testInputEndingInBackslashU1() throws IOException { + assertEquals("foobar\\uA", new String(read("foobar\\uA"))); + } + + @Test + void testInputEndingInBackslashU2() throws IOException { + assertEquals("foobar\\uAB", new String(read("foobar\\uAB"))); + } + + @Test + void testInputEndingInBackslashU3() throws IOException { + assertEquals("foobar\\uABC", new String(read("foobar\\uABC"))); + } + + @Test + void testInputEndingUnicodeEscape() throws IOException { + assertEquals("foobar\uABCD", new String(read("foobar\\uABCD"))); + } + + @Test + void testEmptyInput() throws IOException { + assertEquals("", new String(read(""))); + } + + @Test + void testBadUnicodeEscape0() throws IOException { + assertEquals("13\\ux", new String(read("13\\ux"))); + } + + @Test + void testBadUnicodeEscape1() throws IOException { + assertEquals("13\\u1x", new String(read("13\\u1x"))); + } + + @Test + void testBadUnicodeEscape2() throws IOException { + assertEquals("13\\u1Ax", new String(read("13\\u1Ax"))); + } + + @Test + void testBadUnicodeEscape3() throws IOException { + assertEquals("13\\u1ABx", new String(read("13\\u1ABx"))); + } + + @Test + void testBadUnicodeEscapeMultipleUs() throws IOException { + assertEquals("13\\uuuuuu1ABx", new String(read("13\\uuuuuu1ABx"))); + } + + @Test + void testPushBackWithFullBuffer() throws IOException { + assertEquals("12345678\\uuxxxxxxxxxxxxxxxxxxxxxxx", new String(read("12345678\\uuxxxxxxxxxxxxxxxxxxxxxxx"))); + } + + @Test + void testPushBackWithBufferShift() throws IOException { + assertEquals("12345678\\uuxx", new String(read("12345678\\uuxx"))); + } + + static String read(String source) throws IOException { + return process(provider(source)); + } + + static UnicodeEscapeProcessingProvider provider(String source) { + UnicodeEscapeProcessingProvider provider = new UnicodeEscapeProcessingProvider(10, new StringProvider(source)); + return provider; + } + + static String process(UnicodeEscapeProcessingProvider provider) throws IOException { + StringBuilder result = new StringBuilder(); + char[] buffer = new char[10]; + while (true) { + int direct = provider.read(buffer, 0, buffer.length); + if (direct < 0) { + break; + } + result.append(buffer, 0, direct); + } + + provider.close(); + + return result.toString(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/AncestorDescendantTests.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/AncestorDescendantTests.java new file mode 100644 index 0000000..dcf8d21 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/AncestorDescendantTests.java @@ -0,0 +1,158 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.*; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import java.io.IOException; +import org.junit.jupiter.api.Test; + +public class AncestorDescendantTests { + + @Test + void nodeIsNotAncestorOfItself() throws IOException { + JavaParser parser = new JavaParser(); + + Provider provider = Providers.resourceProvider("com/github/javaparser/range/A.java"); + assertNotNull(provider); + ParseResult parse = parser.parse(ParseStart.COMPILATION_UNIT, provider); + assertTrue(parse.isSuccessful()); + + VariableDeclarationExpr node = parse.getResult() + .get() + .getType(0) // class A + .getMember(0) + .asMethodDeclaration() // method foo() + .getBody() + .get() + .getStatement(0) + .asExpressionStmt() // int a = 42; + .getExpression() + .asVariableDeclarationExpr(); // a = 42 + + assertFalse(node.isAncestorOf(node)); + } + + @Test + void nodeIsNotDescendantOfItself() throws IOException { + JavaParser parser = new JavaParser(); + + Provider provider = Providers.resourceProvider("com/github/javaparser/range/A.java"); + assertNotNull(provider); + ParseResult parse = parser.parse(ParseStart.COMPILATION_UNIT, provider); + assertTrue(parse.isSuccessful()); + + VariableDeclarationExpr node = parse.getResult() + .get() + .getType(0) // class A + .getMember(0) + .asMethodDeclaration() // method foo() + .getBody() + .get() + .getStatement(0) + .asExpressionStmt() // int a = 42; + .getExpression() + .asVariableDeclarationExpr(); // a = 42 + + assertFalse(node.isDescendantOf(node)); + } + + @Test + void nodeInSameFileIsDescendantOfAncestor() throws IOException { + JavaParser parser = new JavaParser(); + + Provider provider = Providers.resourceProvider("com/github/javaparser/range/A.java"); + assertNotNull(provider); + ParseResult parse = parser.parse(ParseStart.COMPILATION_UNIT, provider); + assertTrue(parse.isSuccessful()); + + VariableDeclarationExpr superNode = parse.getResult() + .get() + .getType(0) // class A + .getMember(0) + .asMethodDeclaration() // method foo() + .getBody() + .get() + .getStatement(0) + .asExpressionStmt() // int a = 42; + .getExpression() + .asVariableDeclarationExpr(); // a = 42 + + Expression subNode = superNode.getVariable(0).getInitializer().get(); // 42 + + assertTrue(superNode.isAncestorOf(subNode)); + assertFalse(subNode.isAncestorOf(superNode)); + assertTrue(subNode.isDescendantOf(superNode)); + assertFalse(superNode.isDescendantOf(subNode)); + } + + @Test + void nodesInTwoDifferentFilesAreNotDescendantOrAncestorOfEachOther() throws IOException { + JavaParser parser = new JavaParser(); + + Provider providerA = Providers.resourceProvider("com/github/javaparser/range/A.java"); + assertNotNull(providerA); + ParseResult parseA = parser.parse(ParseStart.COMPILATION_UNIT, providerA); + assertTrue(parseA.isSuccessful()); + + Provider providerB = Providers.resourceProvider("com/github/javaparser/range/B.java"); + assertNotNull(providerB); + ParseResult parseB = parser.parse(ParseStart.COMPILATION_UNIT, providerB); + assertTrue(parseB.isSuccessful()); + + VariableDeclarationExpr superNodeA = parseA.getResult() + .get() + .getType(0) // class A + .getMember(0) + .asMethodDeclaration() // method foo() + .getBody() + .get() + .getStatement(0) + .asExpressionStmt() // int a = 42; + .getExpression() + .asVariableDeclarationExpr(); // a = 42 + + Expression subNodeA = superNodeA.getVariable(0).getInitializer().get(); // 42 + + VariableDeclarationExpr superNodeB = parseB.getResult() + .get() + .getType(0) // class B + .getMember(0) + .asMethodDeclaration() // method foo() + .getBody() + .get() + .getStatement(0) + .asExpressionStmt() // int b = 42; + .getExpression() + .asVariableDeclarationExpr(); // b = 42 + + Expression subNodeB = superNodeB.getVariable(0).getInitializer().get(); // 42 + + assertFalse(superNodeA.isAncestorOf(superNodeB)); + assertFalse(superNodeA.isDescendantOf(subNodeB)); + assertFalse(superNodeB.isAncestorOf(superNodeA)); + assertFalse(superNodeB.isDescendantOf(subNodeA)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/CompilationUnitTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/CompilationUnitTest.java new file mode 100644 index 0000000..46588b2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/CompilationUnitTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.utils.CodeGenerationUtils.mavenModuleRoot; +import static org.junit.jupiter.api.Assertions.*; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.junit.jupiter.api.Test; + +class CompilationUnitTest { + @Test + void issue578TheFirstCommentIsWithinTheCompilationUnit() { + CompilationUnit compilationUnit = + parse("// This is my class, with my comment\n" + "class A {\n" + " static int a;\n" + "}"); + + assertEquals(1, compilationUnit.getAllContainedComments().size()); + } + + @Test + void testGetSourceRoot() throws IOException { + Path sourceRoot = mavenModuleRoot(CompilationUnitTest.class) + .resolve(Paths.get("src", "test", "resources")) + .normalize(); + Path testFile = sourceRoot.resolve(Paths.get("com", "github", "javaparser", "storage", "Z.java")); + + CompilationUnit cu = parse(testFile); + Path sourceRoot1 = cu.getStorage().get().getSourceRoot(); + assertEquals(sourceRoot, sourceRoot1); + } + + @Test + void testGetSourceRootWithBadPackageDeclaration() { + assertThrows(RuntimeException.class, () -> { + Path sourceRoot = mavenModuleRoot(CompilationUnitTest.class) + .resolve(Paths.get("src", "test", "resources")) + .normalize(); + Path testFile = sourceRoot.resolve(Paths.get("com", "github", "javaparser", "storage", "A.java")); + CompilationUnit cu = parse(testFile); + cu.getStorage().get().getSourceRoot(); + }); + } + + @Test + void testGetSourceRootInDefaultPackage() throws IOException { + Path sourceRoot = mavenModuleRoot(CompilationUnitTest.class) + .resolve(Paths.get("src", "test", "resources", "com", "github", "javaparser", "storage")) + .normalize(); + Path testFile = sourceRoot.resolve(Paths.get("B.java")); + + CompilationUnit cu = parse(testFile); + Path sourceRoot1 = cu.getStorage().get().getSourceRoot(); + assertEquals(sourceRoot, sourceRoot1); + } + + @Test + void testGetPrimaryTypeName() throws IOException { + Path sourceRoot = mavenModuleRoot(CompilationUnitTest.class) + .resolve(Paths.get("src", "test", "resources")) + .normalize(); + Path testFile = sourceRoot.resolve(Paths.get("com", "github", "javaparser", "storage", "PrimaryType.java")); + CompilationUnit cu = parse(testFile); + + assertEquals("PrimaryType", cu.getPrimaryTypeName().get()); + } + + @Test + void testNoPrimaryTypeName() { + CompilationUnit cu = parse("class PrimaryType{}"); + + assertFalse(cu.getPrimaryTypeName().isPresent()); + } + + @Test + void testGetPrimaryType() throws IOException { + Path sourceRoot = mavenModuleRoot(CompilationUnitTest.class) + .resolve(Paths.get("src", "test", "resources")) + .normalize(); + Path testFile = sourceRoot.resolve(Paths.get("com", "github", "javaparser", "storage", "PrimaryType.java")); + CompilationUnit cu = parse(testFile); + + assertEquals("PrimaryType", cu.getPrimaryType().get().getNameAsString()); + } + + @Test + void testNoPrimaryType() throws IOException { + Path sourceRoot = mavenModuleRoot(CompilationUnitTest.class) + .resolve(Paths.get("src", "test", "resources")) + .normalize(); + Path testFile = sourceRoot.resolve(Paths.get("com", "github", "javaparser", "storage", "PrimaryType2.java")); + CompilationUnit cu = parse(testFile); + + assertFalse(cu.getPrimaryType().isPresent()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/DataKeyTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/DataKeyTest.java new file mode 100644 index 0000000..6e83045 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/DataKeyTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.ast.expr.SimpleName; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +class DataKeyTest { + private static final DataKey ABC = new DataKey() {}; + private static final DataKey DEF = new DataKey() {}; + private static final DataKey> LISTY = new DataKey>() {}; + private static final DataKey> DING = new DataKey>() {}; + + @Test + void addAFewKeysAndSeeIfTheyAreStoredCorrectly() { + Node node = new SimpleName(); + + node.setData(ABC, "Hurray!"); + node.setData(LISTY, Arrays.asList("a", "b")); + node.setData(ABC, "w00t"); + + assertThat(node.getData(ABC)).contains("w00t"); + assertThat(node.getData(LISTY)).containsExactly("a", "b"); + assertThat(node.containsData(ABC)).isTrue(); + assertThat(node.containsData(LISTY)).isTrue(); + assertThat(node.containsData(DING)).isFalse(); + } + + @Test + void removeWorks() { + Node node = new SimpleName(); + node.setData(ABC, "Hurray!"); + + node.removeData(ABC); + + assertThat(node.containsData(ABC)).isFalse(); + } + + @Test + void aNonExistentKeyThrowsAnException() { + Node node = new SimpleName(); + + assertThrows(IllegalStateException.class, () -> node.getData(DING)); + } + + @Test + void cloningCopiesData() { + Node node = new SimpleName(); + node.setData(ABC, "ABC!"); + node.setData(DEF, "DEF!"); + + Node clone = node.clone(); + assertEquals("ABC!", clone.getData(ABC)); + assertEquals("DEF!", clone.getData(DEF)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/FindNodeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/FindNodeTest.java new file mode 100644 index 0000000..1af6dd3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/FindNodeTest.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.TryStmt; +import java.util.function.Predicate; +import org.junit.jupiter.api.Test; + +/** + * Some tests for finding descendant and ancestor nodes. + */ +class FindNodeTest { + @Test + void testFindFirst() { + CompilationUnit cu = parse("class Foo {\n" + " void foo() {\n" + + " try {\n" + + " } catch (Exception e) {\n" + + " } finally {\n" + + " try {\n" + + " } catch (Exception e) {\n" + + " foo();\n" + + " } finally {\n" + + " }\n" + + " }\n" + + "\n" + + " }\n" + + "}\n"); + + // find the method call expression foo() + MethodCallExpr actual = cu.findFirst(MethodCallExpr.class).orElse(null); + + MethodCallExpr expected = cu.getType(0) + .getMember(0) + .asMethodDeclaration() + .getBody() + .get() + .getStatement(0) + .asTryStmt() + .getFinallyBlock() + .get() + .getStatement(0) + .asTryStmt() + .getCatchClauses() + .get(0) + .getBody() + .getStatement(0) + .asExpressionStmt() + .getExpression() + .asMethodCallExpr(); + + assertEquals(expected, actual); + } + + @Test + void testFindAncestralFinallyBlock() { + CompilationUnit cu = parse("class Foo {\n" + " void foo() {\n" + + " try {\n" + + " } catch (Exception e) {\n" + + " } finally {\n" + + " try {\n" + + " } catch (Exception e) {\n" + + " foo();\n" + + " } finally {\n" + + " }\n" + + " }\n" + + "\n" + + " }\n" + + "}\n"); + + // find the method call expression foo() + MethodCallExpr methodCallExpr = cu.findFirst(MethodCallExpr.class).orElse(null); + + // find the finally block that the method call expression foo() is in + Predicate predicate = (bs) -> { + if (bs.getParentNode().isPresent() && bs.getParentNode().get() instanceof TryStmt) { + TryStmt ancestralTryStmt = (TryStmt) bs.getParentNode().get(); + return bs == ancestralTryStmt.getFinallyBlock().orElse(null); + } + return false; + }; + BlockStmt actual = + methodCallExpr.findAncestor(predicate, BlockStmt.class).orElse(null); + + BlockStmt expected = cu.getType(0) + .getMember(0) + .asMethodDeclaration() + .getBody() + .get() + .getStatement(0) + .asTryStmt() + .getFinallyBlock() + .get(); + + assertEquals(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ListObservationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ListObservationTest.java new file mode 100644 index 0000000..5083b7e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ListObservationTest.java @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.ast.observer.AstObserver; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.type.PrimitiveType; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class ListObservationTest { + + private FieldDeclaration createIntField(String name) { + return new FieldDeclaration(new NodeList<>(), PrimitiveType.intType(), name); + } + + private AstObserver createObserver(List changes) { + return new AstObserver() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add(String.format( + "change of property %s for %s: from '%s' to '%s'", property, observedNode, oldValue, newValue)); + } + + @Override + public void parentChange(Node observedNode, Node previousParent, Node newParent) { + changes.add(String.format( + "setting parent for %s: was %s, now is %s", observedNode, previousParent, newParent)); + } + + @Override + public void listChange(NodeList observedNode, ListChangeType type, int index, Node nodeAddedOrRemoved) { + changes.add(String.format("'%s' %s in list at %d", nodeAddedOrRemoved, type, index)); + } + + @Override + public void listReplacement(NodeList observedNode, int index, Node oldNode, Node newNode) { + changes.add(String.format("'%s' %s in list at %d", oldNode, ListChangeType.REMOVAL, index)); + changes.add(String.format("'%s' %s in list at %d", newNode, ListChangeType.ADDITION, index)); + } + }; + } + + @Test + void addAllWithoutIndex() { + List changes = new LinkedList<>(); + String code = "class A { void foo(int p) { }}"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().addAll(Arrays.asList(createIntField("a"), createIntField("b"), createIntField("c"))); + assertEquals( + Arrays.asList( + "'int a;' ADDITION in list at 1", + "'int b;' ADDITION in list at 2", + "'int c;' ADDITION in list at 3"), + changes); + } + + @Test + void addAllWithIndex() { + List changes = new LinkedList<>(); + String code = "class A { void foo(int p) { }}"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().addAll(0, Arrays.asList(createIntField("a"), createIntField("b"), createIntField("c"))); + assertEquals( + Arrays.asList( + "'int a;' ADDITION in list at 0", + "'int b;' ADDITION in list at 1", + "'int c;' ADDITION in list at 2"), + changes); + } + + @Test + void clear() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().clear(); + assertEquals( + Arrays.asList( + "'int a;' REMOVAL in list at 0", + "'int b;' REMOVAL in list at 0", + "'int c;' REMOVAL in list at 0"), + changes); + } + + @Test + void set() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().set(1, createIntField("d")); + assertEquals(Arrays.asList("'int b;' REMOVAL in list at 1", "'int d;' ADDITION in list at 1"), changes); + } + + @Test + void removeNode() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; int d; int e; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().remove(cd.getFieldByName("c").get()); + assertThat(changes).containsExactlyInAnyOrder("'int c;' REMOVAL in list at 2"); + } + + @Test + void removeFirstNode() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; int d; int e; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().removeFirst(); + assertThat(changes).containsExactlyInAnyOrder("'int a;' REMOVAL in list at 0"); + assertEquals(cd.getMembers().size(), 4); + + for (int i = 3; i >= 0; i--) { + assertNotNull(cd.getMembers().removeFirst()); + assertEquals(cd.getMembers().size(), i); + } + + assertEquals(cd.getMembers().size(), 0); + } + + @Test + void removeLastNode() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; int d; int e; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().removeLast(); + assertThat(changes).containsExactlyInAnyOrder("'int e;' REMOVAL in list at 4"); + assertEquals(cd.getMembers().size(), 4); + + for (int i = 3; i >= 0; i--) { + assertNotNull(cd.getMembers().removeLast()); + assertEquals(cd.getMembers().size(), i); + } + + assertEquals(cd.getMembers().size(), 0); + } + + @Test + void removeObject() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; int d; int e; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().remove("hi"); + assertThat(changes).isEmpty(); + } + + @Test + void removeAll() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; int d; int e; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers() + .removeAll(Arrays.asList( + cd.getFieldByName("b").get(), + "foo", + cd.getFieldByName("d").get())); + assertThat(changes).containsExactlyInAnyOrder("'int b;' REMOVAL in list at 1", "'int d;' REMOVAL in list at 2"); + } + + @Test + void retainAll() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; int d; int e; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers() + .retainAll(Arrays.asList( + cd.getFieldByName("b").get(), + "foo", + cd.getFieldByName("d").get())); + assertThat(changes) + .containsExactlyInAnyOrder( + "'int a;' REMOVAL in list at 0", + "'int c;' REMOVAL in list at 1", + "'int e;' REMOVAL in list at 2"); + } + + @Test + void replaceAll() { + List changes = new LinkedList<>(); + String code = "class A { int a; int b; int c; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers().replaceAll(bodyDeclaration -> { + FieldDeclaration clone = (FieldDeclaration) bodyDeclaration.clone(); + SimpleName id = clone.getVariable(0).getName(); + id.setIdentifier(id.getIdentifier().toUpperCase()); + return clone; + }); + assertThat(changes) + .containsExactlyInAnyOrder( + "'int a;' REMOVAL in list at 0", "'int A;' ADDITION in list at 0", + "'int b;' REMOVAL in list at 1", "'int B;' ADDITION in list at 1", + "'int c;' REMOVAL in list at 2", "'int C;' ADDITION in list at 2"); + } + + @Test + void removeIf() { + List changes = new LinkedList<>(); + String code = "class A { int a; int longName; int c; }"; + CompilationUnit cu = parse(code); + ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); + cd.getMembers().register(createObserver(changes)); + + cd.getMembers() + .removeIf(m -> ((FieldDeclaration) m) + .getVariable(0) + .getName() + .getIdentifier() + .length() + > 3); + assertThat(changes).containsExactlyInAnyOrder("'int longName;' REMOVAL in list at 1"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java new file mode 100644 index 0000000..ec13c86 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java @@ -0,0 +1,440 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.ast.NodeList.nodeList; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.observer.AstObserver; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import java.util.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class NodeListTest extends AbstractLexicalPreservingTest { + + @Test + void replace() { + final NodeList list = nodeList(new Name("a"), new Name("b"), new Name("c")); + + final boolean replaced = list.replace(new Name("b"), new Name("z")); + + assertTrue(replaced); + assertEquals(3, list.size()); + assertEquals("a", list.get(0).asString()); + assertEquals("z", list.get(1).asString()); + assertEquals("c", list.get(2).asString()); + } + + @Test + void toStringTest() { + final NodeList list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); + + assertEquals(3, list.size()); + assertEquals("[abc, bcd, cde]", list.toString()); + } + + @Test + void addFirst() { + final NodeList list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); + + list.addFirst(new Name("xxx")); + + assertEquals(4, list.size()); + assertEquals("[xxx, abc, bcd, cde]", list.toString()); + } + + @Test + void addLast() { + final NodeList list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); + + list.addLast(new Name("xxx")); + + assertEquals(4, list.size()); + assertEquals("[abc, bcd, cde, xxx]", list.toString()); + } + + @Test + void addBefore() { + Name n = new Name("bcd"); + final NodeList list = nodeList(new Name("abc"), n, new Name("cde")); + + list.addBefore(new Name("xxx"), n); + + assertEquals(4, list.size()); + assertEquals("[abc, xxx, bcd, cde]", list.toString()); + } + + @Test + void addAfter() { + Name n = new Name("bcd"); + final NodeList list = nodeList(new Name("abc"), n, new Name("cde")); + + list.addAfter(new Name("xxx"), n); + + assertEquals(4, list.size()); + assertEquals("[abc, bcd, xxx, cde]", list.toString()); + } + + @Test + void addBeforeFirst() { + Name abc = new Name("abc"); + final NodeList list = nodeList(abc, new Name("bcd"), new Name("cde")); + + list.addBefore(new Name("xxx"), abc); + + assertEquals(4, list.size()); + assertEquals("[xxx, abc, bcd, cde]", list.toString()); + } + + @Test + void addAfterLast() { + Name cde = new Name("cde"); + final NodeList list = nodeList(new Name("abc"), new Name("bcd"), cde); + + list.addAfter(new Name("xxx"), cde); + + assertEquals(4, list.size()); + assertEquals("[abc, bcd, cde, xxx]", list.toString()); + } + + @Test + public void getFirstWhenEmpty() { + final NodeList list = nodeList(); + + Optional first = list.getFirst(); + + assertFalse(first.isPresent()); + assertEquals("Optional.empty", first.toString()); + } + + @Test + public void getFirstWhenNonEmpty() { + final NodeList list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); + + Optional first = list.getFirst(); + + assertTrue(first.isPresent()); + assertEquals("Optional[abc]", first.toString()); + } + + @Test + public void getLastWhenEmpty() { + final NodeList list = nodeList(); + + Optional last = list.getLast(); + + assertFalse(last.isPresent()); + assertEquals("Optional.empty", last.toString()); + } + + @Test + public void getLastWhenNonEmpty() { + final NodeList list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); + + Optional last = list.getLast(); + + assertTrue(last.isPresent()); + assertEquals("Optional[cde]", last.toString()); + } + + @Nested + class IteratorTest { + + @Nested + class ObserversTest { + NodeList list; + ListIterator iterator; + + List propertyChanges; + List parentChanges; + List listChanges; + List listReplacements; + AstObserver testObserver = new AstObserver() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + propertyChanges.add(String.format( + "%s.%s changed from %s to %s", + observedNode.getClass().getSimpleName(), + property.name().toLowerCase(), + oldValue, + newValue)); + } + + @Override + public void parentChange(Node observedNode, Node previousParent, Node newParent) { + parentChanges.add(String.format( + "%s 's parent changed from %s to %s", + observedNode.getClass().getSimpleName(), previousParent, newParent)); + } + + @Override + public void listChange( + NodeList observedNode, ListChangeType type, int index, Node nodeAddedOrRemoved) { + listChanges.add(String.format( + "%s %s to/from %s at position %d", + nodeAddedOrRemoved.getClass().getSimpleName(), + type.name(), + observedNode.getClass().getSimpleName(), + index)); + } + + @Override + public void listReplacement(NodeList observedNode, int index, Node oldNode, Node newNode) { + listReplacements.add(String.format( + "%s replaced within %s at position %d", + newNode.getClass().getSimpleName(), + observedNode.getClass().getSimpleName(), + index)); + } + }; + + @BeforeEach + void pre() { + list = nodeList(); + list.register(testObserver); + iterator = list.listIterator(); + + propertyChanges = new ArrayList<>(); + parentChanges = new ArrayList<>(); + listChanges = new ArrayList<>(); + listReplacements = new ArrayList<>(); + } + + @Test + void whenAdd() { + assertEquals(0, propertyChanges.size()); + assertEquals(0, parentChanges.size()); + assertEquals(0, listChanges.size()); + assertEquals(0, listReplacements.size()); + + iterator.add(new Name("abc")); + + assertEquals(0, propertyChanges.size()); + assertEquals(0, parentChanges.size()); + assertEquals(1, listChanges.size()); + assertEquals(0, listReplacements.size()); + + assertEquals("Name ADDITION to/from NodeList at position 0", listChanges.get(0)); + } + + @Test + void whenRemove() { + iterator.add(new Name("abc")); + + assertEquals(0, propertyChanges.size()); + assertEquals(0, parentChanges.size()); + assertEquals(1, listChanges.size()); + assertEquals(0, listReplacements.size()); + + iterator.previous(); + iterator.remove(); + + assertEquals(0, propertyChanges.size()); + assertEquals(0, parentChanges.size()); + assertEquals(2, listChanges.size()); + assertEquals(0, listReplacements.size()); + + assertEquals("Name ADDITION to/from NodeList at position 0", listChanges.get(0)); + assertEquals("Name REMOVAL to/from NodeList at position 0", listChanges.get(1)); + } + + @Test + void whenSet() { + iterator.add(new Name("abc")); + + assertEquals(0, propertyChanges.size()); + assertEquals(0, parentChanges.size()); + assertEquals(1, listChanges.size()); + assertEquals(0, listReplacements.size()); + + iterator.previous(); + iterator.set(new Name("xyz")); + + assertEquals(0, propertyChanges.size()); + assertEquals(0, parentChanges.size()); + assertEquals(1, listChanges.size()); + assertEquals(1, listReplacements.size()); + + assertEquals("Name ADDITION to/from NodeList at position 0", listChanges.get(0)); + assertEquals("Name replaced within NodeList at position 0", listReplacements.get(0)); + } + + @Test + void usageTest() { + final String REFERENCE_TO_BE_DELETED = "bad"; + considerCode("" + "@MyAnnotation(myElements = {\"good\", \"bad\", \"ugly\"})\n" + + "public final class MyClass {\n" + + "}"); + String expected = "" + "@MyAnnotation(myElements = {\"good\", \"ugly\"})\n" + + "public final class MyClass {\n" + + "}"; + + List annotations = cu.findAll(NormalAnnotationExpr.class); + + annotations.forEach(annotation -> { + // testcase, per https://github.com/javaparser/javaparser/issues/2936#issuecomment-731370505 + MemberValuePair mvp = annotation.getPairs().get(0); + Expression value = mvp.getValue(); + if ((value instanceof ArrayInitializerExpr)) { + NodeList myElements = ((ArrayInitializerExpr) value).getValues(); + + for (Iterator iterator = myElements.iterator(); iterator.hasNext(); ) { + Node elt = iterator.next(); + { + String nameAsString = ((StringLiteralExpr) elt).asString(); + if (REFERENCE_TO_BE_DELETED.equals(nameAsString)) iterator.remove(); + } + } + } + }); + + assertEquals(expected, LexicalPreservingPrinter.print(cu)); + } + } + + @Nested + class AddRemoveListIteratorTest { + NodeList list; + ListIterator iterator; + + @BeforeEach + void pre() { + list = nodeList(); + iterator = list.listIterator(); + } + + @Test + void whenAdd() { + assertFalse(iterator.hasNext()); + assertFalse(iterator.hasPrevious()); + // Note that the element is added before the current cursor, thus is accessible via "previous" + iterator.add(new Name("abc")); + assertFalse(iterator.hasNext()); + assertTrue(iterator.hasPrevious()); + } + } + + @Nested + class EmptyIteratorTest { + NodeList list; + ListIterator iterator; + + @BeforeEach + void pre() { + list = nodeList(); + iterator = list.listIterator(); + } + + @Test + void whenNext() { + assertThrows(NoSuchElementException.class, () -> { + iterator.next(); + }); + } + + @Test + void whenHasNext() { + assertFalse(iterator.hasNext()); + } + + @Test + void whenAdd() { + assertFalse(iterator.hasNext()); + assertFalse(iterator.hasPrevious()); + // Note that the element is added before the current cursor, thus is accessible via "previous" + iterator.add(new Name("abc")); + assertFalse(iterator.hasNext()); + assertTrue(iterator.hasPrevious()); + } + + @Test + void whenSet() { + assertFalse(iterator.hasNext()); + assertFalse(iterator.hasPrevious()); + assertThrows(IllegalArgumentException.class, () -> { + // Note that the cursor is initially at -1, thus not possible to set the value here + iterator.set(new Name("abc")); + }); + // Assert that next/previous are still empty + assertFalse(iterator.hasNext()); + assertFalse(iterator.hasPrevious()); + } + } + + @Nested + class SingleItemIteratorTest { + NodeList list; + Iterator iterator; + + @BeforeEach + void pre() { + list = nodeList(new Name("abc")); + iterator = list.iterator(); + } + + @Test + void whenNext() { + Name next = iterator.next(); + assertNotNull(next); + } + + @Test + void whenHasNext() { + assertTrue(iterator.hasNext()); + } + + @Test + void whenHasNextRepeated() { + assertTrue(iterator.hasNext()); + assertTrue(iterator.hasNext()); + assertTrue(iterator.hasNext()); + assertTrue(iterator.hasNext()); + } + + @Test + void whenHasNextThenNext() { + assertTrue(iterator.hasNext()); + iterator.next(); + assertFalse(iterator.hasNext()); + assertThrows(NoSuchElementException.class, () -> { + iterator.next(); + }); + } + + @Test + void whenRemove() { + Name current = iterator.next(); + iterator.remove(); + assertFalse(iterator.hasNext()); + assertThrows(NoSuchElementException.class, () -> { + iterator.next(); + }); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodePositionTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodePositionTest.java new file mode 100644 index 0000000..929c320 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodePositionTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParseStart; +import com.github.javaparser.Providers; +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class NodePositionTest { + + private List getAllNodes(Node node) { + List nodes = new LinkedList<>(); + nodes.add(node); + node.getChildNodes().forEach(c -> nodes.addAll(getAllNodes(c))); + return nodes; + } + + @Test + void packageProtectedClassShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("class A { }"); + } + + @Test + void packageProtectedInterfaceShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("interface A { }"); + } + + @Test + void packageProtectedEnumShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("enum A { }"); + } + + @Test + void packageProtectedAnnotationShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("@interface A { }"); + } + + @Test + void packageProtectedFieldShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("public class A { int i; }"); + } + + @Test + void packageProtectedMethodShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("public class A { void foo() {} }"); + } + + @Test + void packageProtectedConstructorShouldHavePositionSet() throws IOException { + ensureAllNodesHaveValidBeginPosition("public class A { A() {} }"); + } + + private void ensureAllNodesHaveValidBeginPosition(final String code) { + ParseResult res = + new JavaParser().parse(ParseStart.COMPILATION_UNIT, Providers.provider(code)); + assertTrue(res.getProblems().isEmpty()); + + CompilationUnit cu = res.getResult().get(); + getAllNodes(cu).forEach(n -> { + assertNotNull( + n.getRange(), + String.format( + "There should be no node without a range: %s (class: %s)", + n, n.getClass().getCanonicalName())); + if (n.getBegin().get().line == 0 && !n.toString().isEmpty()) { + throw new IllegalArgumentException("There should be no node at line 0: " + n + " (class: " + + n.getClass().getCanonicalName() + ")"); + } + }); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodeTest.java new file mode 100644 index 0000000..b767379 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/NodeTest.java @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.Position; +import com.github.javaparser.Range; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.utils.LineSeparator; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class NodeTest { + @Test + void removeOrphanCommentPositiveCase() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "A"); + Comment c = new LineComment("A comment"); + decl.addOrphanComment(c); + assertEquals(1, decl.getOrphanComments().size()); + assertSame(decl, c.getParentNode().get()); + assertTrue(decl.removeOrphanComment(c)); + assertEquals(0, decl.getOrphanComments().size()); + assertFalse(c.getParentNode().isPresent()); + } + + @Test + void removeOrphanCommentNegativeCase() { + ClassOrInterfaceDeclaration aClass = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "A"); + FieldDeclaration aField = + new FieldDeclaration(new NodeList<>(), new VariableDeclarator(PrimitiveType.intType(), "f")); + aClass.getMembers().add(aField); + Comment c = new LineComment("A comment"); + aField.addOrphanComment(c); + // the comment is an orphan comment of the field, so trying to remove it on the class should not work + assertFalse(aClass.removeOrphanComment(c)); + assertEquals(1, aField.getOrphanComments().size()); + assertTrue(c.getParentNode().isPresent()); + } + + @Test + void hasJavaDocCommentPositiveCaseWithSetJavaDocComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.setJavadocComment("A comment"); + assertTrue(decl.hasJavaDocComment()); + } + + @Test + void hasJavaDocCommentPositiveCaseWithSetComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.setComment(new JavadocComment("A comment")); + assertTrue(decl.hasJavaDocComment()); + } + + @Test + void hasJavaDocCommentNegativeCaseNoComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + assertFalse(decl.hasJavaDocComment()); + } + + @Test + void hasJavaDocCommentNegativeCaseLineComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.setComment(new LineComment("foo")); + assertFalse(decl.hasJavaDocComment()); + } + + @Test + void hasJavaDocCommentNegativeCaseBlockComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.setComment(new BlockComment("foo")); + assertFalse(decl.hasJavaDocComment()); + } + + @Test + void findCompilationUnitOfCommentNode() { + CompilationUnit cu = parse( + "class X {\n" + " void x() {\n" + " // this is a comment\n" + " foo();\n" + " }\n" + "}\n"); + + Comment comment = cu.getType(0) + .getMember(0) + .asMethodDeclaration() + .getBody() + .get() + .getStatement(0) + .getComment() + .get(); + + assertTrue(comment.findCompilationUnit().isPresent()); + } + + @Test + void findCompilationUnitOfOrphanCommentNode() { + CompilationUnit cu = parse("class X {\n" + " void x() {\n" + " // this is a comment\n" + " }\n" + "}\n"); + + Comment comment = cu.getType(0) + .getMember(0) + .asMethodDeclaration() + .getBody() + .get() + .getOrphanComments() + .get(0); + + assertTrue(comment.findCompilationUnit().isPresent()); + } + + @Test + void removeAllOnRequiredProperty() { + CompilationUnit cu = parse("class X{ void x(){}}"); + MethodDeclaration methodDeclaration = cu.getType(0).getMethods().get(0); + methodDeclaration.getName().removeForced(); + // Name is required, so to remove it the whole method is removed. + assertEquals(String.format("class X {%1$s}%1$s", LineSeparator.SYSTEM), cu.toString()); + } + + @Test + void removingTheSecondOfAListOfIdenticalStatementsDoesNotMessUpTheParents() { + CompilationUnit unit = parse(String.format( + "public class Example {%1$s" + " public static void example() {%1$s" + + " boolean swapped;%1$s" + + " swapped=false;%1$s" + + " swapped=false;%1$s" + + " }%1$s" + + "}%1$s", + LineSeparator.SYSTEM)); + // remove the second swapped=false + ExpressionStmt target = unit.findAll(ExpressionStmt.class).get(2); + target.remove(); + // This will throw an exception if the parents are bad. + unit.toString(); + } + + @Test + void findNodeByRange() { + CompilationUnit cu = parse("class X {\n" + " void x() {\n" + " }\n" + "}\n"); + ClassOrInterfaceDeclaration coid = + cu.findFirst(ClassOrInterfaceDeclaration.class).get(); + MethodDeclaration md = cu.findFirst(MethodDeclaration.class).get(); + + // The range corresponds to the compilation unit + Optional node = cu.findByRange(new Range(new Position(1, 1), new Position(4, 2))); + assertTrue(node.isPresent()); + assertEquals(cu, node.get()); + + // The range corresponds to the class declaration + node = cu.findByRange(new Range(new Position(1, 1), new Position(4, 1))); + assertTrue(node.isPresent()); + assertEquals(coid, node.get()); + + // The range corresponds to the method declaration + node = cu.findByRange(new Range(new Position(2, 3), new Position(3, 3))); + assertTrue(node.isPresent()); + assertEquals(md, node.get()); + + // The range is included in the class declaration + node = cu.findByRange(new Range(new Position(1, 1), new Position(1, 1))); + assertTrue(node.isPresent()); + assertEquals(coid, node.get()); + + // The range is not included in the compilation unit + node = cu.findByRange(new Range(new Position(5, 1), new Position(5, 1))); + assertFalse(node.isPresent()); + + // Search based on the method declaration, but the range corresponds to a parent node. + node = md.findByRange(new Range(new Position(1, 1), new Position(1, 1))); + assertFalse(node.isPresent()); + } + + @Nested + class PreOrderIteratorTest { + @Test + void rootHasNoChild() { + Node root = new CompilationUnit(); + List nodes = root.findAll(Node.class, Node.TreeTraversal.PREORDER); + assertEquals(Arrays.asList(CompilationUnit.class), classesOf(nodes)); + } + + @Test + void rootHasChild() { + Node root = new CompilationUnit("com"); + List nodes = root.findAll(Node.class, Node.TreeTraversal.PREORDER); + assertEquals(Arrays.asList(CompilationUnit.class, PackageDeclaration.class, Name.class), classesOf(nodes)); + } + + @Test + void astHasMultipleLeafs() { + Node root = parse("package com;" + "import com.*;" + "import org.*;" + "abstract class Foo {}"); + List nodes = root.findAll(Node.class, Node.TreeTraversal.PREORDER); + assertEquals( + Arrays.asList( + CompilationUnit.class, + PackageDeclaration.class, + Name.class, + ImportDeclaration.class, + Name.class, + ImportDeclaration.class, + Name.class, + ClassOrInterfaceDeclaration.class, + Modifier.class, + SimpleName.class), + classesOf(nodes)); + } + + private List> classesOf(List nodes) { + return nodes.stream().map(Node::getClass).collect(Collectors.toList()); + } + } + + @Nested + class PostOrderIteratorTest { + @Test + void rootHasNoChild() { + Node root = new CompilationUnit(); + List nodes = root.findAll(Node.class, Node.TreeTraversal.POSTORDER); + assertEquals(Arrays.asList(CompilationUnit.class), classesOf(nodes)); + } + + @Test + void rootHasChild() { + Node root = new CompilationUnit("com"); + List nodes = root.findAll(Node.class, Node.TreeTraversal.POSTORDER); + assertEquals(Arrays.asList(Name.class, PackageDeclaration.class, CompilationUnit.class), classesOf(nodes)); + } + + @Test + void astHasMultipleLeafs() { + Node root = parse("package com;" + "import com.*;" + "import org.*;" + "abstract class Foo {}"); + List nodes = root.findAll(Node.class, Node.TreeTraversal.POSTORDER); + assertEquals( + Arrays.asList( + Name.class, + PackageDeclaration.class, + Name.class, + ImportDeclaration.class, + Name.class, + ImportDeclaration.class, + Modifier.class, + SimpleName.class, + ClassOrInterfaceDeclaration.class, + CompilationUnit.class), + classesOf(nodes)); + } + + private List> classesOf(List nodes) { + return nodes.stream().map(Node::getClass).collect(Collectors.toList()); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ObservationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ObservationTest.java new file mode 100644 index 0000000..c4d78fa --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ObservationTest.java @@ -0,0 +1,329 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.observer.AstObserver; +import com.github.javaparser.ast.observer.AstObserverAdapter; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.type.PrimitiveType; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class ObservationTest { + + @Test + void registerSubTree() { + String code = "class A { int f; void foo(int p) { return 'z'; }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add(String.format( + "%s.%s changed from %s to %s", + observedNode.getClass().getSimpleName(), property.name().toLowerCase(), oldValue, newValue)); + } + }; + cu.registerForSubtree(observer); + + assertThat(changes).isEmpty(); + + cu.getClassByName("A").get().setName("MyCoolClass"); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + + cu.getClassByName("MyCoolClass") + .get() + .getFieldByName("f") + .get() + .getVariable(0) + .setType(new PrimitiveType(PrimitiveType.Primitive.BOOLEAN)); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean"); + + cu.getClassByName("MyCoolClass") + .get() + .getMethodsByName("foo") + .get(0) + .getParameterByName("p") + .get() + .setName("myParam"); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean", + "Parameter.name changed from p to myParam"); + } + + @Test + void registerWithJustNodeMode() { + String code = "class A { int f; void foo(int p) { return 'z'; }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add(String.format( + "%s.%s changed from %s to %s", + observedNode.getClass().getSimpleName(), property.name().toLowerCase(), oldValue, newValue)); + } + }; + cu.getClassByName("A").get().register(observer, Node.ObserverRegistrationMode.JUST_THIS_NODE); + + assertThat(changes).isEmpty(); + + cu.getClassByName("A").get().setName("MyCoolClass"); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + + cu.getClassByName("MyCoolClass") + .get() + .getFieldByName("f") + .get() + .getVariable(0) + .setType(new PrimitiveType(PrimitiveType.Primitive.BOOLEAN)); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + + cu.getClassByName("MyCoolClass") + .get() + .getMethodsByName("foo") + .get(0) + .getParameterByName("p") + .get() + .setName("myParam"); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + + cu.getClassByName("MyCoolClass") + .get() + .addField("int", "bar") + .getVariables() + .get(0) + .setInitializer("0"); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + } + + @Test + void registerWithNodeAndExistingDescendantsMode() { + String code = "class A { int f; void foo(int p) { return 'z'; }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add(String.format( + "%s.%s changed from %s to %s", + observedNode.getClass().getSimpleName(), property.name().toLowerCase(), oldValue, newValue)); + } + }; + cu.getClassByName("A") + .get() + .register(observer, Node.ObserverRegistrationMode.THIS_NODE_AND_EXISTING_DESCENDANTS); + + assertThat(changes).isEmpty(); + + cu.getClassByName("A").get().setName("MyCoolClass"); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + + cu.getClassByName("MyCoolClass") + .get() + .getFieldByName("f") + .get() + .getVariable(0) + .setType(new PrimitiveType(PrimitiveType.Primitive.BOOLEAN)); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean"); + + cu.getClassByName("MyCoolClass") + .get() + .getMethodsByName("foo") + .get(0) + .getParameterByName("p") + .get() + .setName("myParam"); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean", + "Parameter.name changed from p to myParam"); + + cu.getClassByName("MyCoolClass") + .get() + .addField("int", "bar") + .getVariables() + .get(0) + .setInitializer("0"); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean", + "Parameter.name changed from p to myParam"); + } + + @Test + void registerWithSelfPropagatingMode() { + String code = "class A { int f; void foo(int p) { return 'z'; }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add(String.format( + "%s.%s changed from %s to %s", + observedNode.getClass().getSimpleName(), property.name().toLowerCase(), oldValue, newValue)); + } + }; + cu.getClassByName("A").get().register(observer, Node.ObserverRegistrationMode.SELF_PROPAGATING); + + assertThat(changes).isEmpty(); + + cu.getClassByName("A").get().setName("MyCoolClass"); + assertThat(changes).containsExactlyInAnyOrder("ClassOrInterfaceDeclaration.name changed from A to MyCoolClass"); + + cu.getClassByName("MyCoolClass") + .get() + .getFieldByName("f") + .get() + .getVariable(0) + .setType(new PrimitiveType(PrimitiveType.Primitive.BOOLEAN)); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean"); + + cu.getClassByName("MyCoolClass") + .get() + .getMethodsByName("foo") + .get(0) + .getParameterByName("p") + .get() + .setName("myParam"); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean", + "Parameter.name changed from p to myParam"); + + cu.getClassByName("MyCoolClass") + .get() + .addField("int", "bar") + .getVariables() + .get(0) + .setInitializer("0"); + assertThat(changes) + .containsExactlyInAnyOrder( + "ClassOrInterfaceDeclaration.name changed from A to MyCoolClass", + "FieldDeclaration.maximum_common_type changed from int to boolean", + "VariableDeclarator.type changed from int to boolean", + "Parameter.name changed from p to myParam", + "VariableDeclarator.initializer changed from null to 0"); + } + + @Test + void deleteAParameterTriggerNotifications() { + String code = "class A { void foo(int p) { }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + + @Override + public void listChange(NodeList observedNode, ListChangeType type, int index, Node nodeAddedOrRemoved) { + changes.add("removing [" + nodeAddedOrRemoved + "] from index " + index); + } + }; + cu.register(observer, Node.ObserverRegistrationMode.SELF_PROPAGATING); + + cu.getClassByName("A") + .get() + .getMethodsByName("foo") + .get(0) + .getParameter(0) + .remove(); + assertThat(changes).containsExactlyInAnyOrder("removing [int p] from index 0"); + } + + @Test + void deleteClassNameDoesNotTriggerNotifications() { + String code = "class A { void foo(int p) { }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + + @Override + public void listChange(NodeList observedNode, ListChangeType type, int index, Node nodeAddedOrRemoved) { + changes.add("removing [" + nodeAddedOrRemoved + "] from index " + index); + } + }; + cu.register(observer, Node.ObserverRegistrationMode.SELF_PROPAGATING); + + // I cannot remove the name of a type + assertFalse(cu.getClassByName("A").get().getName().remove()); + assertThat(changes).isEmpty(); + } + + @Test + void deleteMethodBodyDoesTriggerNotifications() { + String code = "class A { void foo(int p) { }}"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new AstObserverAdapter() { + + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add("setting [" + property + "] to " + newValue); + } + + @Override + public void listChange(NodeList observedNode, ListChangeType type, int index, Node nodeAddedOrRemoved) { + changes.add("removing [" + nodeAddedOrRemoved + "] from index " + index); + } + }; + cu.register(observer, Node.ObserverRegistrationMode.SELF_PROPAGATING); + + assertTrue(cu.getClassByName("A") + .get() + .getMethodsByName("foo") + .get(0) + .getBody() + .get() + .remove()); + assertThat(changes).containsExactlyInAnyOrder("setting [BODY] to null"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ParseResultTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ParseResultTest.java new file mode 100644 index 0000000..7bf3c86 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ParseResultTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.ast.Node.Parsedness.PARSED; +import static com.github.javaparser.ast.Node.Parsedness.UNPARSABLE; +import static org.assertj.core.api.Assertions.assertThat; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.Problem; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ParseResultTest { + private final JavaParser javaParser = new JavaParser(new ParserConfiguration()); + + @Test + void whenParsingSucceedsThenWeGetResultsAndNoProblems() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("class X{}")); + + assertThat(result.getResult().isPresent()).isTrue(); + assertThat(result.getResult().get().getParsed()).isEqualTo(PARSED); + assertThat(result.getProblems()).isEmpty(); + + assertThat(result.toString()).isEqualTo("Parsing successful"); + } + + @Test + void whenParsingFailsThenWeGetProblemsAndABadResult() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("class {")); + + assertThat(result.getResult().isPresent()).isTrue(); + assertThat(result.getResult().get().getParsed()).isEqualTo(UNPARSABLE); + assertThat(result.getProblems().size()).isEqualTo(1); + + Problem problem = result.getProblem(0); + assertThat(problem.getMessage()) + .isEqualTo( + "Parse error. Found \"{\", expected one of \"enum\" \"exports\" \"module\" \"open\" \"opens\" \"permits\" \"provides\" \"record\" \"requires\" \"sealed\" \"strictfp\" \"to\" \"transitive\" \"uses\" \"when\" \"with\" \"yield\" "); + + assertThat(result.toString()) + .startsWith("Parsing failed:" + LineSeparator.SYSTEM + "(line 1,col 1) Parse error."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ReplaceNodeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ReplaceNodeTest.java new file mode 100644 index 0000000..ba87f08 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/ReplaceNodeTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parsePackageDeclaration; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ReplaceNodeTest { + @Test + void testSimplePropertyWithGenericReplace() { + CompilationUnit cu = parse("package x; class Y {}"); + cu.replace(cu.getPackageDeclaration().get(), parsePackageDeclaration("package z;")); + assertEquals( + String.format("package z;%1$s" + "%1$s" + "class Y {%1$s" + "}%1$s", LineSeparator.SYSTEM), + cu.toString()); + } + + @Test + void testListProperty() { + CompilationUnit cu = parse("package x; class Y {}"); + cu.replace( + cu.getClassByName("Y").get(), + parse("class B{int y;}").getClassByName("B").get()); + assertEquals( + String.format( + "package x;%1$s" + "%1$s" + "class B {%1$s" + "%1$s" + " int y;%1$s" + "}%1$s", + LineSeparator.SYSTEM), + cu.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/WalkFindTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/WalkFindTest.java new file mode 100644 index 0000000..d9e1674 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/WalkFindTest.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.SimpleName; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public class WalkFindTest { + @Test + void findCompilationUnit() { + CompilationUnit cu = parse("class X{int x;}"); + VariableDeclarator x = cu.getClassByName("X") + .get() + .getMember(0) + .asFieldDeclaration() + .getVariables() + .get(0); + assertEquals(cu, x.findCompilationUnit().get()); + } + + @Test + void findParent() { + CompilationUnit cu = parse("class X{int x;}"); + SimpleName x = cu.getClassByName("X") + .get() + .getMember(0) + .asFieldDeclaration() + .getVariables() + .get(0) + .getName(); + assertEquals("int x;", x.findAncestor(FieldDeclaration.class).get().toString()); + } + + @Test + void findParentFromTypes() { + CompilationUnit cu = parse("class X{Integer x;}"); + VariableDeclarator vd = cu.getClassByName("X") + .get() + .getMember(0) + .asFieldDeclaration() + .getVariables() + .get(0); + assertEquals( + FieldDeclaration.class.getName(), + vd.findAncestor(new Class[] { + CompilationUnit.class, ClassOrInterfaceDeclaration.class, FieldDeclaration.class + }) + .get() + .getClass() + .getName()); + assertEquals( + ClassOrInterfaceDeclaration.class.getName(), + vd.findAncestor(new Class[] {CompilationUnit.class, ClassOrInterfaceDeclaration.class}) + .get() + .getClass() + .getName()); + } + + @Test + void cantFindCompilationUnit() { + VariableDeclarator x = new VariableDeclarator(); + assertFalse(x.findCompilationUnit().isPresent()); + } + + @Test + void genericWalk() { + Expression e = parseExpression("1+1"); + StringBuilder b = new StringBuilder(); + e.walk(n -> b.append(n.toString())); + assertEquals("1 + 111", b.toString()); + } + + @Test + void classSpecificWalk() { + Expression e = parseExpression("1+1"); + StringBuilder b = new StringBuilder(); + e.walk(IntegerLiteralExpr.class, n -> b.append(n.toString())); + assertEquals("11", b.toString()); + } + + @Test + void conditionalFindAll() { + Expression e = parseExpression("1+2+3"); + List ints = e.findAll(IntegerLiteralExpr.class, n -> n.asInt() > 1); + assertEquals("[2, 3]", ints.toString()); + } + + @Test + void typeOnlyFindAll() { + Expression e = parseExpression("1+2+3"); + List ints = e.findAll(IntegerLiteralExpr.class); + assertEquals("[1, 2, 3]", ints.toString()); + } + + @Test + void typeOnlyFindAllMatchesSubclasses() { + Expression e = parseExpression("1+2+3"); + List ints = e.findAll(Node.class); + assertEquals("[1 + 2 + 3, 1 + 2, 1, 2, 3]", ints.toString()); + } + + @Test + void conditionalTypedFindFirst() { + Expression e = parseExpression("1+2+3"); + Optional ints = e.findFirst(IntegerLiteralExpr.class, n -> n.asInt() > 1); + assertEquals("Optional[2]", ints.toString()); + } + + @Test + void typeOnlyFindFirst() { + Expression e = parseExpression("1+2+3"); + Optional ints = e.findFirst(IntegerLiteralExpr.class); + assertEquals("Optional[1]", ints.toString()); + } + + @Test + void stream() { + Expression e = parseExpression("1+2+3"); + List ints = e.stream() + .filter(n -> n instanceof IntegerLiteralExpr) + .map(IntegerLiteralExpr.class::cast) + .filter(i -> i.asInt() > 1) + .collect(Collectors.toList()); + assertEquals("[2, 3]", ints.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/AnnotationDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/AnnotationDeclarationTest.java new file mode 100644 index 0000000..5b76ab8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/AnnotationDeclarationTest.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static com.github.javaparser.utils.TestParser.parseStatement; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class AnnotationDeclarationTest { + @Test + void cantAddField() { + assertThrows(IllegalStateException.class, () -> new AnnotationDeclaration().addField(Object.class, "oo")); + } + + @Test + void issue2216() { + Statement statement = parseStatement("TT tt = new @TypeAnno @TA2 TT( \"S\" );"); + assertEquals("TT tt = new @TypeAnno @TA2 TT(\"S\");", statement.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/AnnotationMemberDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/AnnotationMemberDeclarationTest.java new file mode 100644 index 0000000..4329f32 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/AnnotationMemberDeclarationTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.utils.TestParser; +import org.junit.jupiter.api.Test; + +class AnnotationMemberDeclarationTest { + + @Test + void whenSettingNameTheParentOfNameIsAssigned() { + AnnotationMemberDeclaration decl = new AnnotationMemberDeclaration(); + SimpleName name = new SimpleName("foo"); + decl.setName(name); + assertTrue(name.getParentNode().isPresent()); + assertSame(decl, name.getParentNode().get()); + } + + @Test + void removeDefaultValueWhenNoDefaultValueIsPresent() { + AnnotationMemberDeclaration decl = new AnnotationMemberDeclaration(); + SimpleName name = new SimpleName("foo"); + decl.setName(name); + + decl.removeDefaultValue(); + + assertFalse(decl.getDefaultValue().isPresent()); + } + + @Test + void removeDefaultValueWhenDefaultValueIsPresent() { + AnnotationMemberDeclaration decl = new AnnotationMemberDeclaration(); + SimpleName name = new SimpleName("foo"); + decl.setName(name); + Expression defaultValue = new IntegerLiteralExpr("2"); + decl.setDefaultValue(defaultValue); + + decl.removeDefaultValue(); + + assertFalse(defaultValue.getParentNode().isPresent()); + } + + @Test + void annotationDeclarationShouldSupportRecordChild() { + CompilationUnit cu = TestParser.parseCompilationUnit( + ParserConfiguration.LanguageLevel.BLEEDING_EDGE, + "" + "@interface Foo {\n" + " record Bar(String s) {}\n" + "}"); + + RecordDeclaration bar = + cu.getAnnotationDeclarationByName("Foo").get().getMember(0).asRecordDeclaration(); + + assertEquals(1, bar.getParameters().size()); + + Parameter parameter = bar.getParameter(0); + assertEquals("String", parameter.getTypeAsString()); + assertEquals("s", parameter.getNameAsString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclarationTest.java new file mode 100644 index 0000000..ac7a19c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclarationTest.java @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.utils.TestParser; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; +import org.opentest4j.AssertionFailedError; + +class ClassOrInterfaceDeclarationTest { + @Test + void staticNestedClass() { + CompilationUnit cu = parse("class X{static class Y{}}"); + ClassOrInterfaceDeclaration y = + cu.getClassByName("X").get().getMembers().get(0).asClassOrInterfaceDeclaration(); + + assertFalse(y.isInnerClass()); + assertTrue(y.isNestedType()); + assertFalse(y.isLocalClassDeclaration()); + } + + @Test + void nestedInterface() { + CompilationUnit cu = parse("class X{interface Y{}}"); + ClassOrInterfaceDeclaration y = + cu.getClassByName("X").get().getMembers().get(0).asClassOrInterfaceDeclaration(); + + assertFalse(y.isInnerClass()); + assertTrue(y.isNestedType()); + assertFalse(y.isLocalClassDeclaration()); + } + + @Test + void nonStaticNestedClass() { + CompilationUnit cu = parse("class X{class Y{}}"); + ClassOrInterfaceDeclaration y = + cu.getClassByName("X").get().getMembers().get(0).asClassOrInterfaceDeclaration(); + + assertTrue(y.isInnerClass()); + assertTrue(y.isNestedType()); + assertFalse(y.isLocalClassDeclaration()); + } + + @Test + void topClass() { + CompilationUnit cu = parse("class X{}"); + ClassOrInterfaceDeclaration y = cu.getClassByName("X").get(); + + assertFalse(y.isInnerClass()); + assertFalse(y.isNestedType()); + assertFalse(y.isLocalClassDeclaration()); + } + + @Test + void localClass() { + MethodDeclaration method = parseBodyDeclaration("void x(){class X{};}").asMethodDeclaration(); + ClassOrInterfaceDeclaration x = + method.findFirst(ClassOrInterfaceDeclaration.class).get(); + + assertFalse(x.isInnerClass()); + assertFalse(x.isNestedType()); + assertTrue(x.isLocalClassDeclaration()); + } + + @Test + void sealedClass() { + CompilationUnit cu = TestParser.parseCompilationUnit( + ParserConfiguration.LanguageLevel.JAVA_17, "sealed class X permits Y, Z {}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + + assertFalse(x.isInnerClass()); + assertFalse(x.isNestedType()); + assertFalse(x.isLocalClassDeclaration()); + assertTrue(x.hasModifier(Modifier.Keyword.SEALED)); + assertEquals(x.getPermittedTypes().size(), 2); + assertEquals(x.getPermittedTypes().get(0).getNameAsString(), "Y"); + assertEquals(x.getPermittedTypes().get(1).getNameAsString(), "Z"); + } + + @Test + void nonSealedClass() { + CompilationUnit cu = + TestParser.parseCompilationUnit(ParserConfiguration.LanguageLevel.JAVA_17, "non-sealed class X{}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + + assertFalse(x.isInnerClass()); + assertFalse(x.isNestedType()); + assertFalse(x.isLocalClassDeclaration()); + assertTrue(x.hasModifier(Modifier.Keyword.NON_SEALED)); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = { + "JAVA_8", "JAVA_9", "JAVA_10", "JAVA_11", "JAVA_12", "JAVA_13", "JAVA_14", "JAVA_15", "JAVA_16", + "JAVA_17" + }) + void sealedFieldNamePermitted(ParserConfiguration.LanguageLevel languageLevel) { + assertDoesNotThrow(() -> { + TestParser.parseVariableDeclarationExpr(languageLevel, "boolean sealed"); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_8", "JAVA_9", "JAVA_10", "JAVA_11", "JAVA_12", "JAVA_13", "JAVA_14", "JAVA_15", "JAVA_16"}) + void sealedClassOrInterfaceNamePermitted(ParserConfiguration.LanguageLevel languageLevel) { + assertDoesNotThrow(() -> { + TestParser.parseCompilationUnit(languageLevel, "class sealed {}"); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_17"}) + void sealedClassOrInterfaceNameNotPermitted(ParserConfiguration.LanguageLevel languageLevel) { + assertThrows(AssertionFailedError.class, () -> { + TestParser.parseCompilationUnit(languageLevel, "class sealed {}"); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = { + "JAVA_8", "JAVA_9", "JAVA_10", "JAVA_11", "JAVA_12", "JAVA_13", "JAVA_14", "JAVA_15", "JAVA_16", + "JAVA_17" + }) + void permitsFieldNamePermitted(ParserConfiguration.LanguageLevel languageLevel) { + assertDoesNotThrow(() -> { + TestParser.parseVariableDeclarationExpr(languageLevel, "boolean permits"); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_8", "JAVA_9", "JAVA_10", "JAVA_11", "JAVA_12", "JAVA_13", "JAVA_14", "JAVA_15", "JAVA_16"}) + void permitsClassOrInterfaceNamePermitted(ParserConfiguration.LanguageLevel languageLevel) { + assertDoesNotThrow(() -> { + TestParser.parseCompilationUnit(languageLevel, "class permits {}"); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_17"}) + void permitsClassOrInterfaceNameNotPermitted(ParserConfiguration.LanguageLevel languageLevel) { + assertThrows(AssertionFailedError.class, () -> { + TestParser.parseCompilationUnit(languageLevel, "class permits {}"); + }); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/ConstructorDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/ConstructorDeclarationTest.java new file mode 100644 index 0000000..ded617c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/ConstructorDeclarationTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ConstructorDeclarationTest { + @Test + void acceptsSuper() { + ConstructorDeclaration cons = new ConstructorDeclaration("Cons"); + cons.createBody().addStatement("super();"); + + assertEquals( + String.format("public Cons() {%1$s" + " super();%1$s" + "}", LineSeparator.SYSTEM), cons.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/FieldDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/FieldDeclarationTest.java new file mode 100644 index 0000000..6fff815 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/FieldDeclarationTest.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Modifier.Keyword; +import com.github.javaparser.ast.NodeList; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class FieldDeclarationTest { + @Test + void wofjweoifj() { + CompilationUnit compilationUnit = parse("" + "class A {\n" + " int a, b;\n" + "}"); + + BodyDeclaration declaration = compilationUnit.getType(0).getMembers().get(0); + FieldDeclaration fieldDeclaration = declaration.asFieldDeclaration(); + VariableDeclarator var1 = fieldDeclaration.getVariables().get(0); + VariableDeclarator var2 = fieldDeclaration.getVariables().get(1); + assertEquals(var1, var1.getType().getParentNode().get()); + assertEquals(var2, var2.getType().getParentNode().get()); + } + + @Test + void setModifiersPrimitiveType() { + FieldDeclaration field = + parseBodyDeclaration("public static final int var = 1;").asFieldDeclaration(); + testChangingModifiers(field); + } + + @Test + void setModifiersNonPrimitiveType() { + FieldDeclaration field = + parseBodyDeclaration("public static final String var = \"a\";").asFieldDeclaration(); + testChangingModifiers(field); + } + + private void testChangingModifiers(FieldDeclaration field) { + NodeList modifiers = field.getModifiers(); + assertTrue(modifiers.contains(Modifier.publicModifier())); + assertTrue(modifiers.contains(Modifier.staticModifier())); + assertTrue(modifiers.contains(Modifier.finalModifier())); + assertEquals(3, modifiers.size()); + + field.setModifiers(new NodeList()); + modifiers = field.getModifiers(); + assertEquals(0, modifiers.size()); + + field.setModifiers(Keyword.PRIVATE, Keyword.SYNCHRONIZED); + modifiers = field.getModifiers(); + assertTrue(modifiers.contains(Modifier.privateModifier())); + assertTrue(modifiers.contains(Modifier.synchronizedModifier())); + assertEquals(2, modifiers.size()); + } + + @Test + void interfaceFieldTest() { + CompilationUnit compilationUnit = parse("" + "interface A {\n" + + " int a = 1;\n" + + " static int a_s = 1;\n" + + " final int a_f = 1;\n" + + " static final int a_s_f = 1;\n" + + " String b = \"b\";\n" + + " static String b_s = \"b\";\n" + + " final String b_f = \"b\";\n" + + " static final String b_s_f = \"b\";\n" + + "}\n"); + for (int i = 0; i < 8; ++i) { + BodyDeclaration declaration = + compilationUnit.getType(0).getMembers().get(i); + FieldDeclaration fieldDeclaration = declaration.asFieldDeclaration(); + Assertions.assertTrue(fieldDeclaration.isStatic()); + Assertions.assertTrue(fieldDeclaration.isFinal()); + } + } + + /** + * Regression test for issue #4056. + */ + @Test + void testEnumWithPrivateFieldInsideInterface() { + String source = "interface Outer {\n" + " enum Numbers {\n" + + " ONE(1),\n" + + " TWO(2),\n" + + " THREE(3);\n" + + "\n" + + " Numbers(int i) {\n" + + " this.i = i;\n" + + " }\n" + + "\n" + + " private int i;\n" + + " }\n" + + "}"; + CompilationUnit cu = StaticJavaParser.parse(source); + FieldDeclaration i = cu.getTypes() + .get(0) + .asClassOrInterfaceDeclaration() + .getMembers() + .get(0) + .asEnumDeclaration() + .getFields() + .get(0); + assertAll(() -> assertFalse(i.isPublic()), () -> assertFalse(i.isStatic()), () -> assertFalse(i.isFinal())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/MethodDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/MethodDeclarationTest.java new file mode 100644 index 0000000..6cbb268 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/MethodDeclarationTest.java @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import org.junit.jupiter.api.Test; + +class MethodDeclarationTest { + @Test + void annotationsAllowedAfterGenericsAndBeforeReturnType() { + parseBodyDeclaration("public @Abc String method() {return null;}"); + } + + @Test + void annotationsAllowedBeforeGenerics() { + parseBodyDeclaration("public @Abc String method() {return null;}"); + } + + @Test + void explicitReceiverParameters1() { + MethodDeclaration method = parseBodyDeclaration( + "void InnerInner(@mypackage.Anno Source.@mypackage.Anno Inner Source.Inner.this) { }") + .asMethodDeclaration(); + assertEquals("Source.Inner.this", method.getReceiverParameter().get().getNameAsString()); + } + + @Test + void explicitReceiverParameters2() { + MethodDeclaration method = parseBodyDeclaration("void x(A this) { }").asMethodDeclaration(); + assertEquals("this", method.getReceiverParameter().get().getNameAsString()); + } + + @Test + void explicitReceiverParameters3() { + MethodDeclaration method = parseBodyDeclaration("void x(A that) { }").asMethodDeclaration(); + assertFalse(method.getReceiverParameter().isPresent()); + } + + @Test + void signaturesEqual() { + MethodDeclaration method1 = parseBodyDeclaration("void x(String a) { }").asMethodDeclaration(); + MethodDeclaration method2 = parseBodyDeclaration("int x(String z);").asMethodDeclaration(); + assertEquals(method1.getSignature(), method2.getSignature()); + } + + @Test + void signaturesEqualWhenGenericsDiffer() { + MethodDeclaration method1 = + parseBodyDeclaration("void x(List a) { }").asMethodDeclaration(); + MethodDeclaration method2 = + parseBodyDeclaration("void x(List a) { }").asMethodDeclaration(); + assertEquals(method1.getSignature(), method2.getSignature()); + } + + @Test + void signaturesEqualWhenAnnotationsDiffer() { + MethodDeclaration method1 = + parseBodyDeclaration("void x(@A @B List a) { }").asMethodDeclaration(); + MethodDeclaration method2 = + parseBodyDeclaration("void x(@C List a) { }").asMethodDeclaration(); + assertEquals(method1.getSignature(), method2.getSignature()); + } + + @Test + void signaturesDifferentName() { + MethodDeclaration method1 = parseBodyDeclaration("void x(String a) { }").asMethodDeclaration(); + MethodDeclaration method2 = parseBodyDeclaration("int y(String z);").asMethodDeclaration(); + assertNotEquals(method1.getSignature(), method2.getSignature()); + } + + @Test + void signaturesDifferentTypes() { + MethodDeclaration method1 = parseBodyDeclaration("void x(String a) { }").asMethodDeclaration(); + MethodDeclaration method2 = parseBodyDeclaration("int x(int z);").asMethodDeclaration(); + assertNotEquals(method1.getSignature(), method2.getSignature()); + } + + @Test + void signaturesDifferentVarargs() { + MethodDeclaration method1 = parseBodyDeclaration("int x(int z);").asMethodDeclaration(); + MethodDeclaration method2 = parseBodyDeclaration("int x(int... z);").asMethodDeclaration(); + assertNotEquals(method1.getSignature(), method2.getSignature()); + } + + @Test + void signatureToString() { + MethodDeclaration method1 = + parseBodyDeclaration("int x(int z, String q);").asMethodDeclaration(); + assertEquals("x(int, String)", method1.getSignature().toString()); + } + + @Test + void isVariableArityMethod() { + MethodDeclaration method1 = parseBodyDeclaration("int x(int... z);").asMethodDeclaration(); + assertTrue(method1.isVariableArityMethod()); + MethodDeclaration method2 = + parseBodyDeclaration("int x(int i, int... z);").asMethodDeclaration(); + assertTrue(method2.isVariableArityMethod()); + } + + @Test + void isFixedArityMethod() { + MethodDeclaration method1 = parseBodyDeclaration("int x(int z);").asMethodDeclaration(); + assertTrue(method1.isFixedArityMethod()); + MethodDeclaration method2 = parseBodyDeclaration("int x();").asMethodDeclaration(); + assertTrue(method2.isFixedArityMethod()); + } + + /* + * A method in the body of an interface may be declared public or private + * (§6.6). If no access modifier is given, the method is implicitly public. + * https://docs.oracle.com/javase/specs/jls/se9/html/jls-9.html#jls-9.4 + */ + @Test + void isMethodInterfaceImplictlyPublic() { + CompilationUnit cu = parse("interface Foo { void m(); }"); + assertTrue(cu.findFirst(MethodDeclaration.class).get().isPublic()); + cu = parse("interface Foo { public void m(); }"); + assertTrue(cu.findFirst(MethodDeclaration.class).get().isPublic()); + cu = parse("interface Foo { abstract void m(); }"); + assertTrue(cu.findFirst(MethodDeclaration.class).get().isPublic()); + cu = parse("interface Foo { private void m(); }"); + assertFalse(cu.findFirst(MethodDeclaration.class).get().isPublic()); + } + + /* + * An interface method lacking a private, default, or static modifier is implicitly abstract. + * https://docs.oracle.com/javase/specs/jls/se9/html/jls-9.html#jls-9.4 + */ + @Test + void isMethodInterfaceImplictlyAbstract() { + CompilationUnit cu = parse("interface Foo { void m(); }"); + assertTrue(cu.findFirst(MethodDeclaration.class).get().isAbstract()); + cu = parse("interface Foo { abstract void m(); }"); + assertTrue(cu.findFirst(MethodDeclaration.class).get().isAbstract()); + cu = parse("interface Foo { private void m(); }"); + assertFalse(cu.findFirst(MethodDeclaration.class).get().isAbstract()); + cu = parse("interface Foo { static void m(); }"); + assertFalse(cu.findFirst(MethodDeclaration.class).get().isAbstract()); + cu = parse("interface Foo { default void m(){} }"); + assertFalse(cu.findFirst(MethodDeclaration.class).get().isAbstract()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/RecordDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/RecordDeclarationTest.java new file mode 100644 index 0000000..8f8f383 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/RecordDeclarationTest.java @@ -0,0 +1,732 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import com.github.javaparser.utils.TestParser; +import java.util.List; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; +import org.opentest4j.AssertionFailedError; + +public class RecordDeclarationTest { + + @Nested + class LanguageLevels { + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_13", "JAVA_13_PREVIEW", "JAVA_14", "JAVA_15"}) + void basicGrammarCompiles_languageLevelValidation_forbidden(ParserConfiguration.LanguageLevel languageLevel) { + String s = "record Point(int x, int y) { }"; + assertThrows(AssertionFailedError.class, () -> { + CompilationUnit cu = TestParser.parseCompilationUnit(languageLevel, s); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_14_PREVIEW", "JAVA_15_PREVIEW", "JAVA_16", "JAVA_16_PREVIEW"}) + void basicGrammarCompiles_languageLevelValidation_permitted(ParserConfiguration.LanguageLevel languageLevel) { + String s = "record Point(int x, int y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(languageLevel, s); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_14_PREVIEW", "JAVA_15_PREVIEW", "JAVA_16", "JAVA_16_PREVIEW"}) + void languageLevelValidation_recordAsTypeIdentifier_permitted(ParserConfiguration.LanguageLevel languageLevel) { + String s = "class record {}"; + assertThrows(AssertionFailedError.class, () -> { + CompilationUnit cu = TestParser.parseCompilationUnit(languageLevel, s); + }); + } + + @ParameterizedTest + @EnumSource( + value = ParserConfiguration.LanguageLevel.class, + names = {"JAVA_13", "JAVA_13_PREVIEW", "JAVA_14", "JAVA_15"}) + void languageLevelValidation_recordAsTypeIdentifier_forbidden(ParserConfiguration.LanguageLevel languageLevel) { + String s = "class record {}"; + CompilationUnit cu = TestParser.parseCompilationUnit(languageLevel, s); + } + } + + /** + * https://openjdk.java.net/jeps/395#Description + */ + @Test + void basicGrammarCompiles() { + String s = "record Point(int x, int y) { }"; + assertOneRecordDeclaration(TestParser.parseCompilationUnit(s)); + } + + /** + * https://openjdk.java.net/jeps/395#Description + */ + @Test + void basicGrammar() { + String s = "record Point(int x, int y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findAll(RecordDeclaration.class).get(0); + + assertTrue(recordDeclaration.isRecordDeclaration()); + assertTrue(recordDeclaration.getImplementedTypes().isEmpty()); + assertTrue(recordDeclaration.getTypeParameters().isEmpty()); + assertTrue(recordDeclaration.getFullyQualifiedName().isPresent()); + assertEquals("Point", recordDeclaration.getFullyQualifiedName().get()); + assertTrue(recordDeclaration.isRecordDeclaration()); + + NodeList parameters = recordDeclaration.getParameters(); + assertEquals(2, parameters.size()); + + Parameter parameter0 = parameters.get(0); + assertEquals("x", parameter0.getNameAsString()); + assertEquals("int", parameter0.getTypeAsString()); + Parameter parameter1 = parameters.get(1); + assertEquals("y", parameter1.getNameAsString()); + assertEquals("int", parameter1.getTypeAsString()); + + assertEquals(0, recordDeclaration.getMembers().size()); + } + + /** + * https://openjdk.java.net/jeps/395#Description + */ + @Test + void basicRecordPrints() { + String s = "record Point(int x, int y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + String expected = "" + "record Point(int x, int y) {\n" + "}\n" + ""; + assertEqualsStringIgnoringEol(expected, cu.toString()); + } + + @Test + void genericRecordPrints() { + String s = "record Point(X x, Y y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + String expected = "" + "record Point(X x, Y y) {\n" + "}\n" + ""; + assertEqualsStringIgnoringEol(expected, cu.toString()); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-record + */ + @Test + void record_cannotExtend() { + String s = "record Point(int x, int y) extends OtherThing { }"; + assertCompilationFails(s); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_cannotBeAbstract() { + String s = "abstract record Point(int x, int y) { }"; + assertCompilationFails(s); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_mayImplementInterfaces() { + String s = "record Point(int x, int y) implements OtherInterface { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_mayBeStatic() { + String s = "static record Point(int x, int y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + + assertOneRecordDeclaration(cu); + } + + @Test + void recordWithVarArgs() { + String s = "record R(T1 c1, Tn... cn){ }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + + List recordDeclarations = cu.findAll(RecordDeclaration.class); + assertEquals(1, recordDeclarations.size()); + + RecordDeclaration recordDeclaration = recordDeclarations.get(0); + NodeList parameters = recordDeclaration.getParameters(); + assertEquals(2, parameters.size()); + + Parameter parameter0 = parameters.get(0); + assertEquals("c1", parameter0.getNameAsString()); + assertEquals("T1", parameter0.getTypeAsString()); + assertFalse(parameter0.isVarArgs()); + + Parameter parameter1 = parameters.get(1); + assertEquals("cn", parameter1.getNameAsString()); + assertEquals("Tn", parameter1.getTypeAsString()); + assertTrue(parameter1.isVarArgs()); + } + + @Test + void recordWithAnnotationedParameters() { + String s = "record Card(@MyAnno Rank rank, @MyAnno Suit suit) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + + List recordDeclarations = cu.findAll(RecordDeclaration.class); + assertEquals(1, recordDeclarations.size()); + + RecordDeclaration recordDeclaration = recordDeclarations.get(0); + NodeList parameters = recordDeclaration.getParameters(); + assertEquals(2, parameters.size()); + + Parameter parameter0 = parameters.get(0); + assertEquals("rank", parameter0.getNameAsString()); + assertEquals("Rank", parameter0.getTypeAsString()); + assertEquals(1, parameter0.getAnnotations().size()); + + Parameter parameter1 = parameters.get(1); + assertEquals("suit", parameter1.getNameAsString()); + assertEquals("Suit", parameter1.getTypeAsString()); + assertEquals(1, parameter1.getAnnotations().size()); + + assertEquals(0, recordDeclaration.getMembers().size()); + } + + @Test + void record_emptyMembers() { + String s = "record Point(int x, int y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + List recordDeclarations = cu.findAll(RecordDeclaration.class); + RecordDeclaration recordDeclaration = recordDeclarations.get(0); + + assertEquals(0, recordDeclaration.getMembers().size()); + } + + @Test + void record_permitStaticMethods() { + String s = "" + "record ABC(int x, int y) {\n" + + "\n" + + " static public int abc() {\n" + + " return x;\n" + + " }\n" + + "\n" + + "}\n" + + ""; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + @Test + void record_permitMethods() { + String s = "" + "record ABC(int x, int y) {\n" + + "\n" + + " public int x() {\n" + + " return x;\n" + + " }\n" + + "\n" + + " public String xyz() {\n" + + " return \"10\";\n" + + " }\n" + + "\n" + + "}\n" + + ""; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + @Test + void record_forbidNonStaticFields() { + String s = "record Point(int x, int y) { int z; }"; + assertCompilationFails(s); + } + + @Test + void record_permitStaticFields() { + String s = "record Point(int x, int y) { static int z; }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + @Test + void record_permitPublicStaticFieldInRecord1() { + String s = "public final record RecordPublicField() {" + " public static final Object EMPTY = new Object();" + + "}\n"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + @Test + void record_permitPublicStaticFieldInNestedRecord() { + String s = + "public final record RecordTopLevel(Object member) {\n" + " private static record RecordNested() {\n" + + " public static final RecordNested EMPTY = new RecordNested();\n" + + " }\n" + + "}\n"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertTwoRecordDeclarations(cu); + } + + @Test + void record_permitStaticFields2() { + String s = "" + "record ABC(int x, int y) {\n" + + "\n" + + " static int z;\n" + + "\n" + + " static {\n" + + " int z = 10;\n" + + " }\n" + + "\n" + + " public int x() {\n" + + " return x;\n" + + " }\n" + + "\n" + + "}\n" + + ""; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_isImplicitlyFinal() { + String s = "record Point(int x, int y) { static int z; }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertFalse(recordDeclaration.hasModifier(Modifier.Keyword.FINAL)); + assertTrue(recordDeclaration.isFinal(), "Records are implicitly final."); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_isImplicitlyFinalWithoutExplicit() { + String s = "record Point(int x, int y) { static int z; }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertFalse(recordDeclaration.hasModifier(Modifier.Keyword.FINAL)); + assertTrue(recordDeclaration.isFinal(), "Records are implicitly final."); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_canHaveGenerics() { + String s = "record Point (T x, int y) { }"; + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertFalse(recordDeclaration.getTypeParameters().isEmpty()); + assertEquals("T", recordDeclaration.getTypeParameters().get(0).getNameAsString()); + } + + @Test + void record_mustNotAllowMismatchedComponentAccessorReturnType() { + String s = "record Point(int x, int y) {\n" + " public String x() {\n" + + " return \"10\";\n" + + " }\n" + + "}"; + assertCompilationFails(s); + } + + @Test + void record_allowMethodsWithSameNameAsRecordComponentButNotAnAccessorMethod() { + String s = "record Point(int x, int y) {\n" + " public String x(int a) {\n" + + " return \"10\";\n" + + " }\n" + + "}"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + @Test + void record_allowMethodsWithSameNameAsRecordComponentButNotAnAccessorMethod2() { + String s = "record Point(int x, int y) {\n" + " public int x(int a) {\n" + + " return 10;\n" + + " }\n" + + "}"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + @Test + void record_allowComponentAccessorWithMatchingType() { + String s = + "record Point(int x, int y) {\n" + " public int x() {\n" + " return 10;\n" + " }\n" + "}"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_allowNestedWithinClass() { + String s = "\n" + "class X {\n" + " record Point(int x, int y) {\n" + " }\n" + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_componentsAreImplicitlyFinal() { + String s = "record Point(int x, int y) { }"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findAll(RecordDeclaration.class).get(0); + + NodeList parameters = recordDeclaration.getParameters(); + assertTrue(parameters.get(0).isFinal()); + assertTrue(parameters.get(1).isFinal()); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_allowClassWithinRecord() { + String s = "\n" + "record Point(int x, int y) {\n" + " class X {\n" + " }\n" + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + List recordDeclarations = cu.findAll(RecordDeclaration.class); + assertEquals(1, recordDeclarations.size()); + + RecordDeclaration recordDeclaration = recordDeclarations.get(0); + BodyDeclaration member = recordDeclaration.getMember(0); + + assertTrue(member.isClassOrInterfaceDeclaration()); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_allowNestedWithinInterface() { + String s = "\n" + "interface X {\n" + " record Point(int x, int y) {\n" + " }\n" + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_allowNestedWithinEnum() { + String s = "\n" + "enum ABC {\n" + + " ABC;\n" + + " \n" + + " record Point(int x, int y) {\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_allowNestedMultiple() { + String s = "\n" + "interface Y {\n" + + " class X {\n" + + " record Point(int x, int y) {\n" + + " }\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_allowNestedMultiple2() { + String s = "\n" + "interface Y {\n" + + " class X {\n" + + " record Point(int x, int y) {\n" + + " }\n" + + " record PointB(int x, int y) {\n" + + " }\n" + + " }\n" + + "\n" + + " record PointC(int x, int y) {\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + + List recordDeclarations = cu.findAll(RecordDeclaration.class); + assertEquals(3, recordDeclarations.size()); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_topLevelRecordsAreNotStatic() { + String s = "record Point(int x, int y) { }\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findAll(RecordDeclaration.class).get(0); + assertFalse(recordDeclaration.hasModifier(Modifier.Keyword.STATIC)); + assertFalse(recordDeclaration.isStatic(), "Top level Records are NOT implicitly static."); + } + + /** + * https://openjdk.java.net/jeps/395#Restrictions-on-records + */ + @Test + void record_nestedRecordsAreImplicitlyStatic() { + String s = "\n" + "class X {\n" + " record Point(int x, int y) {\n" + " }\n" + "}\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + RecordDeclaration recordDeclaration = + cu.findAll(RecordDeclaration.class).get(0); + assertFalse(recordDeclaration.hasModifier(Modifier.Keyword.STATIC)); + assertTrue(recordDeclaration.isStatic(), "Nested Records are implicitly static."); + } + + @Test + void record_canBeCreatedUsingKeywordNew() { + String s = "\n" + "\n" + + "record Point(int x, int y) {\n" + + "}\n" + + "\n" + + "class X {\n" + + " public static void main(String[] args) {\n" + + " new Point(10, 3);\n" + + " }\n" + + "}\n\n"; + + CompilationUnit cu = TestParser.parseCompilationUnit(s); + assertOneRecordDeclaration(cu); + + ClassOrInterfaceDeclaration coid = + cu.findAll(ClassOrInterfaceDeclaration.class).get(0); + List objectCreationExprs = coid.findAll(ObjectCreationExpr.class); + + assertEquals(1, objectCreationExprs.size()); + ObjectCreationExpr objectCreationExpr = objectCreationExprs.get(0); + assertEquals("Point", objectCreationExpr.getTypeAsString()); + } + + /** + * Note the Record Declaration Constructor does not include parameters. + * (parameters are, instead, included within the record declaration) + *

+ * https://bugs.openjdk.java.net/browse/JDK-8222777 + */ + @Test + void recordDeclarationFromTheJDK8222777() { + CompilationUnit cu = TestParser.parseCompilationUnit("" + "public record Range(int lo, int hi) {\n" + + "\n" + + " public Range {\n" + + " if (lo > hi) /* referring here to the implicit constructor parameters */\n" + + " throw new IllegalArgumentException(String.format(\"(%d,%d)\", lo, hi));\n" + + " }\n" + + "}"); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertThat(recordDeclaration.getNameAsString()).isEqualTo("Range"); + assertThat(recordDeclaration.getModifiers()).containsExactly(Modifier.publicModifier()); + // test parameters + // get constructor + // test parameters (none) + } + + @Test + void recordDeclaration_exampleFromJls_8_10_4_1_normalCanonicalConstructors() { + CompilationUnit cu = TestParser.parseCompilationUnit("" + "import java.lang.annotation.Target;\n" + + "import java.lang.annotation.ElementType;\n" + + "\n" + + "@interface Foo {}\n" + + "@interface Bar {}\n" + + "\n" + + "record Person(@Foo String name) {\n" + + " Person(String name2) {\n" + + " }\n" + + "}"); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertThat(recordDeclaration.getNameAsString()).isEqualTo("Person"); + assertThat(recordDeclaration.getModifiers()).isEmpty(); + + assertThat(recordDeclaration.getConstructors()).hasSize(1); + assertThat(recordDeclaration.getCompactConstructors()).hasSize(0); + } + + @Test + void compactConstructor_exampleFromJls_8_10_4_2_compactConstructors() { + CompilationUnit cu = TestParser.parseCompilationUnit("" + "record Rational(int num, int denom) {\n" + + " private static int gcd(int a, int b) {\n" + + " if (b == 0) return Math.abs(a);\n" + + " else return gcd(b, a % b);\n" + + " }\n" + + " \n" + + " Rational {\n" + + " int gcd = gcd(num, denom);\n" + + " num /= gcd;\n" + + " denom /= gcd;\n" + + " }\n" + + "}\n"); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertThat(recordDeclaration.getNameAsString()).isEqualTo("Rational"); + assertThat(recordDeclaration.getModifiers()).isEmpty(); + + assertThat(recordDeclaration.getConstructors()).hasSize(0); + assertThat(recordDeclaration.getCompactConstructors()).hasSize(1); + } + + @Test + void nonCompactConstructor_exampleFromJls_8_10_4_2_compactConstructors() { + CompilationUnit cu = TestParser.parseCompilationUnit("" + "record Rational(int num, int denom) {\n" + + " private static int gcd(int a, int b) {\n" + + " if (b == 0) return Math.abs(a);\n" + + " else return gcd(b, a % b);\n" + + " }\n" + + " \n" + + " Rational(int num, int demon) {\n" + + " int gcd = gcd(num, denom);\n" + + " num /= gcd;\n" + + " denom /= gcd;\n" + + " this.num = num;\n" + + " this.denom = denom;\n" + + " }\n" + + "}\n"); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertThat(recordDeclaration.getNameAsString()).isEqualTo("Rational"); + assertThat(recordDeclaration.getModifiers()).isEmpty(); + + assertThat(recordDeclaration.getConstructors()).hasSize(1); + assertThat(recordDeclaration.getCompactConstructors()).hasSize(0); + } + + /** + * https://openjdk.java.net/jeps/395 + */ + @Test + void localRecords() { + CompilationUnit cu = TestParser.parseCompilationUnit("" + "class Scratch {\n" + + " List findTopMerchants(List merchants, int month) {\n" + + " // Local record\n" + + " record MerchantSales(Merchant merchant, double sales) {}\n" + + "\n" + + " return merchants.stream()\n" + + " .map(merchant -> new MerchantSales(merchant, computeSales(merchant, month)))\n" + + " .sorted((m1, m2) -> Double.compare(m2.sales(), m1.sales()))\n" + + " .map(MerchantSales::merchant)\n" + + " .collect(toList());\n" + + " }\n" + + "}\n"); + + RecordDeclaration recordDeclaration = + cu.findFirst(RecordDeclaration.class).get(); + assertThat(recordDeclaration.getNameAsString()).isEqualTo("MerchantSales"); + } + + @Test + void instanceFieldIsNotAllowedInRecord() { + String s = "record X { int record; }"; + + assertThrows(AssertionFailedError.class, () -> { + CompilationUnit cu = TestParser.parseCompilationUnit(s); + }); + } + + private void assertCompilationFails(String s) { + assertThrows(AssertionFailedError.class, () -> { + CompilationUnit cu = TestParser.parseCompilationUnit(s); + }); + } + + private void assertOneRecordDeclaration(CompilationUnit cu) { + List recordDeclarations = cu.findAll(RecordDeclaration.class); + assertEquals(1, recordDeclarations.size()); + } + + private void assertTwoRecordDeclarations(CompilationUnit cu) { + List recordDeclarations = cu.findAll(RecordDeclaration.class); + assertEquals(2, recordDeclarations.size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/TypeDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/TypeDeclarationTest.java new file mode 100644 index 0000000..f7e4874 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/TypeDeclarationTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.body; + +import static com.github.javaparser.utils.TestParser.parseBodyDeclaration; +import static com.github.javaparser.utils.TestParser.parseCompilationUnit; +import static java.util.stream.Collectors.joining; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.Node; +import org.junit.jupiter.api.Test; + +class TypeDeclarationTest { + @Test + void qualifiedNameOfClassInDefaultPackage() { + assertFQN("X", parseCompilationUnit("class X{ }")); + } + + @Test + void qualifiedNameOfClassInAPackage() { + assertFQN("a.b.c.X", parseCompilationUnit("package a.b.c; class X{}")); + } + + @Test + void qualifiedNameOfInterfaceInAPackage() { + assertFQN("a.b.c.X", parseCompilationUnit("package a.b.c; interface X{}")); + } + + @Test + void qualifiedNameOfEnumInAPackage() { + assertFQN("a.b.c.X", parseCompilationUnit("package a.b.c; enum X{}")); + } + + @Test + void qualifiedNameOfAnnotationInAPackage() { + assertFQN("a.b.c.X", parseCompilationUnit("package a.b.c; @interface X{}")); + } + + @Test + void qualifiedNameOfNestedClassInAPackage() { + assertFQN( + "a.b.c.Outer,a.b.c.Outer.Nested", + parseCompilationUnit("package a.b.c; class Outer{ class Nested {} }")); + } + + @Test + void qualifiedNameOfAnonymousClassCantBeQueried() { + assertFQN("X", parseCompilationUnit("class X{ int aaa() {new Object(){};} }")); + } + + @Test + void qualifiedNameOfLocalClassIsEmpty() { + assertFQN("X,?", parseCompilationUnit("class X{ int aaa() {class Local {}} }")); + } + + @Test + void qualifiedNameOfDetachedClassIsEmpty() { + assertFQN("?", parseBodyDeclaration("class X{}")); + } + + void assertFQN(String fqn, Node node) { + assertEquals( + fqn, + node.findAll(TypeDeclaration.class).stream() + .map(td -> (TypeDeclaration) td) + .map(td -> td.getFullyQualifiedName().orElse("?")) + .collect(joining(","))); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/comments/CommentTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/comments/CommentTest.java new file mode 100644 index 0000000..f82084c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/comments/CommentTest.java @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.comments; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.description.JavadocDescription; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.Indentation; +import com.github.javaparser.printer.configuration.Indentation.IndentType; +import com.github.javaparser.printer.configuration.PrinterConfiguration; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class CommentTest { + + private static final PrinterConfiguration PRETTY_PRINTER_CONFIG_TWO_INDENT = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, new Indentation(IndentType.SPACES, 2))); + + @Test + void removeOrphanComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "A"); + Comment c = new LineComment("A comment"); + decl.addOrphanComment(c); + assertEquals(1, decl.getOrphanComments().size()); + assertTrue(c.remove()); + assertEquals(0, decl.getOrphanComments().size()); + } + + @Test + void removeAssociatedComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "A"); + Comment c = new LineComment("A comment"); + decl.setComment(c); + assertTrue(decl.getComment().isPresent()); + assertTrue(c.remove()); + assertFalse(decl.getComment().isPresent()); + } + + @Test + void cannotRemoveCommentNotUsedAnywhere() { + Comment c = new LineComment("A comment"); + assertFalse(c.remove()); + } + + @Test + void unicodeEscapesArePreservedInComments() { + CompilationUnit cu = parse("// xxx\\u2122xxx"); + Comment comment = cu.getAllContainedComments().get(0); + assertEquals(" xxx\\u2122xxx", comment.getContent()); + } + + @Test + void testReplaceDuplicateJavaDocComment() { + // Arrange + CompilationUnit cu = parse("public class MyClass {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void oneMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void anotherMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + MethodDeclaration methodDeclaration = + cu.findFirst(MethodDeclaration.class).get(); + + // Act + Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); + methodDeclaration.setJavadocComment("", javadoc); + + // Assert + assertEqualsStringIgnoringEol( + "public class MyClass {\n" + "\n" + + " /**\n" + + " * Change Javadoc\n" + + " */\n" + + " public void oneMethod() {\n" + + " }\n" + + "\n" + + " /**\n" + + " * Comment A\n" + + " */\n" + + " public void anotherMethod() {\n" + + " }\n" + + "}\n", + cu.toString(PRETTY_PRINTER_CONFIG_TWO_INDENT)); + } + + @Test + void testRemoveDuplicateComment() { + // Arrange + CompilationUnit cu = parse("public class MyClass {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void oneMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void anotherMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + MethodDeclaration methodDeclaration = + cu.findFirst(MethodDeclaration.class).get(); + + // Act + methodDeclaration.removeComment(); + + // Assert + assertEqualsStringIgnoringEol( + "public class MyClass {\n" + "\n" + + " public void oneMethod() {\n" + + " }\n" + + "\n" + + " /**\n" + + " * Comment A\n" + + " */\n" + + " public void anotherMethod() {\n" + + " }\n" + + "}\n", + cu.toString(PRETTY_PRINTER_CONFIG_TWO_INDENT)); + } + + @Test + void testRemoveDuplicateJavaDocComment() { + // Arrange + CompilationUnit cu = parse("public class MyClass {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void oneMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void anotherMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + MethodDeclaration methodDeclaration = + cu.findAll(MethodDeclaration.class).get(1); + + // Act + methodDeclaration.removeJavaDocComment(); + + // Assert + assertEqualsStringIgnoringEol( + "public class MyClass {\n" + "\n" + + " /**\n" + + " * Comment A\n" + + " */\n" + + " public void oneMethod() {\n" + + " }\n" + + "\n" + + " public void anotherMethod() {\n" + + " }\n" + + "}\n", + cu.toString(PRETTY_PRINTER_CONFIG_TWO_INDENT)); + } + + @Test() + void testVerifyOrphanCommentInsertedInEmptyBlock() { + BlockStmt block = new BlockStmt(); + block.addOrphanComment(new LineComment("TODO")); + assertTrue(block.toString().contains("TODO")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ArrayCreationExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ArrayCreationExprTest.java new file mode 100644 index 0000000..0273000 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ArrayCreationExprTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.ArrayCreationLevel; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.type.PrimitiveType; +import org.junit.jupiter.api.Test; + +class ArrayCreationExprTest { + + @Test + void correctlyCreatesExpressionWithDefaultConstructor() { + ArrayCreationExpr expr = new ArrayCreationExpr(); + + assertEquals("new empty[] {}", expr.toString()); + } + + @Test + void correctlyCreatesExpressionWithSimpleConstructor() { + ArrayCreationExpr expr = new ArrayCreationExpr(PrimitiveType.byteType()); + + assertEquals("new byte[] {}", expr.toString()); + } + + @Test + void correctlyCreatesExpressionWithFullConstructor() { + ArrayInitializerExpr initializer = new ArrayInitializerExpr( + new NodeList<>(new IntegerLiteralExpr("1"), new IntegerLiteralExpr("2"), new IntegerLiteralExpr("3"))); + ArrayCreationExpr expr = + new ArrayCreationExpr(PrimitiveType.intType(), new NodeList<>(new ArrayCreationLevel()), initializer); + + assertEquals("new int[] { 1, 2, 3 }", expr.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/AssignExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/AssignExprTest.java new file mode 100644 index 0000000..b29ef82 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/AssignExprTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class AssignExprTest { + @Test + void convertOperator() { + assertEquals( + BinaryExpr.Operator.PLUS, + AssignExpr.Operator.PLUS.toBinaryOperator().get()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/BinaryExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/BinaryExprTest.java new file mode 100644 index 0000000..fe82401 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/BinaryExprTest.java @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.StaticJavaParser; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class BinaryExprTest { + + @Test + void convertOperator() { + assertEquals( + AssignExpr.Operator.PLUS, + BinaryExpr.Operator.PLUS.toAssignOperator().get()); + } + + /** + * Evaluation takes place left to right, with && taking precedence over || + * + * true || false && false || false + * true || (1) || false + * ( 2 ) || false + * ( 3 ) + * + * true || false && false || false + * true || (false) || false + * ( true ) || false + * ( true ) + */ + @Nested + class LogicalOperatorPrecedence { + + @Test + public void logicalAndOr() { + Expression expression = StaticJavaParser.parseExpression("true || false && false || false"); + Expression bracketedExpression = applyBrackets(expression); + + String expected = "(true || (false && false)) || false"; + String actual = bracketedExpression.toString(); + + assertEquals(expected, actual); + } + + @Test + public void logicalOrEvaluationLeftToRight() { + Expression expression = StaticJavaParser.parseExpression("false || true || false || true || false || true"); + Expression bracketedExpression = applyBrackets(expression); + + String expected = "((((false || true) || false) || true) || false) || true"; + String actual = bracketedExpression.toString(); + + assertEquals(expected, actual); + } + + @Test + public void logicalAndEvaluationLeftToRight() { + Expression expression = StaticJavaParser.parseExpression("false && true && false && true && false && true"); + Expression bracketedExpression = applyBrackets(expression); + + String expected = "((((false && true) && false) && true) && false) && true"; + String actual = bracketedExpression.toString(); + + assertEquals(expected, actual); + } + + @Test + public void andTakesPrecedenceOverOr() { + Expression expression = StaticJavaParser.parseExpression("true || false && false"); + Expression bracketedExpression = applyBrackets(expression); + + String expected = "true || (false && false)"; + String actual = bracketedExpression.toString(); + + assertEquals(expected, actual); + } + + @Test + public void andTakesPrecedenceOverOrThenLeftToRight() { + Expression expression = StaticJavaParser.parseExpression("true || false && false || true"); + Expression bracketedExpression = applyBrackets(expression); + + String expected = "(true || (false && false)) || true"; + String actual = bracketedExpression.toString(); + + assertEquals(expected, actual); + } + + @Test + public void example() { + Expression expression = + StaticJavaParser.parseExpression("year % 4 == 0 && year % 100 != 0 || year % 400 == 0"); + Expression bracketedExpression = applyBrackets(expression); + + String expected = "((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)"; + String actual = bracketedExpression.toString(); + + assertEquals(expected, actual); + } + } + + private Expression applyBrackets(Expression expression) { + expression.findAll(BinaryExpr.class).stream() + .filter(binaryExpr -> binaryExpr.getOperator() == BinaryExpr.Operator.AND + || binaryExpr.getOperator() == BinaryExpr.Operator.OR) + .forEach(binaryExpr -> { + if (!binaryExpr.getLeft().isBooleanLiteralExpr()) { + binaryExpr.setLeft(new EnclosedExpr(binaryExpr.getLeft())); + } + if (!binaryExpr.getRight().isBooleanLiteralExpr()) { + binaryExpr.setRight(new EnclosedExpr(binaryExpr.getRight())); + } + }); + + return expression; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/CharLiteralExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/CharLiteralExprTest.java new file mode 100644 index 0000000..2354b31 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/CharLiteralExprTest.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseStart; +import com.github.javaparser.ParserConfiguration; +import org.junit.jupiter.api.Test; + +class CharLiteralExprTest { + @Test + void parseSimpleChar() { + CharLiteralExpr c = parseExpression("'a'"); + assertEquals("a", c.getValue()); + } + + @Test + void parseSimpleEscape() { + CharLiteralExpr c = parseExpression("'\\t'"); + assertEquals("\\t", c.getValue()); + } + + @Test + void parseUnicode() { + CharLiteralExpr c = parseExpression("'Ω'"); + assertEquals("Ω", c.getValue()); + } + + @Test + void parseNumericEscape() { + CharLiteralExpr c = parseExpression("'\\177'"); + assertEquals("\\177", c.getValue()); + } + + @Test + void parseUnicodeEscape() { + CharLiteralExpr c = parseExpression("'\\u03a9'"); + assertEquals("\\u03a9", c.getValue()); + } + + @Test + void parseUnicodeEscapedEscape() { + JavaParser javaParser = new JavaParser(new ParserConfiguration().setPreprocessUnicodeEscapes(true)); + + CharLiteralExpr c = javaParser + .parse(ParseStart.EXPRESSION, provider("'\\u005c''")) + .getResult() + .get() + .asCharLiteralExpr(); + assertEquals("\\'", c.getValue()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/DoubleLiteralExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/DoubleLiteralExprTest.java new file mode 100644 index 0000000..8bb967a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/DoubleLiteralExprTest.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class DoubleLiteralExprTest { + @Test + void test1() { + float x = 0x0.00_00_02p-126f; + DoubleLiteralExpr e = parseExpression("0x0.00_00_02p-126f"); + Assertions.assertEquals(x, e.asDouble()); + } + + @Test + void test2() { + double x = 0x0.000_000_000_000_1p-1_022; + DoubleLiteralExpr e = parseExpression("0x0.000_000_000_000_1p-1_022"); + Assertions.assertEquals(x, e.asDouble()); + } + + @Test + void test3() { + double a = 0x1.p+1; + DoubleLiteralExpr e = parseExpression("0x1.p+1"); + Assertions.assertEquals(a, e.asDouble()); + } + + @Test + void test4() { + double a = 0x.0p0; + DoubleLiteralExpr e = parseExpression("0x.0p0"); + Assertions.assertEquals(a, e.asDouble()); + } + + @Test + void test5() { + double x = 0x0_0.0_0p-1_0; + DoubleLiteralExpr e = parseExpression("0x0_0.0_0p-1_0"); + Assertions.assertEquals(x, e.asDouble()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/InstanceOfExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/InstanceOfExprTest.java new file mode 100644 index 0000000..b263449 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/InstanceOfExprTest.java @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel; +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.utils.TestParser; +import org.junit.jupiter.api.Test; + +/** + * See the following JEPs: "Pattern Matching for instanceof" + *

    + *
  • JDK14 - Preview - https://openjdk.java.net/jeps/305
  • + *
  • JDK15 - Second Preview - https://openjdk.java.net/jeps/375
  • + *
  • JDK16 - Release - https://openjdk.java.net/jeps/395
  • + *
+ * + *
+ * The instanceof grammar is extended accordingly: + * + *
+ *     RelationalExpression:
+ *          ...
+ *          RelationalExpression instanceof ReferenceType
+ *          RelationalExpression instanceof Pattern
+ *
+ *     Pattern:
+ *          ReferenceType Identifier
+ * 
+ *
+ */ +class InstanceOfExprTest { + + @Test + void annotationsOnTheType_patternExpression() { + InstanceOfExpr expr = + TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, "obj instanceof @A @DA String s"); + + assertThat(expr.getType().getAnnotations()) + .containsExactly(new MarkerAnnotationExpr("A"), new MarkerAnnotationExpr("DA")); + } + + @Test + void annotationsOnTheType_finalPatternExpression() { + InstanceOfExpr expr = + TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, "obj instanceof @A final @DA String s"); + + assertThat(expr.getType().getAnnotations()) + .containsExactly(new MarkerAnnotationExpr("A"), new MarkerAnnotationExpr("DA")); + } + + @Test + void annotationsOnTheType_finalPatternExpression_prettyPrinter() { + InstanceOfExpr expr = + TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, "obj instanceof @A final @DA String s"); + + assertEquals("obj instanceof final @A @DA String s", expr.toString()); + } + + @Test + void annotationsOnTheType_referenceTypeExpression() { + InstanceOfExpr expr = TestParser.parseExpression(LanguageLevel.JAVA_14, "obj instanceof @A @DA String"); + + assertThat(expr.getType().getAnnotations()) + .containsExactly(new MarkerAnnotationExpr("A"), new MarkerAnnotationExpr("DA")); + } + + @Test + void instanceOf_patternExpression() { + String x = "obj instanceof String s"; + InstanceOfExpr expr = TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, x); + + assertEquals("obj", expr.getExpression().toString()); + assertEquals("String", expr.getType().asString()); + assertTrue(expr.getPattern().isPresent()); + + PatternExpr patternExpr = expr.getPattern().get(); + assertInstanceOf(TypePatternExpr.class, patternExpr); + TypePatternExpr typePatternExpr = patternExpr.asTypePatternExpr(); + assertEquals("String", typePatternExpr.getType().asString()); + assertEquals("s", typePatternExpr.getName().asString()); + assertFalse(typePatternExpr.isFinal()); + + // + assertTrue(expr.getName().isPresent()); + assertEquals("s", expr.getName().get().asString()); + } + + @Test + void instanceOf_patternExpression_prettyPrinter() { + String x = "obj instanceof String s"; + InstanceOfExpr expr = TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, x); + + assertEquals("obj instanceof String s", expr.toString()); + } + + @Test + void instanceOf_referenceTypeExpression() { + String x = "obj instanceof String"; + InstanceOfExpr expr = TestParser.parseExpression(LanguageLevel.JAVA_14, x); + + assertEquals("obj", expr.getExpression().toString()); + assertEquals(String.class.getSimpleName(), expr.getType().asString()); + assertFalse(expr.getPattern().isPresent()); + + // + assertFalse(expr.getName().isPresent()); + } + + @Test + void instanceOf_finalPatternExpression() { + String x = "obj instanceof final String s"; + InstanceOfExpr expr = TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, x); + + assertEquals("obj", expr.getExpression().toString()); + assertEquals("String", expr.getType().asString()); + assertTrue(expr.getPattern().isPresent()); + + PatternExpr patternExpr = expr.getPattern().get(); + assertInstanceOf(TypePatternExpr.class, patternExpr); + TypePatternExpr typePatternExpr = patternExpr.asTypePatternExpr(); + assertEquals("String", typePatternExpr.getType().asString()); + assertEquals("s", typePatternExpr.getName().asString()); + assertTrue(typePatternExpr.isFinal()); + + // + assertTrue(expr.getName().isPresent()); + assertEquals("s", expr.getName().get().asString()); + } + + @Test + void instanceOf_finalPatternExpression_prettyPrinter() { + String x = "obj instanceof final String s"; + InstanceOfExpr expr = TestParser.parseExpression(LanguageLevel.JAVA_14_PREVIEW, x); + + assertEquals("obj instanceof final String s", expr.toString()); + } + + /* + * resolution / scoping tests? + * + *
+     * {@code
+     * if (!(obj instanceof String s)) {
+     *     .. s.contains(..) ..
+     * } else {
+     *     .. s.contains(..) ..
+     * }
+     * }
+     * 
+ * + * Allowed / in scope: {@code if (obj instanceof String s && s.length() > 5) {..}} + * Not in scope: {@code if (obj instanceof String s || s.length() > 5) {..}} + * + */ + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/LambdaExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/LambdaExprTest.java new file mode 100644 index 0000000..96585b3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/LambdaExprTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseBlock; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.TokenRange; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.type.UnknownType; +import org.junit.jupiter.api.Test; + +class LambdaExprTest { + @Test + void lambdaRange1() { + Expression expression = parseExpression("x -> y"); + assertRange("x", "y", expression); + } + + @Test + void lambdaRange2() { + Expression expression = parseExpression("(x) -> y"); + assertRange("(", "y", expression); + } + + private void assertRange(String startToken, String endToken, Node node) { + TokenRange tokenRange = node.getTokenRange().get(); + assertEquals(startToken, tokenRange.getBegin().asString()); + assertEquals(endToken, tokenRange.getEnd().asString()); + } + + @Test + void getExpressionBody() { + LambdaExpr lambdaExpr = parseExpression("x -> y").asLambdaExpr(); + assertEquals("Optional[y]", lambdaExpr.getExpressionBody().toString()); + } + + @Test + void getNoExpressionBody() { + LambdaExpr lambdaExpr = parseExpression("x -> {y;}").asLambdaExpr(); + assertEquals("Optional.empty", lambdaExpr.getExpressionBody().toString()); + } + + @Test + void oneParameterAndExpressionUtilityConstructor() { + LambdaExpr expr = new LambdaExpr(new Parameter(new UnknownType(), "a"), parseExpression("5")); + assertEquals("a -> 5", expr.toString()); + } + + @Test + void oneParameterAndStatementUtilityConstructor() { + LambdaExpr expr = new LambdaExpr(new Parameter(new UnknownType(), "a"), parseBlock("{return 5;}")); + assertEqualsStringIgnoringEol("a -> {\n return 5;\n}", expr.toString()); + } + + @Test + void multipleParametersAndExpressionUtilityConstructor() { + LambdaExpr expr = new LambdaExpr( + new NodeList<>(new Parameter(new UnknownType(), "a"), new Parameter(new UnknownType(), "b")), + parseExpression("5")); + assertEquals("(a, b) -> 5", expr.toString()); + } + + @Test + void multipleParametersAndStatementUtilityConstructor() { + LambdaExpr expr = new LambdaExpr( + new NodeList<>(new Parameter(new UnknownType(), "a"), new Parameter(new UnknownType(), "b")), + parseBlock("{return 5;}")); + assertEqualsStringIgnoringEol("(a, b) -> {\n return 5;\n}", expr.toString()); + } + + @Test + void zeroParametersAndStatementUtilityConstructor() { + LambdaExpr expr = new LambdaExpr(new NodeList<>(), parseBlock("{return 5;}")); + assertEqualsStringIgnoringEol("() -> {\n return 5;\n}", expr.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/LiteralStringValueExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/LiteralStringValueExprTest.java new file mode 100644 index 0000000..41c92d7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/LiteralStringValueExprTest.java @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.math.BigInteger; +import org.assertj.core.data.Percentage; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("OctalInteger") +class LiteralStringValueExprTest { + + @Test + void trivialLiteralsAreConverted() { + assertThat(new CharLiteralExpr('\t').getValue()).isEqualTo("\\t"); + assertThat(new CharLiteralExpr('\b').getValue()).isEqualTo("\\b"); + assertThat(new CharLiteralExpr('\f').getValue()).isEqualTo("\\f"); + assertThat(new CharLiteralExpr('\r').getValue()).isEqualTo("\\r"); + assertThat(new CharLiteralExpr('\n').getValue()).isEqualTo("\\n"); + assertThat(new CharLiteralExpr('\\').getValue()).isEqualTo("\\\\"); + assertThat(new CharLiteralExpr('\"').getValue()).isEqualTo("\\\""); + + assertThat(new IntegerLiteralExpr("0B0").asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr("0b0").asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr("0X0").asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr("0x0").asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr(0).asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr(00).asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr(0B0).asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr(0b0).asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr(0X0).asInt()).isEqualTo(0); + assertThat(new IntegerLiteralExpr(0x0).asInt()).isEqualTo(0); + + assertThat(new LongLiteralExpr("0B0L").asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr("0b0L").asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr("0X0L").asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr("0x0L").asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr(0L).asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr(00L).asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr(0B0L).asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr(0b0L).asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr(0X0L).asLong()).isEqualTo(0); + assertThat(new LongLiteralExpr(0x0L).asLong()).isEqualTo(0); + + assertThat(new DoubleLiteralExpr("0.0f").asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr("0.0F").asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr("0.0d").asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr("0.0D").asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr(0.0F).asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr(0.0f).asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr(0.0D).asDouble()).isEqualTo(0.0); + assertThat(new DoubleLiteralExpr(0.0d).asDouble()).isEqualTo(0.0); + } + + @Test + void lowerAndUpperBoundIntegersAreConverted() { + IntegerLiteralExpr dec = parseExpression("2147483647"); + IntegerLiteralExpr posOct = parseExpression("0177_7777_7777"); + IntegerLiteralExpr negOct = parseExpression("0377_7777_7777"); + IntegerLiteralExpr posHex = parseExpression("0x7fff_ffff"); + IntegerLiteralExpr negHex = parseExpression("0xffff_ffff"); + IntegerLiteralExpr posBin = parseExpression("0b0111_1111_1111_1111_1111_1111_1111_1111"); + IntegerLiteralExpr negBin = parseExpression("0b1000_0000_0000_0000_0000_0000_0000_0000"); + + assertThat(dec.asInt()).isEqualTo(2147483647); + assertThat(posOct.asInt()).isEqualTo(2147483647); // 0177_7777_7777 + assertThat(negOct.asInt()).isEqualTo(-1); // 0377_7777_7777 + assertThat(posHex.asInt()).isEqualTo(0x7fff_ffff); + assertThat(negHex.asInt()).isEqualTo(0xffff_ffff); + assertThat(posBin.asInt()).isEqualTo(0b0111_1111_1111_1111_1111_1111_1111_1111); + assertThat(negBin.asInt()).isEqualTo(0b1000_0000_0000_0000_0000_0000_0000_0000); + } + + @Test + void negativeLiteralValues() { + UnaryExpr unaryIntExpr = parseExpression("-2147483648"); // valid, Integer.MIN_VALUE + IntegerLiteralExpr literalIntExpr = (IntegerLiteralExpr) unaryIntExpr.getExpression(); + IntegerLiteralExpr notValidIntExpr = parseExpression("2147483648"); // not valid + + UnaryExpr unaryLongExpr = parseExpression("-9223372036854775808L"); // valid, Long.MIN_VALUE + LongLiteralExpr literalLongExpr = (LongLiteralExpr) unaryLongExpr.getExpression(); + LongLiteralExpr notValidLongExpr = parseExpression("9223372036854775808L"); // not valid + + assertThat(literalIntExpr.asNumber()).isEqualTo(2147483648L); + assertThat(literalLongExpr.asNumber()).isEqualTo(new BigInteger("9223372036854775808")); + + assertThatThrownBy(notValidIntExpr::asNumber).isInstanceOf(NumberFormatException.class); + assertThatThrownBy(notValidLongExpr::asNumber).isInstanceOf(NumberFormatException.class); + } + + @Test + void lowerAndUpperBoundLongsAreConverted() { + LongLiteralExpr dec = parseExpression("9223372036854775807L"); + LongLiteralExpr posOct = parseExpression("07_7777_7777_7777_7777_7777L"); + LongLiteralExpr negOct = parseExpression("010_0000_0000_0000_0000_0000L"); + LongLiteralExpr posHex = parseExpression("0x7fff_ffff_ffff_ffffL"); + LongLiteralExpr negHex = parseExpression("0xffff_ffff_ffff_ffffL"); + LongLiteralExpr posBin = + parseExpression("0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L"); + LongLiteralExpr negBin = + parseExpression("0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000L"); + + assertThat(dec.asLong()).isEqualTo(9223372036854775807L); + assertThat(posOct.asLong()).isEqualTo(9223372036854775807L); // 07_7777_7777_7777_7777_7777L + assertThat(negOct.asLong()).isEqualTo(-9223372036854775808L); // 010_0000_0000_0000_0000_0000L + assertThat(posHex.asLong()).isEqualTo(0x7fff_ffff_ffff_ffffL); + assertThat(negHex.asLong()).isEqualTo(0xffff_ffff_ffff_ffffL); + assertThat(posBin.asLong()) + .isEqualTo(0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L); + assertThat(negBin.asLong()) + .isEqualTo(0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000L); + } + + @Test + void charLiteralsAreConverted() { + CharLiteralExpr a = parseExpression("'a'"); + CharLiteralExpr percent = parseExpression("'%'"); + CharLiteralExpr tab = parseExpression("'\\t'"); + CharLiteralExpr newLine = parseExpression("'\\n'"); + CharLiteralExpr slash = parseExpression("'\\\\'"); + CharLiteralExpr quote = parseExpression("'\\''"); + CharLiteralExpr omega = parseExpression("'\\u03a9'"); + CharLiteralExpr unicode = parseExpression("'\\uFFFF'"); + CharLiteralExpr ascii = parseExpression("'\\177'"); + CharLiteralExpr trademark = parseExpression("'™'"); + + assertThat(a.asChar()).isEqualTo('a'); + assertThat(percent.asChar()).isEqualTo('%'); + assertThat(tab.asChar()).isEqualTo('\t'); + assertThat(newLine.asChar()).isEqualTo('\n'); + assertThat(slash.asChar()).isEqualTo('\\'); + assertThat(quote.asChar()).isEqualTo('\''); + assertThat(omega.asChar()).isEqualTo('\u03a9'); + assertThat(unicode.asChar()).isEqualTo('\uFFFF'); + assertThat(ascii.asChar()).isEqualTo('\177'); + assertThat(trademark.asChar()).isEqualTo('™'); + } + + @Test + void lowerAndUpperBoundDoublesAreConverted() { + DoubleLiteralExpr posFloat = parseExpression("3.4028235e38f"); + DoubleLiteralExpr negFloat = parseExpression("1.40e-45f"); + DoubleLiteralExpr posDouble = parseExpression("1.7976931348623157e308"); + DoubleLiteralExpr negDouble = parseExpression("4.9e-324"); + DoubleLiteralExpr posHexFloat = parseExpression("0x1.fffffffffffffp1023"); + DoubleLiteralExpr negHexFloat = parseExpression("0x0.0000000000001P-1022"); + + assertThat(posFloat.asDouble()).isCloseTo(3.4028235e38f, Percentage.withPercentage(1)); + assertThat(negFloat.asDouble()).isCloseTo(1.40e-45f, Percentage.withPercentage(1)); + assertThat(posDouble.asDouble()).isEqualTo(1.7976931348623157e308); + assertThat(negDouble.asDouble()).isEqualTo(4.9e-324); + assertThat(posHexFloat.asDouble()).isEqualTo(0x1.fffffffffffffp1023); + assertThat(negHexFloat.asDouble()).isEqualTo(0x0.0000000000001P-1022); + } + + @Test + void specialCharactersInStringsAreEscaped() { + assertThat(new StringLiteralExpr("\n").getValue()).isEqualTo("\\n"); + assertThat(new StringLiteralExpr("\r").getValue()).isEqualTo("\\r"); + assertThat(new StringLiteralExpr("").setEscapedValue("\n").getValue()).isEqualTo("\\n"); + assertThat(new StringLiteralExpr("").setEscapedValue("\r").getValue()).isEqualTo("\\r"); + assertThat(new StringLiteralExpr("").setEscapedValue("\n").asString()).isEqualTo("\n"); + assertThat(new StringLiteralExpr("").setEscapedValue("\r").asString()).isEqualTo("\r"); + assertThat(new StringLiteralExpr("Hello\nWorld\rHello\"World\'").asString()) + .isEqualTo("Hello\nWorld\rHello\"World\'"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/MethodCallExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/MethodCallExprTest.java new file mode 100644 index 0000000..514838a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/MethodCallExprTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static java.util.Optional.empty; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class MethodCallExprTest { + + @Test + void replaceLambdaIssue1290() { + MethodCallExpr methodCallExpr = + parseExpression("callSomeFun(r -> r instanceof SomeType)").asMethodCallExpr(); + LambdaExpr lambdaExpr = methodCallExpr.getArgument(0).asLambdaExpr(); + MethodCallExpr lambdaWrapper = new MethodCallExpr("lambdaWrapper"); + lambdaExpr.replace(lambdaWrapper); + + assertEquals(2, methodCallExpr.getChildNodes().size()); + assertEquals(empty(), lambdaExpr.getParentNode()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/MethodReferenceExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/MethodReferenceExprTest.java new file mode 100644 index 0000000..13597ea --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/MethodReferenceExprTest.java @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.utils.TestUtils.assertExpressionValid; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.junit.jupiter.api.Test; + +class MethodReferenceExprTest { + + @Test + void methodReferenceExprHasAlwaysAScope() { + assertNotNull(new MethodReferenceExpr().getScope()); + } + + @Test + void reference1() { + assertExpressionValid("String::length"); + } + + @Test + void reference2() { + assertExpressionValid("System::currentTimeMillis // static method"); + } + + @Test + void reference3() { + assertExpressionValid("List::size // explicit type arguments for generic type"); + } + + @Test + void reference4() { + assertExpressionValid("List::size // inferred type arguments for generic type"); + } + + @Test + void reference5() { + assertExpressionValid("int[]::clone"); + } + + @Test + void reference6() { + assertExpressionValid("T::tvarMember"); + } + + @Test + void reference7() { + assertExpressionValid("System.out::println"); + } + + @Test + void reference8() { + assertExpressionValid("\"abc\"::length"); + } + + @Test + void reference9() { + assertExpressionValid("foo[x]::bar"); + } + + @Test + void reference10() { + assertExpressionValid("(test ? list.replaceAll(String::trim) : list) :: iterator"); + } + + @Test + void reference10Annotated1() { + assertExpressionValid("(test ? list.replaceAll(@A String::trim) : list) :: iterator"); + } + + @Test + void reference11() { + assertExpressionValid("String::valueOf // overload resolution needed"); + } + + @Test + void reference12() { + assertExpressionValid("Arrays::sort // type arguments inferred from context"); + } + + @Test + void reference13() { + assertExpressionValid("Arrays::sort // explicit type arguments"); + } + + @Test + void reference14() { + assertExpressionValid("ArrayList::new // constructor for parameterized type"); + } + + @Test + void reference15() { + assertExpressionValid("ArrayList::new // inferred type arguments"); + } + + @Test + void reference16() { + assertExpressionValid("Foo::new // explicit type arguments"); + } + + @Test + void reference17() { + assertExpressionValid("Bar::new // generic class, generic constructor"); + } + + @Test + void reference18() { + assertExpressionValid("Outer.Inner::new // inner class constructor"); + } + + @Test + void reference19() { + assertExpressionValid("int[]::new // array creation"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/NameTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/NameTest.java new file mode 100644 index 0000000..3194a7b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/NameTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.*; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.printer.ConcreteSyntaxModel; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class NameTest { + + @Test + void outerNameExprIsTheRightMostIdentifier() { + Name name = parseName("a.b.c"); + assertEquals("c", name.getIdentifier()); + } + + @Test + void parsingAndUnparsingWorks() { + Name name = parseName("a.b.c"); + assertEquals("a.b.c", name.asString()); + } + + @Test + void parsingEmptyNameThrowsException() { + assertThrows(ParseProblemException.class, () -> parseName("")); + } + + @Test + void importName() { + ImportDeclaration importDeclaration = parseImport("import java.util.List;"); + + assertEquals("import java.util.List;" + LineSeparator.SYSTEM, importDeclaration.toString()); + assertEquals("import java.util.List;", ConcreteSyntaxModel.genericPrettyPrint(importDeclaration)); + } + + @Test + void packageName() { + CompilationUnit cu = parse("package p1.p2;"); + + assertEquals("package p1.p2;" + LineSeparator.SYSTEM + LineSeparator.SYSTEM, cu.toString()); + assertEquals( + "package p1.p2;" + LineSeparator.SYSTEM + LineSeparator.SYSTEM, + ConcreteSyntaxModel.genericPrettyPrint(cu)); + } + + @Test + void isInternalNegative() { + Name name = parseName("a.b.c"); + assertFalse(name.isInternal()); + } + + @Test + void isInternalPositive() { + Name name = parseName("a.b.c"); + assertTrue(name.getQualifier().get().isInternal()); + assertTrue(name.getQualifier().get().getQualifier().get().isInternal()); + } + + @Test + void isTopLevelNegative() { + Name name = parseName("a.b.c"); + assertFalse(name.getQualifier().get().isTopLevel()); + assertFalse(name.getQualifier().get().getQualifier().get().isTopLevel()); + } + + @Test + void isTopLevelPositive() { + Name name = parseName("a.b.c"); + assertTrue(name.isTopLevel()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ObjectCreationExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ObjectCreationExprTest.java new file mode 100644 index 0000000..ffbc597 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ObjectCreationExprTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.utils.TestParser; +import org.junit.jupiter.api.Test; + +class ObjectCreationExprTest { + @Test + void aaa() { + Expression e = TestParser.parseExpression("new @Test N()"); + assertEquals("new @Test N()", e.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/PatternExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/PatternExprTest.java new file mode 100644 index 0000000..76c3ec8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/PatternExprTest.java @@ -0,0 +1,122 @@ +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import java.util.function.Consumer; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +/** + * This class exists to test the generated methods for the various Pattern expression + * types. Actual pattern functionality is tested in the context of instanceof expressions + * or switch entries. + */ +public class PatternExprTest { + + private static final ParserConfiguration.LanguageLevel storedLanguageLevel = + StaticJavaParser.getParserConfiguration().getLanguageLevel(); + + @BeforeAll + public static void setLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + } + + @AfterAll + public static void resetLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(storedLanguageLevel); + } + + class TestConsumer implements Consumer { + public boolean isConsumed = false; + + @Override + public void accept(T t) { + isConsumed = true; + } + } + + @Test + public void patternGeneratedMethodsShouldWork() { + Expression expr = parseExpression("x instanceof Foo f"); + + assertTrue(expr.isInstanceOfExpr()); + + InstanceOfExpr instanceOfExpr = expr.asInstanceOfExpr(); + + assertTrue(instanceOfExpr.getPattern().isPresent()); + PatternExpr pattern = instanceOfExpr.getPattern().get(); + assertTrue(pattern.isPatternExpr()); + assertTrue(pattern.isTypePatternExpr()); + assertInstanceOf(PatternExpr.class, pattern.asPatternExpr()); + assertInstanceOf(TypePatternExpr.class, pattern.asTypePatternExpr()); + + assertFalse(instanceOfExpr.isPatternExpr()); + assertFalse(instanceOfExpr.isTypePatternExpr()); + + assertThrows(IllegalStateException.class, () -> instanceOfExpr.asPatternExpr()); + assertThrows(IllegalStateException.class, () -> instanceOfExpr.asTypePatternExpr()); + + TestConsumer validPattern = new TestConsumer<>(); + pattern.ifPatternExpr(validPattern); + assertTrue(validPattern.isConsumed); + + TestConsumer validTypePattern = new TestConsumer<>(); + pattern.ifTypePatternExpr(validTypePattern); + assertTrue(validTypePattern.isConsumed); + + TestConsumer invalidPattern = new TestConsumer<>(); + instanceOfExpr.ifPatternExpr(invalidPattern); + assertFalse(invalidPattern.isConsumed); + + TestConsumer invalidTypePattern = new TestConsumer<>(); + instanceOfExpr.ifTypePatternExpr(invalidTypePattern); + assertFalse(invalidTypePattern.isConsumed); + } + + @Test + public void recordPatternGeneratedMethodsShouldWork() { + Expression expr = parseExpression("x instanceof Foo(Bar b)"); + + assertTrue(expr.isInstanceOfExpr()); + + InstanceOfExpr instanceOfExpr = expr.asInstanceOfExpr(); + + assertTrue(instanceOfExpr.getPattern().isPresent()); + PatternExpr pattern = instanceOfExpr.getPattern().get(); + + assertTrue(pattern.isRecordPatternExpr()); + assertTrue(pattern.toRecordPatternExpr().isPresent()); + RecordPatternExpr recordPattern = pattern.asRecordPatternExpr(); + + NodeList newModifiers = new NodeList<>(); + Modifier newModifier = new Modifier(); + newModifiers.add(newModifier); + recordPattern.setModifiers(newModifiers); + assertEquals(newModifiers, recordPattern.getModifiers()); + + recordPattern.replace(newModifier, newModifier); + assertEquals(newModifiers, recordPattern.getModifiers()); + + recordPattern.remove(newModifier); + assertTrue(recordPattern.getModifiers().isEmpty()); + + TestConsumer validPattern = new TestConsumer<>(); + pattern.ifRecordPatternExpr(validPattern); + assertTrue(validPattern.isConsumed); + + NodeList patternList = recordPattern.getPatternList(); + assertTrue(patternList.isNonEmpty()); + + recordPattern.replace(patternList.get(0), patternList.get(0)); + assertTrue(patternList.isNonEmpty()); + + RecordPatternExpr newRecordPattern = recordPattern.clone(); + assertEquals(recordPattern.getTypeAsString(), newRecordPattern.getTypeAsString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SimpleNameTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SimpleNameTest.java new file mode 100644 index 0000000..047ce56 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SimpleNameTest.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseSimpleName; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class SimpleNameTest { + + @Test + void defaultConstructorSetsIdentifierToEmpty() { + assertEquals("empty", new SimpleName().getIdentifier()); + } + + @Test + void identifierMustNotBeEmpty() { + assertThrows(AssertionError.class, () -> new SimpleName("")); + } + + @Test + void identifierMustNotBeNull() { + assertThrows(AssertionError.class, () -> new SimpleName(null)); + } + + @Test + void unicodeEscapesArePreservedInIdentifiers() { + SimpleName name = parseSimpleName("xxx\\u2122xxx"); + assertEquals("xxx\\u2122xxx", name.asString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/StringLiteralExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/StringLiteralExprTest.java new file mode 100644 index 0000000..7d31e35 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/StringLiteralExprTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class StringLiteralExprTest { + @Test + void unicodeEscapesArePreservedInStrings() { + StringLiteralExpr omega = parseExpression("\"xxx\\u03a9xxx\""); + assertEquals("xxx\\u03a9xxx", omega.getValue()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java new file mode 100644 index 0000000..82ab176 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.ParseProblemException; +import org.junit.jupiter.api.Test; + +class SuperExprTest { + @Test + void justSuper() { + assertThrows(ParseProblemException.class, () -> parseExpression("super")); + } + + @Test + void singleScopeSuper() { + Expression expr = parseExpression("A.super"); + + Name className = expr.asSuperExpr().getTypeName().get(); + + assertEquals("A", className.asString()); + } + + @Test + void multiScopeSuper() { + Expression expr = parseExpression("a.B.super"); + + Name className = expr.asSuperExpr().getTypeName().get(); + + assertEquals("a.B", className.asString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SwitchExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SwitchExprTest.java new file mode 100644 index 0000000..e6016c6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SwitchExprTest.java @@ -0,0 +1,483 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.ast.stmt.SwitchEntry.Type.*; +import static com.github.javaparser.utils.TestParser.*; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.Range; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.SwitchEntry; +import com.github.javaparser.ast.stmt.SwitchStmt; +import com.github.javaparser.resolution.Navigator; +import org.junit.jupiter.api.Test; + +class SwitchExprTest { + @Test + void jep325Example2() { + NodeList entry2labels = parseStatement( + "int numLetters = switch (day) {\n" + " case MONDAY, FRIDAY, SUNDAY -> 6;\n" + + " case TUESDAY -> 7;\n" + + " case THURSDAY, SATURDAY -> 8;\n" + + " case WEDNESDAY -> 9;\n" + + "};") + .findAll(SwitchEntry.class) + .get(0) + .getLabels(); + + assertEquals(3, entry2labels.size()); + assertEquals("MONDAY", entry2labels.get(0).toString()); + assertEquals("FRIDAY", entry2labels.get(1).toString()); + assertEquals("SUNDAY", entry2labels.get(2).toString()); + } + + @Test + void funkyExpressions() { + parseStatement("int numLetters = switch (day) {\n" + " case 1+1, 2+2 -> 6;\n" + + " case \"Henk\"-> 7;\n" + + " case ((3)+3)+3 -> 8;\n" + + "};"); + } + + @Test + void jep325Example3() { + parseBodyDeclaration("static void howMany(int k) {\n" + " switch (k) {\n" + + " case 1 -> System.out.println(\"one\");\n" + + " case 2 -> System.out.println(\"two\");\n" + + " case 3 -> System.out.println(\"many\");\n" + + " }\n" + + "}"); + } + + @Test + void aThrowStatement() { + SwitchExpr switchExpr = parseExpression( + "switch (k) {\n" + " case 1 -> throw new Exception(\"one\");\n" + " }") + .findFirst(SwitchExpr.class) + .get(); + + assertEquals(THROWS_STATEMENT, switchExpr.getEntry(0).getType()); + } + + @Test + void jep325Example4() { + SwitchExpr switchExpr = parseStatement("T result = switch (arg) {\n" + " case L1 -> e1;\n" + + " case L2 -> e2;\n" + + " default -> e3;\n" + + "};") + .findFirst(SwitchExpr.class) + .get(); + + assertEquals(EXPRESSION, switchExpr.getEntry(0).getType()); + } + + @Test + void jep325Example5() { + SwitchExpr switchExpr = parseStatement("int j = switch (day) {\n" + " case MONDAY -> 0;\n" + + " case TUESDAY -> 1;\n" + + " default -> {\n" + + " int k = day.toString().length();\n" + + " int result = f(k);\n" + + " yield result;\n" + + " }\n" + + "};") + .findFirst(SwitchExpr.class) + .get(); + + assertEquals(BLOCK, switchExpr.getEntry(2).getType()); + assertEquals( + BlockStmt.class, switchExpr.getEntry(2).getStatements().get(0).getClass()); + } + + @Test + void jep325Example6() { + parseStatement("int result = switch (s) {\n" + " case \"Foo\": \n" + + " yield 1;\n" + + " case \"Bar\":\n" + + " yield 2;\n" + + " default:\n" + + " System.out.println(\"Neither Foo nor Bar, hmmm...\");\n" + + " yield 0;\n" + + "};"); + } + + @Test + void yieldMethodCall() { + parseStatement("int randomNumber = switch (5) {\n" + " default -> {\n" + + " yield a.randomNumberGenerator();\n" + + " }\n" + + " case 1 -> {\n" + + " yield method();\n" + + " }\n" + + " case 2 -> {\n" + + " yield method(args);\n" + + " }\n" + + " case 3 -> {\n" + + " yield this.method();\n" + + " }\n" + + " case 4 -> {\n" + + " yield Clazz.this.method(args);\n" + + " }\n" + + "};"); + } + + @Test + void yieldExpression1() { + parseStatement("int randomNumber = switch (5) {\n" + " default -> {\n" + + " yield 1 * 1;\n" + + " }\n" + + " case 1 -> {\n" + + " yield (5 + 5);\n" + + " }\n" + + " case 2 -> {\n" + + " yield (5 + 5) * 3;\n" + + " }\n" + + "};"); + } + + @Test + void yieldExpression2() { + parseStatement("boolean b = switch (5) {\n" + " case 3 -> {\n" + + " yield true || false;\n" + + " }\n" + + " default -> {\n" + + " yield !true;\n" + + " }\n" + + "};"); + } + + @Test + void yieldAssignment() { + parseStatement("int randomNumber = switch (5) {\n" + " default -> {\n" + + " int x;\n" + + " yield (x = 5);\n" + + " }\n" + + " case 'a' -> {\n" + + " int x;\n" + + " yield x = 3;\n" + + " }\n" + + "};"); + } + + @Test + void yieldConditional() { + parseStatement("int randomNumber = switch (5) {\n" + " default -> {\n" + + " yield x ? 1 : 2;\n" + + " }\n" + + " case 1 -> {\n" + + " yield (x ? 1 : 2);\n" + + " }\n" + + " case 2 -> {\n" + + " yield x < 0 ? 0 : x > y ? y : x;\n" + + " }\n" + + "};"); + } + + @Test + void yieldYield() { + parseStatement("yield = switch (yield) {\n" + " default -> {\n" + + " yield yield;\n" + + " }\n" + + " case yield -> {\n" + + " yield Clazz.yield();\n" + + " }\n" + + " case enumValue2 -> {\n" + + " yield yield = yield;\n" + + " }\n" + + " case enumValue3 -> {\n" + + " yield yield == yield ? yield : yield;\n" + + " }\n" + + "};"); + } + + @Test + void switchPattern() { + SwitchStmt stmt = parseStatement("switch (value) {\n" + " case Box b -> System.out.println(b);\n" + "}") + .asSwitchStmt(); + + assertEquals(1, stmt.getEntries().size()); + + SwitchEntry entry = stmt.getEntry(0); + assertFalse(entry.getGuard().isPresent()); + + assertEquals(1, entry.getLabels().size()); + + TypePatternExpr label = entry.getLabels().get(0).asTypePatternExpr(); + + assertEquals("b", label.getNameAsString()); + assertEquals("Box", label.getTypeAsString()); + } + + @Test + void switchPatternWithGuard() { + SwitchExpr expr = parseExpression( + "switch (value) {\n" + " case Box b when b.nonEmpty() -> b.get() + 12;\n" + "}") + .asSwitchExpr(); + + assertEquals(1, expr.getEntries().size()); + + SwitchEntry entry = expr.getEntry(0); + assertTrue(entry.getGuard().isPresent()); + + Expression guard = entry.getGuard().get(); + assertInstanceOf(MethodCallExpr.class, guard); + + assertEquals(1, entry.getLabels().size()); + TypePatternExpr label = entry.getLabels().get(0).asTypePatternExpr(); + + assertEquals("b", label.getNameAsString()); + assertEquals("Box", label.getTypeAsString()); + + assertEquals("b.get() + 12;", entry.getStatements().get(0).toString()); + } + + @Test + void testRemoveGuard() { + SwitchExpr expr = parseExpression("switch (value) {\n" + " case Box b when b.nonEmpty() -> {}\n" + "}") + .asSwitchExpr(); + + SwitchEntry entry = expr.getEntry(0); + + assertTrue(entry.getGuard().isPresent()); + + entry.removeGuard(); + + assertFalse(entry.getGuard().isPresent()); + + assertFalse(Navigator.findNameExpression(entry, "b").isPresent()); + } + + @Test + void testRemoveWithGuard() { + SwitchExpr expr = parseExpression("switch (value) {\n" + " case Box b when b.nonEmpty() -> {}\n" + "}") + .asSwitchExpr(); + + SwitchEntry entry = expr.getEntry(0); + + assertTrue(entry.getGuard().isPresent()); + + entry.remove(entry.getGuard().get()); + + assertFalse(entry.getGuard().isPresent()); + + assertFalse(Navigator.findNameExpression(entry, "b").isPresent()); + } + + @Test + void testRecordPattern() { + SwitchExpr expr = parseExpression( + "switch (value) {\n" + " case TwoBox (String s, Box(Integer i)) -> {}\n" + "}") + .asSwitchExpr(); + + SwitchEntry entry = expr.getEntry(0); + + assertTrue(entry.getLabels().get(0).isRecordPatternExpr()); + + RecordPatternExpr recordPattern = entry.getLabels().get(0).asRecordPatternExpr(); + + assertEquals("TwoBox", recordPattern.getTypeAsString()); + + assertEquals(2, recordPattern.getPatternList().size()); + + assertTrue(recordPattern.getPatternList().get(0).isTypePatternExpr()); + TypePatternExpr stringPattern = recordPattern.getPatternList().get(0).asTypePatternExpr(); + assertEquals("String", stringPattern.getTypeAsString()); + assertEquals("s", stringPattern.getNameAsString()); + + assertTrue(recordPattern.getPatternList().get(1).isRecordPatternExpr()); + RecordPatternExpr boxPattern = recordPattern.getPatternList().get(1).asRecordPatternExpr(); + assertEquals("Box", boxPattern.getTypeAsString()); + + assertEquals(1, boxPattern.getPatternList().size()); + + assertTrue(boxPattern.getPatternList().get(0).isTypePatternExpr()); + TypePatternExpr integerPattern = boxPattern.getPatternList().get(0).asTypePatternExpr(); + assertEquals("Integer", integerPattern.getTypeAsString()); + assertEquals("i", integerPattern.getNameAsString()); + } + + /** + * Credit to @Kimmmey in https://github.com/javaparser/javaparser/issues/4440 for the + * example code. + */ + @Test + void testSwitchExprUnaryMinus() { + Statement stmt = + parseStatement("int i = switch (x) {\n" + " case 0 -> 0;\n" + " default -> -1;\n" + "};"); + + VariableDeclarator declarator = + (VariableDeclarator) stmt.getChildNodes().get(0).getChildNodes().get(0); + SwitchExpr switchExpr = declarator.getInitializer().get().asSwitchExpr(); + + assertEquals("0", switchExpr.getEntry(0).getLabels().get(0).toString()); + assertEquals("0;", switchExpr.getEntry(0).getStatements().get(0).toString()); + + assertTrue(switchExpr.getEntry(1).getLabels().isEmpty()); + assertTrue(switchExpr.getEntry(1).isDefault()); + assertEquals("-1;", switchExpr.getEntry(1).getStatements().get(0).toString()); + } + + /** + * Credit to @Kimmmey in https://github.com/javaparser/javaparser/issues/4440 for the + * example code. + */ + @Test + void testSwitchExprUnaryNot() { + Statement stmt = parseStatement( + "boolean b = switch (x) {\n" + " case 0 -> true;\n" + " default -> !false;\n" + "};"); + + VariableDeclarator declarator = + (VariableDeclarator) stmt.getChildNodes().get(0).getChildNodes().get(0); + SwitchExpr switchExpr = declarator.getInitializer().get().asSwitchExpr(); + + assertEquals("0", switchExpr.getEntry(0).getLabels().get(0).toString()); + assertEquals("true;", switchExpr.getEntry(0).getStatements().get(0).toString()); + + assertTrue(switchExpr.getEntry(1).getLabels().isEmpty()); + assertTrue(switchExpr.getEntry(1).isDefault()); + assertEquals("!false;", switchExpr.getEntry(1).getStatements().get(0).toString()); + } + + /** + * Credit to @Kimmmey in https://github.com/javaparser/javaparser/issues/4440 for the + * example code. + */ + @Test + void testSwitchExprWithBinaryExpr() { + Statement stmt = parseStatement("int i = switch (x) {\n" + " case 1 -> 1;\n" + + " case 2, 3 -> 1 + 2;\n" + + " default -> 1;\n" + + "};"); + + VariableDeclarator declarator = + (VariableDeclarator) stmt.getChildNodes().get(0).getChildNodes().get(0); + SwitchExpr switchExpr = declarator.getInitializer().get().asSwitchExpr(); + + assertEquals("1", switchExpr.getEntry(0).getLabels().get(0).toString()); + assertEquals("1;", switchExpr.getEntry(0).getStatements().get(0).toString()); + + assertEquals("2", switchExpr.getEntry(1).getLabels().get(0).toString()); + assertEquals("3", switchExpr.getEntry(1).getLabels().get(1).toString()); + assertEquals("1 + 2;", switchExpr.getEntry(1).getStatements().get(0).toString()); + + assertTrue(switchExpr.getEntry(2).getLabels().isEmpty()); + assertTrue(switchExpr.getEntry(2).isDefault()); + assertEquals("1;", switchExpr.getEntry(2).getStatements().get(0).toString()); + } + + @Test + void testSwitchExprWithAssignment() { + Statement stmt = parseStatement("{\n" + " int z;\n" + + " int i = switch (x) {\n" + + " case 1 -> z = 1;\n" + + " default -> 1;\n" + + " };\n" + + "}"); + + VariableDeclarator declarator = (VariableDeclarator) stmt.getChildNodes() + .get(1) + .getChildNodes() + .get(0) + .getChildNodes() + .get(0); + SwitchExpr switchExpr = declarator.getInitializer().get().asSwitchExpr(); + + assertEquals("1", switchExpr.getEntry(0).getLabels().get(0).toString()); + assertEquals("z = 1;", switchExpr.getEntry(0).getStatements().get(0).toString()); + + assertTrue(switchExpr.getEntry(1).getLabels().isEmpty()); + assertTrue(switchExpr.getEntry(1).isDefault()); + assertEquals("1;", switchExpr.getEntry(1).getStatements().get(0).toString()); + } + + @Test + void issue4455Test() { + SwitchExpr switchExpr = parseExpression( + "switch (column) {\n" + " case CustomDeployTableModel.ARTIFACT_NAME -> {}\n" + "}") + .asSwitchExpr(); + + assertEquals(Node.Parsedness.PARSED, switchExpr.getParsed()); + + SwitchEntry entry = switchExpr.getEntry(0); + Expression switchLabel = entry.getLabels().get(0); + + assertEquals("CustomDeployTableModel.ARTIFACT_NAME", switchLabel.toString()); + assertTrue(switchLabel.isFieldAccessExpr()); + assertTrue(switchLabel.getRange().isPresent()); + + Range switchLabelRange = switchLabel.getRange().get(); + assertEquals(2, switchLabelRange.begin.line); + assertEquals(10, switchLabelRange.begin.column); + assertEquals(2, switchLabelRange.end.line); + assertEquals(45, switchLabelRange.end.column); + } + + @Test + void switchExprWithoutTokensStored() { + ParserConfiguration config = new ParserConfiguration(); + config.setStoreTokens(false); + config.setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + JavaParser parser = new JavaParser(config); + + ParseResult result = + parser.parseExpression("switch (o) {\n" + " case Foo f -> f.get();\n" + "}"); + + assertTrue(result.isSuccessful()); + assertTrue(result.getProblems().isEmpty()); + + SwitchEntry entry = result.getResult().get().getEntry(0); + assertEquals("Foo f", entry.getLabels().get(0).toString()); + assertEquals("f.get();", entry.getStatements().get(0).toString()); + } + + @Test + void testRecordPatternWithPrimitiveType() { + SwitchExpr switchExpr = + parseExpression("switch (foo) { case Foo(int x) -> sink(x); }").asSwitchExpr(); + + assertEquals(Node.Parsedness.PARSED, switchExpr.getParsed()); + + SwitchEntry entry = switchExpr.getEntry(0); + Expression switchLabel = entry.getLabels().get(0); + + assertEquals("Foo(int x)", switchLabel.toString()); + assertTrue(switchLabel.isRecordPatternExpr()); + + RecordPatternExpr recordPattern = switchLabel.asRecordPatternExpr(); + + assertEquals("Foo", recordPattern.getType().toString()); + assertEquals(1, recordPattern.getPatternList().size()); + assertTrue(recordPattern.getPatternList().get(0).isTypePatternExpr()); + + TypePatternExpr innerType = recordPattern.getPatternList().get(0).asTypePatternExpr(); + + assertTrue(innerType.getType().isPrimitiveType()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/TextBlockLiteralExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/TextBlockLiteralExprTest.java new file mode 100644 index 0000000..3f6b7f3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/TextBlockLiteralExprTest.java @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.utils.TestParser.parseStatement; +import static java.util.Arrays.asList; +import static java.util.stream.Collectors.toList; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class TextBlockLiteralExprTest { + @Test + void htmlExample() { + TextBlockLiteralExpr textBlock = parseStatement("String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + " \"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals( + " \n" + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + " ", + textBlock.getValue()); + + assertEquals( + asList("", " ", "

Hello, world

", " ", "", ""), + textBlock.stripIndentOfLines().collect(toList())); + + assertEquals( + "\n" + " \n" + "

Hello, world

\n" + " \n" + "\n", + textBlock.stripIndent()); + + assertEquals( + "\n" + " \n" + "

Hello, world

\n" + " \n" + "\n", + textBlock.translateEscapes()); + } + + @Test + void htmlExampleWithEndAllToTheLeft() { + TextBlockLiteralExpr textBlock = parseStatement("String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + "\"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals( + " \n" + " \n" + + "

Hello, world

\n" + + " \n" + + " \n", + textBlock.translateEscapes()); + } + + @Test + void htmlExampleWithEndALittleToTheLeft() { + TextBlockLiteralExpr textBlock = parseStatement("String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + " \"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals( + " \n" + " \n" + + "

Hello, world

\n" + + " \n" + + " \n", + textBlock.translateEscapes()); + } + + @Test + void htmlExampleWithEndALittleToTheRight() { + TextBlockLiteralExpr textBlock = parseStatement("String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + " \"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals( + "\n" + " \n" + "

Hello, world

\n" + " \n" + "\n", + textBlock.translateEscapes()); + } + + @Test + void itIsLegalToUseDoubleQuoteFreelyInsideATextBlock() { + parseStatement("String story = \"\"\"\n" + " \"When I use a word,\" Humpty Dumpty said,\n" + + " in rather a scornful tone, \"it means just what I\n" + + " choose it to mean - neither more nor less.\"\n" + + " \"The question is,\" said Alice, \"whether you\n" + + " can make words mean so many different things.\"\n" + + " \"The question is,\" said Humpty Dumpty,\n" + + " \"which is to be master - that's all.\"\n" + + " \"\"\";"); + } + + @Test + void sequencesOfThreeDoubleQuotesNeedAtLeastOneEscaped() { + TextBlockLiteralExpr textBlock = parseStatement("String code = \n" + " \"\"\"\n" + + " String text = \\\"\"\"\n" + + " A text block inside a text block\n" + + " \\\"\"\";\n" + + " \"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals( + "String text = \"\"\"\n" + " A text block inside a text block\n" + "\"\"\";\n", + textBlock.translateEscapes()); + } + + @Test + void concatenatingTextBlocks() { + parseStatement("String code = \"public void print(Object o) {\" +\n" + " \"\"\"\n" + + " System.out.println(Objects.toString(o));\n" + + " }\n" + + " \"\"\";"); + } + + @Test + void forceTrailingWhitespace() { + TextBlockLiteralExpr textBlock = parseStatement("String code = \"\"\"\n" + "The quick brown fox\\040\\040\n" + + "jumps over the lazy dog\n" + + "\"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals("The quick brown fox \n" + "jumps over the lazy dog\n", textBlock.translateEscapes()); + } + + @Test + void escapeLineTerminator() { + TextBlockLiteralExpr textBlock = parseStatement("String text = \"\"\"\n" + + " Lorem ipsum dolor sit amet, consectetur adipiscing \\\n" + + " elit, sed do eiusmod tempor incididunt ut labore \\\n" + + " et dolore magna aliqua.\\\n" + + " \"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals( + "Lorem ipsum dolor sit amet, consectetur adipiscing " + + "elit, sed do eiusmod tempor incididunt ut labore " + + "et dolore magna aliqua.", + textBlock.translateEscapes()); + } + + @Test + void escapeSpace() { + TextBlockLiteralExpr textBlock = parseStatement("String colors = \"\"\"\n" + " red \\s\n" + + " green\\s\n" + + " blue \\s\n" + + " \"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + + assertEquals("red \n" + "green \n" + "blue \n", textBlock.translateEscapes()); + } + + @Test + void whiteSpaceLineShorterThanMiniumCommonPrefix() { + TextBlockLiteralExpr textBlock = parseStatement("String text = \"\"\" \n" + " Hello\n" + " World\"\"\";") + .findFirst(TextBlockLiteralExpr.class) + .get(); + assertEquals("\nHello\n" + "World", textBlock.translateEscapes()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java new file mode 100644 index 0000000..5f8e7d9 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.expr; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import org.junit.jupiter.api.Test; + +class ThisExprTest { + @Test + void justThis() { + Expression expr = parseExpression("this"); + + assertTrue(expr.isThisExpr()); + } + + @Test + void justThisName() { + JavaParser javaParser = new JavaParser(new ParserConfiguration().setStoreTokens(false)); + ParseResult parseResult = javaParser.parseExpression("this.c"); + FieldAccessExpr fieldAccess = parseResult.getResult().get().asFieldAccessExpr(); + assertEquals("c", fieldAccess.getName().asString()); + } + + @Test + void singleScopeThis() { + Expression expr = parseExpression("A.this"); + + Name className = expr.asThisExpr().getTypeName().get(); + + assertEquals("A", className.asString()); + } + + @Test + void singleScopeThisName() { + JavaParser javaParser = new JavaParser(new ParserConfiguration().setStoreTokens(false)); + ParseResult parseResult = javaParser.parseExpression("A.this.c"); + FieldAccessExpr fieldAccess = parseResult.getResult().get().asFieldAccessExpr(); + assertEquals("c", fieldAccess.getName().asString()); + } + + @Test + void multiScopeThis() { + Expression expr = parseExpression("a.B.this"); + + Name className = expr.asThisExpr().getTypeName().get(); + + assertEquals("a.B", className.asString()); + } + + @Test + void multiScopeThisName() { + JavaParser javaParser = new JavaParser(new ParserConfiguration().setStoreTokens(false)); + ParseResult parseResult = javaParser.parseExpression("a.B.this.c"); + FieldAccessExpr fieldAccess = parseResult.getResult().get().asFieldAccessExpr(); + assertEquals("c", fieldAccess.getName().asString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java new file mode 100644 index 0000000..51b8a22 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.imports; + +import static com.github.javaparser.StaticJavaParser.parseImport; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.ImportDeclaration; +import org.junit.jupiter.api.Test; + +class ImportDeclarationTest { + @Test + void singleTypeImportDeclaration() { + ImportDeclaration i = parseImport("import a.b.c.X;"); + assertEquals("a.b.c.X", i.getNameAsString()); + } + + @Test + void typeImportOnDemandDeclaration() { + ImportDeclaration i = parseImport("import a.b.c.D.*;"); + assertEquals("a.b.c.D", i.getName().toString()); + assertEquals("D", i.getName().getIdentifier()); + } + + @Test + void singleStaticImportDeclaration() { + ImportDeclaration i = parseImport("import static a.b.c.X.def;"); + assertEquals("a.b.c.X", i.getName().getQualifier().get().asString()); + assertEquals("def", i.getName().getIdentifier()); + } + + @Test + void staticImportOnDemandDeclaration() { + ImportDeclaration i = parseImport("import static a.b.c.X.*;"); + assertEquals("a.b.c.X", i.getNameAsString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithArgumentsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithArgumentsTest.java new file mode 100644 index 0000000..0c400ca --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithArgumentsTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static com.github.javaparser.ast.expr.Expression.EXCLUDE_ENCLOSED_EXPR; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import org.junit.jupiter.api.Test; + +class NodeWithArgumentsTest extends AbstractLexicalPreservingTest { + + @Test + void testGetArgumentPosition() { + considerCode("" + "class Foo {\n" + + " Map map = new HashMap<>();\n" + + " public String bar(int i) {\n" + + " return map.put(((i)),((\"baz\")));\n" + + " } \n" + + "}"); + MethodCallExpr mce = cu.findFirst(MethodCallExpr.class).get(); + Expression arg0 = mce.getArgument(0); + Expression arg1 = mce.getArgument(1); + Expression innerExpr0 = + arg0.asEnclosedExpr().getInner().asEnclosedExpr().getInner(); + Expression innerExpr1 = + arg1.asEnclosedExpr().getInner().asEnclosedExpr().getInner(); + + assertEquals(0, mce.getArgumentPosition(arg0)); // with no conversion + assertEquals( + 0, + mce.getArgumentPosition(innerExpr0, EXCLUDE_ENCLOSED_EXPR)); // with a conversion skipping EnclosedExprs + assertEquals(1, mce.getArgumentPosition(arg1)); // with no conversion + assertEquals( + 1, + mce.getArgumentPosition(innerExpr1, EXCLUDE_ENCLOSED_EXPR)); // with a conversion skipping EnclosedExprs + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithBodyTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithBodyTest.java new file mode 100644 index 0000000..c88ab39 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithBodyTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.stmt.ForStmt; +import com.github.javaparser.utils.TestParser; +import org.junit.jupiter.api.Test; + +class NodeWithBodyTest { + @Test + void emptyStatementIsEmpty() { + ForStmt forStmt = TestParser.parseStatement("for(;;);").asForStmt(); + + assertTrue(forStmt.hasEmptyBody()); + } + + @Test + void emptyBlockIsEmpty() { + ForStmt forStmt = TestParser.parseStatement("for(;;){}").asForStmt(); + + assertTrue(forStmt.hasEmptyBody()); + } + + @Test + void simpleStatementIsNotEmpty() { + ForStmt forStmt = TestParser.parseStatement("for(;;)a=b;").asForStmt(); + + assertFalse(forStmt.hasEmptyBody()); + } + + @Test + void nonEmptyBlockIsNotEmpty() { + ForStmt forStmt = TestParser.parseStatement("for(;;){a=b;}").asForStmt(); + + assertFalse(forStmt.hasEmptyBody()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithJavadocTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithJavadocTest.java new file mode 100644 index 0000000..713411a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithJavadocTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import org.junit.jupiter.api.Test; + +class NodeWithJavadocTest { + + @Test + void removeJavaDocNegativeCaseNoComment() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + assertFalse(decl.removeJavaDocComment()); + } + + @Test + void removeJavaDocNegativeCaseCommentNotJavaDoc() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.setComment(new LineComment("A comment")); + assertFalse(decl.removeJavaDocComment()); + assertTrue(decl.getComment().isPresent()); + } + + @Test + void removeJavaDocPositiveCase() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.setComment(new JavadocComment("A comment")); + assertTrue(decl.removeJavaDocComment()); + assertFalse(decl.getComment().isPresent()); + } + + @Test + void getJavadocOnMethodWithLineCommentShouldReturnEmptyOptional() { + MethodDeclaration method = new MethodDeclaration(); + method.setLineComment("Lorem Ipsum."); + + assertFalse(method.getJavadocComment().isPresent()); + assertFalse(method.getJavadoc().isPresent()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiersTest.java new file mode 100644 index 0000000..064cf9b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiersTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static com.github.javaparser.ast.Modifier.Keyword.*; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.observer.AstObserverAdapter; +import com.github.javaparser.ast.observer.ObservableProperty; +import java.util.LinkedList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class NodeWithModifiersTest { + + @Test + void addModifierWorks() { + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.addModifier(PUBLIC); + assertEquals(createModifierList(PUBLIC), decl.getModifiers()); + } + + @Test + void addModifierTriggerNotification() { + List changes = new LinkedList<>(); + ClassOrInterfaceDeclaration decl = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + decl.register(new AstObserverAdapter() { + @Override + public void propertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add("property " + property.name() + " is changed to " + newValue); + } + }); + decl.addModifier(PUBLIC); + assertEquals(1, changes.size()); + assertEquals("property MODIFIERS is changed to [public ]", changes.get(0)); + } + + @Test + void removeExistingModifier() { + NodeWithModifiers node = anythingWithModifiers(PUBLIC); + node.removeModifier(PUBLIC); + assertEquals(0, node.getModifiers().size()); + } + + @Test + void ignoreNotExistingModifiersOnRemove() { + NodeWithModifiers node = anythingWithModifiers(PUBLIC); + node.removeModifier(PRIVATE); + + assertEquals(createModifierList(PUBLIC), node.getModifiers()); + } + + @Test + void keepModifiersThatShouldNotBeRemoved() { + NodeWithModifiers node = anythingWithModifiers(PUBLIC, STATIC, SYNCHRONIZED); + node.removeModifier(PUBLIC, PRIVATE, STATIC); + + assertEquals(createModifierList(SYNCHRONIZED), node.getModifiers()); + } + + private NodeWithModifiers anythingWithModifiers(Modifier.Keyword... keywords) { + ClassOrInterfaceDeclaration foo = new ClassOrInterfaceDeclaration(new NodeList<>(), false, "Foo"); + foo.addModifier(keywords); + return foo; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java new file mode 100644 index 0000000..f56fa37 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import org.junit.jupiter.api.Test; + +class NodeWithOptionalScopeTest { + + @Test + void commonExpressionWhichHaveInterfaceNodeWithOptionalScope() { + MethodCallExpr methodCallExpr = new MethodCallExpr(new NameExpr("A"), "call"); + ObjectCreationExpr objectCreationExpr = new ObjectCreationExpr(); + + assertTrue(methodCallExpr.hasScope()); + assertFalse(objectCreationExpr.hasScope()); + } + + @Test + void removeScope() { + MethodCallExpr methodCallExpr = new MethodCallExpr(new NameExpr("A"), "method"); + + methodCallExpr.removeScope(); + + assertFalse(methodCallExpr.hasScope()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithTraversableScopeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithTraversableScopeTest.java new file mode 100644 index 0000000..f4610fe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithTraversableScopeTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static com.github.javaparser.utils.TestUtils.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import com.github.javaparser.ast.expr.FieldAccessExpr; +import com.github.javaparser.ast.expr.MethodCallExpr; +import org.junit.jupiter.api.Test; + +class NodeWithTraversableScopeTest { + @Test + void traverse1() { + NodeWithTraversableScope expression = parseExpression("getAddress().name.startsWith(\"abc\")"); + + assertInstanceOf(MethodCallExpr.class, expression); + expression = (NodeWithTraversableScope) expression.traverseScope().get(); + assertInstanceOf(FieldAccessExpr.class, expression); + expression = (NodeWithTraversableScope) expression.traverseScope().get(); + assertInstanceOf(MethodCallExpr.class, expression); + assertFalse(expression.traverseScope().isPresent()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithVariablesTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithVariablesTest.java new file mode 100644 index 0000000..042017d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithVariablesTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.nodeTypes; + +import static com.github.javaparser.StaticJavaParser.parseVariableDeclarationExpr; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.type.PrimitiveType; +import org.junit.jupiter.api.Test; + +class NodeWithVariablesTest { + + @Test + void getCommonTypeWorksForNormalVariables() { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a,b"); + assertEquals(PrimitiveType.intType(), declaration.getCommonType()); + } + + @Test + void getCommonTypeWorksForArrayTypes() { + parseVariableDeclarationExpr("int a[],b[]").getCommonType(); + } + + @Test + void getCommonTypeFailsOnArrayDifferences() { + assertThrows(AssertionError.class, () -> parseVariableDeclarationExpr("int a[],b[][]") + .getCommonType()); + } + + @Test + void getCommonTypeFailsOnDodgySetterUsage() { + assertThrows(AssertionError.class, () -> { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a,b"); + declaration.getVariable(1).setType(String.class); + declaration.getCommonType(); + }); + } + + @Test + void getCommonTypeFailsOnInvalidEmptyVariableList() { + assertThrows(AssertionError.class, () -> { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a"); + declaration.getVariables().clear(); + declaration.getCommonType(); + }); + } + + @Test + void getElementTypeWorksForNormalVariables() { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a,b"); + assertEquals(PrimitiveType.intType(), declaration.getElementType()); + } + + @Test + void getElementTypeWorksForArrayTypes() { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a[],b[]"); + assertEquals(PrimitiveType.intType(), declaration.getElementType()); + } + + @Test + void getElementTypeIsOkayWithArrayDifferences() { + parseVariableDeclarationExpr("int a[],b[][]").getElementType(); + } + + @Test + void getElementTypeFailsOnDodgySetterUsage() { + assertThrows(AssertionError.class, () -> { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a,b"); + declaration.getVariable(1).setType(String.class); + declaration.getElementType(); + }); + } + + @Test + void getElementTypeFailsOnInvalidEmptyVariableList() { + assertThrows(AssertionError.class, () -> { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int a"); + declaration.getVariables().clear(); + declaration.getElementType(); + }); + } + + @Test + void setAllTypesWorks() { + VariableDeclarationExpr declaration = parseVariableDeclarationExpr("int[] a[],b[][]"); + declaration.setAllTypes(StaticJavaParser.parseType("Dog")); + assertEquals("Dog a, b", declaration.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/observer/PropagatingAstObserverTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/observer/PropagatingAstObserverTest.java new file mode 100644 index 0000000..c438e78 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/observer/PropagatingAstObserverTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.observer; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.FieldDeclaration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +class PropagatingAstObserverTest { + @Test + void verifyPropagation() { + String code = "class A { }"; + CompilationUnit cu = parse(code); + List changes = new ArrayList<>(); + AstObserver observer = new PropagatingAstObserver() { + @Override + public void concretePropertyChange( + Node observedNode, ObservableProperty property, Object oldValue, Object newValue) { + changes.add(String.format( + "%s.%s changed from %s to %s", + observedNode.getClass().getSimpleName(), property.name().toLowerCase(), oldValue, newValue)); + } + }; + cu.registerForSubtree(observer); + + assertEquals(Arrays.asList(), changes); + + FieldDeclaration fieldDeclaration = cu.getClassByName("A").get().addField("String", "foo"); + assertEquals(Arrays.asList(), changes); + assertTrue(fieldDeclaration.isRegistered(observer)); + + cu.getClassByName("A") + .get() + .getFieldByName("foo") + .get() + .getVariables() + .get(0) + .setName("Bar"); + assertEquals(Arrays.asList("VariableDeclarator.name changed from foo to Bar"), changes); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/BreakStmtTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/BreakStmtTest.java new file mode 100644 index 0000000..118d64e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/BreakStmtTest.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.stmt; + +import static com.github.javaparser.utils.TestParser.parseStatement; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.expr.SimpleName; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class BreakStmtTest { + + @Test + void simpleBreak() { + BreakStmt statement = parseStatement("break;").asBreakStmt(); + assertFalse(statement.getLabel().isPresent()); + } + + @Test + void breakWithLabel() { + BreakStmt statement = parseStatement("break hond;").asBreakStmt(); + assertEquals("hond", statement.getLabel().get().asString()); + } + + @Test + void constructor_simpleBreakWithoutLabel() { + BreakStmt statement = new BreakStmt(); + assertFalse(statement.getLabel().isPresent()); + assertEquals("break;", statement.toString()); + } + + @Test + void constructor_simpleBreakWithLabel() { + BreakStmt statement = new BreakStmt("customLabel"); + assertTrue(statement.getLabel().isPresent()); + } + + @Test + void constructor_simpleBreakWithSimpleNameLabel() { + SimpleName label = new SimpleName("customLabel"); + BreakStmt statement = new BreakStmt(label); + assertTrue(statement.getLabel().isPresent()); + assertEquals(label, statement.getLabel().get()); + } + + @Test + void removeLabel_shouldRemoveTheLabel() { + BreakStmt statement = new BreakStmt("customLabel"); + assertTrue(statement.getLabel().isPresent()); + + statement.removeLabel(); + assertFalse(statement.getLabel().isPresent()); + } + + @Test + void isBreakStmt_shouldBeTrue() { + assertTrue(new BreakStmt().isBreakStmt()); + } + + @Test + void asBreakStmt_shouldBeSame() { + BreakStmt breakStatement = new BreakStmt(); + assertSame(breakStatement, breakStatement.asBreakStmt()); + } + + @Test + void toBreakStmt_shouldBePresentAndBeTheSame() { + BreakStmt breakStatement = new BreakStmt(); + Optional optBreak = breakStatement.toBreakStmt(); + assertTrue(optBreak.isPresent()); + assertSame(breakStatement, optBreak.get()); + } + + @Test + void clone_shouldNotBeTheSameButShouldBeEquals() { + BreakStmt breakStatement = new BreakStmt(); + BreakStmt clonedStatement = breakStatement.clone(); + assertNotSame(breakStatement, clonedStatement); + assertEquals(breakStatement, clonedStatement); + } + + @Test + void remove_whenLabelIsPassedAsArgumentItShouldBeRemoved() { + BreakStmt breakStatement = new BreakStmt("Label"); + assertTrue(breakStatement.getLabel().isPresent()); + + SimpleName label = breakStatement.getLabel().get(); + assertTrue(breakStatement.remove(label)); + assertFalse(breakStatement.getLabel().isPresent()); + } + + @Test + void replace_testReplaceLabelWithNewOne() { + SimpleName originalLabel = new SimpleName("original"); + SimpleName replacementLabel = new SimpleName("replacement"); + + BreakStmt breakStatement = new BreakStmt(originalLabel); + assertTrue(breakStatement.getLabel().isPresent()); + assertSame(originalLabel, breakStatement.getLabel().get()); + + breakStatement.replace(originalLabel, replacementLabel); + assertTrue(breakStatement.getLabel().isPresent()); + assertSame(replacementLabel, breakStatement.getLabel().get()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/ForEachStmtTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/ForEachStmtTest.java new file mode 100644 index 0000000..1f35544 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/ForEachStmtTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.stmt; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.PrimitiveType; +import org.junit.jupiter.api.Test; + +class ForEachStmtTest { + @Test + void nonFinalPrimitive() { + ForEachStmt statement = parseStatement("for (int i : ints) {}").asForEachStmt(); + assertFalse(statement.hasFinalVariable()); + assertEquals(PrimitiveType.intType(), statement.getVariableDeclarator().getType()); + assertEquals("i", statement.getVariableDeclarator().getName().getIdentifier()); + } + + @Test + void finalNonPrimitive() { + ForEachStmt statement = parseStatement("for (final Object o : objs) {}").asForEachStmt(); + assertTrue(statement.hasFinalVariable()); + assertEquals( + new ClassOrInterfaceType(null, "Object"), + statement.getVariableDeclarator().getType()); + assertEquals("o", statement.getVariableDeclarator().getName().getIdentifier()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/IfElseStmtTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/IfElseStmtTest.java new file mode 100644 index 0000000..ea917e6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/IfElseStmtTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.stmt; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class IfElseStmtTest { + + @Test + void issue1247withElseSingleStmt() { + IfStmt ifStmt = parseStatement("if (cond) doSomething(); else doSomethingElse();") + .asIfStmt(); + assertFalse(ifStmt.hasElseBlock()); + assertTrue(ifStmt.hasElseBranch()); + assertFalse(ifStmt.hasCascadingIfStmt()); + } + + @Test + void issue1247withElseBlockStmt() { + IfStmt ifStmt = parseStatement("if (cond) doSomething(); else { doSomethingElse(); }") + .asIfStmt(); + assertTrue(ifStmt.hasElseBlock()); + assertTrue(ifStmt.hasElseBranch()); + assertFalse(ifStmt.hasCascadingIfStmt()); + } + + @Test + void issue1247withElseSingleStmtWhichIsAnIf() { + IfStmt ifStmt = parseStatement("if (cond1) doSomething(); else if (cond2) doSomethingElse();") + .asIfStmt(); + assertFalse(ifStmt.hasElseBlock()); + assertTrue(ifStmt.hasElseBranch()); + assertTrue(ifStmt.hasCascadingIfStmt()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/SwitchStmtTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/SwitchStmtTest.java new file mode 100644 index 0000000..7daad8a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/SwitchStmtTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.stmt; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static com.github.javaparser.ast.stmt.SwitchEntry.Type.EXPRESSION; +import static com.github.javaparser.ast.stmt.SwitchEntry.Type.STATEMENT_GROUP; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.NullLiteralExpr; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +class SwitchStmtTest { + + private static final ParserConfiguration.LanguageLevel storedLanguageLevel = + StaticJavaParser.getParserConfiguration().getLanguageLevel(); + + @BeforeAll + public static void setLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + } + + @AfterAll + public static void resetLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(storedLanguageLevel); + } + + @Test + void classicSwitch() { + SwitchStmt switchStmt = parseStatement("switch (day) {\n" + " case TUESDAY: System.out.println(7); break;\n" + + " case FRIDAY: System.out.println(8); break;\n" + + " default: System.out.println(-1); \n" + + "}") + .asSwitchStmt(); + + assertEquals(STATEMENT_GROUP, switchStmt.getEntry(0).getType()); + assertEquals(STATEMENT_GROUP, switchStmt.getEntry(1).getType()); + assertEquals(STATEMENT_GROUP, switchStmt.getEntry(2).getType()); + assertEquals(new NodeList<>(), switchStmt.getEntry(2).getLabels()); + assertFalse(switchStmt.getEntry(0).isDefault()); + assertFalse(switchStmt.getEntry(1).isDefault()); + assertTrue(switchStmt.getEntry(2).isDefault()); + } + + @Test + void jep325Example1() { + SwitchStmt switchStmt = parseStatement("switch (day) {\n" + + // " case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);\n" + + " case TUESDAY -> System.out.println(7);\n" + + + // " case THURSDAY, SATURDAY -> System.out.println(8);\n" + + " case WEDNESDAY -> System.out.println(9);\n" + + "}") + .asSwitchStmt(); + + assertEquals(EXPRESSION, switchStmt.getEntry(0).getType()); + } + + @Test + void jep441Example1() { + SwitchStmt switchStmt = parseStatement( + "switch (day) {\n" + " case null, default -> System.out.println(-1); \n" + "}") + .asSwitchStmt(); + + assertTrue(switchStmt.getEntry(0).isDefault()); + assertInstanceOf( + NullLiteralExpr.class, switchStmt.getEntry(0).getLabels().get(0)); + } + + @Test + void issue4455Test() { + SwitchStmt switchStmt = parseStatement( + "switch (column) {\n" + " case CustomDeployTableModel.ARTIFACT_NAME:\n" + "}") + .asSwitchStmt(); + + assertEquals(Node.Parsedness.PARSED, switchStmt.getParsed()); + + SwitchEntry entry = switchStmt.getEntry(0); + Expression switchLabel = entry.getLabels().get(0); + + assertEquals("CustomDeployTableModel.ARTIFACT_NAME", switchLabel.toString()); + assertTrue(switchLabel.isFieldAccessExpr()); + } + + @Test + void issue4607Test() { + SwitchStmt switchStmt = parseStatement("switch (o) { case String s when s.length() == 1 -> 0; }") + .asSwitchStmt(); + assertEquals(switchStmt.toString(), switchStmt.clone().toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/TryStmtTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/TryStmtTest.java new file mode 100644 index 0000000..b99927d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/TryStmtTest.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.stmt; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.*; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParseStart; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.expr.FieldAccessExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import org.junit.jupiter.api.Test; + +class TryStmtTest { + @Test + void simpleTest() { + TryStmt tryStmt = parse9("try(Reader x = new FileReader()){}"); + assertInstanceOf(VariableDeclarationExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void multipleTest() { + TryStmt tryStmt = parse9("try(Reader x = new FileReader(); Reader x = new FileReader()){}"); + assertInstanceOf(VariableDeclarationExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void modifiersTest() { + TryStmt tryStmt = parse9("try(final @A Reader x = new FileReader()){}"); + assertInstanceOf(VariableDeclarationExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void simpleVariable() { + TryStmt tryStmt = parse9("try(a){}"); + assertInstanceOf(NameExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void twoSimpleVariables() { + TryStmt tryStmt = parse9("try(a;b){}"); + assertInstanceOf(NameExpr.class, tryStmt.getResources().get(0)); + assertInstanceOf(NameExpr.class, tryStmt.getResources().get(1)); + } + + @Test + void complexVariable() { + TryStmt tryStmt = parse9("try(a.b.c){}"); + assertInstanceOf(FieldAccessExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void superAccess() { + TryStmt tryStmt = parse9("try(super.a){}"); + assertInstanceOf(FieldAccessExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void outerClassAccess() { + TryStmt tryStmt = parse9("try(X.this.a){}"); + assertInstanceOf(FieldAccessExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void varTestJava10() { + TryStmt tryStmt = parse10("try(var x = new FileReader()){}"); + assertInstanceOf(VariableDeclarationExpr.class, tryStmt.getResources().get(0)); + } + + @Test + void varTestJava11() { + TryStmt tryStmt = parse11("try(var x = new FileReader()){}"); + assertInstanceOf(VariableDeclarationExpr.class, tryStmt.getResources().get(0)); + } + + private T parse9(String code) { + JavaParser parser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_9)); + ParseResult result = parser.parse(ParseStart.STATEMENT, provider(code)); + assertTrue(result.isSuccessful(), result.toString()); + return (T) result.getResult().get(); + } + + private T parse10(String code) { + JavaParser parser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_10)); + ParseResult result = parser.parse(ParseStart.STATEMENT, provider(code)); + assertTrue(result.isSuccessful(), result.toString()); + return (T) result.getResult().get(); + } + + private T parse11(String code) { + JavaParser parser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_11)); + ParseResult result = parser.parse(ParseStart.STATEMENT, provider(code)); + assertTrue(result.isSuccessful(), result.toString()); + return (T) result.getResult().get(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/YieldStmtTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/YieldStmtTest.java new file mode 100644 index 0000000..1a7436a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/stmt/YieldStmtTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.stmt; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_12; +import static com.github.javaparser.utils.TestParser.parseCompilationUnit; +import static com.github.javaparser.utils.TestParser.parseStatement; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.*; +import org.junit.jupiter.api.Test; + +class YieldStmtTest { + @Test + void yield() { + YieldStmt statement = parseStatement("yield 12*12;").asYieldStmt(); + assertEquals(BinaryExpr.class, statement.getExpression().getClass()); + } + + @Test + void yield2() { + YieldStmt statement; + statement = parseStatement("yield (2 + 2);").asYieldStmt(); + assertEquals(EnclosedExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield ((2 + 2) * 3);").asYieldStmt(); + assertEquals(EnclosedExpr.class, statement.getExpression().getClass()); + } + + @Test + void yieldMethodCall() { + YieldStmt statement; + statement = parseStatement("yield a();").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield a(5, arg);").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield a.b();").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield a.b(5, arg);").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield this.b();").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield this.b(5, arg);").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield Clazz.this.b();").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield Clazz.this.b(5, arg);").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + } + + @Test + void yieldAssignment() { + YieldStmt statement = parseStatement("yield (x = 5);").asYieldStmt(); + assertEquals(EnclosedExpr.class, statement.getExpression().getClass()); + } + + @Test + void yieldConditional() { + YieldStmt statement = parseStatement("yield x ? 5 : 6;").asYieldStmt(); + assertEquals(ConditionalExpr.class, statement.getExpression().getClass()); + } + + @Test + void threadYieldShouldNotBreak() { + parseStatement("Thread.yield();").asExpressionStmt().getExpression().asMethodCallExpr(); + } + + @Test + void keywordShouldNotInterfereWithIdentifiers() { + CompilationUnit compilationUnit = + parseCompilationUnit(JAVA_12, "class yield { yield yield(yield yield){yield();} }"); + assertEqualsStringIgnoringEol( + "class yield {\n" + "\n" + + " yield yield(yield yield) {\n" + + " yield();\n" + + " }\n" + + "}\n", + compilationUnit.toString()); + } + + @Test + void keywordShouldNotInterfereWithIdentifiers2() { + CompilationUnit compilationUnit = parseCompilationUnit("enum X { yield, }"); + assertEqualsStringIgnoringEol("enum X {\n" + "\n" + " yield\n" + "}\n", compilationUnit.toString()); + } + + @Test + void keywordShouldNotInterfereWithIdentifiers3() { + YieldStmt statement; + statement = parseStatement("yield yield;").asYieldStmt(); + assertEquals(NameExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield Clazz.yield();").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + statement = parseStatement("yield yield.yield();").asYieldStmt(); + assertEquals(MethodCallExpr.class, statement.getExpression().getClass()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/ArrayTypeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/ArrayTypeTest.java new file mode 100644 index 0000000..46bea4a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/ArrayTypeTest.java @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.type; + +import static com.github.javaparser.StaticJavaParser.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.ArrayCreationExpr; +import com.github.javaparser.ast.expr.MarkerAnnotationExpr; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.printer.ConcreteSyntaxModel; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ArrayTypeTest { + @Test + void getFieldDeclarationWithArrays() { + FieldDeclaration fieldDeclaration = + parseBodyDeclaration("@C int @A[] @B[] a @X[] @Y[];").asFieldDeclaration(); + + ArrayType arrayType1 = fieldDeclaration.getVariable(0).getType().asArrayType(); + ArrayType arrayType2 = arrayType1.getComponentType().asArrayType(); + ArrayType arrayType3 = arrayType2.getComponentType().asArrayType(); + ArrayType arrayType4 = arrayType3.getComponentType().asArrayType(); + PrimitiveType elementType = arrayType4.getComponentType().asPrimitiveType(); + + assertThat(arrayType1.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("X"))); + assertThat(arrayType2.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("Y"))); + assertThat(arrayType3.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("A"))); + assertThat(arrayType4.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("B"))); + + assertThat(elementType.getType()).isEqualTo(PrimitiveType.Primitive.INT); + assertThat(fieldDeclaration.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("C"))); + + assertThat(arrayType1.getParentNode().get().getParentNode().get()).isSameAs(fieldDeclaration); + } + + @Test + void getVariableDeclarationWithArrays() { + ExpressionStmt variableDeclarationStatement = + parseStatement("@C int @A[] @B[] a @X[] @Y[];").asExpressionStmt(); + VariableDeclarationExpr variableDeclarationExpr = + variableDeclarationStatement.getExpression().asVariableDeclarationExpr(); + + ArrayType arrayType1 = variableDeclarationExpr.getVariable(0).getType().asArrayType(); + ArrayType arrayType2 = arrayType1.getComponentType().asArrayType(); + ArrayType arrayType3 = arrayType2.getComponentType().asArrayType(); + ArrayType arrayType4 = arrayType3.getComponentType().asArrayType(); + PrimitiveType elementType = arrayType4.getComponentType().asPrimitiveType(); + + assertThat(arrayType1.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("X"))); + assertThat(arrayType2.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("Y"))); + assertThat(arrayType3.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("A"))); + assertThat(arrayType4.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("B"))); + + assertThat(elementType.getType()).isEqualTo(PrimitiveType.Primitive.INT); + assertThat(variableDeclarationExpr.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("C"))); + + assertThat(arrayType1.getParentNode().get().getParentNode().get()).isSameAs(variableDeclarationExpr); + } + + @Test + void getMethodDeclarationWithArrays() { + MethodDeclaration methodDeclaration = + parseBodyDeclaration("@C int @A[] a() @B[] {}").asMethodDeclaration(); + + ArrayType arrayType1 = methodDeclaration.getType().asArrayType(); + ArrayType arrayType2 = arrayType1.getComponentType().asArrayType(); + Type elementType = arrayType2.getComponentType(); + assertThat(elementType).isInstanceOf(PrimitiveType.class); + + assertThat(arrayType1.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("B"))); + assertThat(arrayType2.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("A"))); + assertThat(methodDeclaration.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("C"))); + + assertThat(methodDeclaration.getType().getParentNode().get()).isSameAs(methodDeclaration); + } + + @Test + void getParameterWithArrays() { + MethodDeclaration methodDeclaration = + parseBodyDeclaration("void a(@C int @A[] a @B[]) {}").asMethodDeclaration(); + + Parameter parameter = methodDeclaration.getParameter(0); + + ArrayType outerArrayType = parameter.getType().asArrayType(); + + ArrayType innerArrayType = outerArrayType.getComponentType().asArrayType(); + PrimitiveType elementType = innerArrayType.getComponentType().asPrimitiveType(); + + assertThat(elementType).isInstanceOf(PrimitiveType.class); + assertThat(outerArrayType.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("B"))); + assertThat(innerArrayType.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("A"))); + assertThat(parameter.getAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("C"))); + + assertThat(parameter.getType().getParentNode().get()).isSameAs(parameter); + } + + @Test + void setVariableDeclarationWithArrays() { + ExpressionStmt variableDeclarationStatement = + parseStatement("@C int @A[] @B[] a @X[] @Y[];").asExpressionStmt(); + VariableDeclarationExpr variableDeclarationExpr = + variableDeclarationStatement.getExpression().asVariableDeclarationExpr(); + + variableDeclarationExpr.getVariable(0).setType(new ArrayType(new ArrayType(PrimitiveType.intType()))); + assertEquals("@C" + LineSeparator.SYSTEM + "int[][] a;", variableDeclarationStatement.toString()); + } + + @Test + void setFieldDeclarationWithArrays() { + FieldDeclaration fieldDeclaration = + parseBodyDeclaration("int[][] a[][];").asFieldDeclaration(); + fieldDeclaration.getVariable(0).setType(new ArrayType(new ArrayType(parseClassOrInterfaceType("Blob")))); + + assertEquals("Blob[][] a;", fieldDeclaration.toString()); + } + + @Test + void setMethodDeclarationWithArrays() { + MethodDeclaration method = parseBodyDeclaration("int[][] a()[][] {}").asMethodDeclaration(); + method.setType(new ArrayType(new ArrayType(parseClassOrInterfaceType("Blob")))); + + assertEquals("Blob[][] a() {" + LineSeparator.SYSTEM + "}", method.toString()); + } + + @Test + void fieldDeclarationWithArraysHasCorrectOrigins() { + FieldDeclaration fieldDeclaration = parseBodyDeclaration("int[] a[];").asFieldDeclaration(); + + Type outerType = fieldDeclaration.getVariables().get(0).getType(); + assertEquals(ArrayType.Origin.NAME, outerType.asArrayType().getOrigin()); + assertEquals( + ArrayType.Origin.TYPE, + outerType.asArrayType().getComponentType().asArrayType().getOrigin()); + } + + @Test + void methodDeclarationWithArraysHasCorrectOrigins() { + MethodDeclaration method = (MethodDeclaration) parseBodyDeclaration("int[] a()[] {}"); + + Type outerType = method.getType(); + assertEquals(ArrayType.Origin.NAME, outerType.asArrayType().getOrigin()); + assertEquals( + ArrayType.Origin.TYPE, + outerType.asArrayType().getComponentType().asArrayType().getOrigin()); + } + + @Test + void setParameterWithArrays() { + MethodDeclaration method = + parseBodyDeclaration("void a(int[][] a[][]) {}").asMethodDeclaration(); + method.getParameter(0).setType(new ArrayType(new ArrayType(parseClassOrInterfaceType("Blob")))); + + assertEquals("void a(Blob[][] a) {" + LineSeparator.SYSTEM + "}", method.toString()); + } + + @Test + void getArrayCreationType() { + ArrayCreationExpr expr = parseExpression("new int[]"); + ArrayType outerType = expr.createdType().asArrayType(); + Type innerType = outerType.getComponentType(); + assertThat(innerType).isEqualTo(expr.getElementType()); + } + + @Test + void ellipsisCanHaveAnnotationsToo() { + Parameter p = parseParameter("int[]@X...a[]"); + + assertThat(p.getVarArgsAnnotations()).containsExactly(new MarkerAnnotationExpr(parseName("X"))); + assertEquals("int[][]@X ... a", p.toString()); + assertEquals("int[][]@X... a", ConcreteSyntaxModel.genericPrettyPrint(p)); + } + + @Test + void arrayLevel() { + FieldDeclaration fd1 = parseBodyDeclaration("int[] a;").asFieldDeclaration(); + assertEquals(1, fd1.getVariable(0).getType().getArrayLevel()); + FieldDeclaration fd2 = parseBodyDeclaration("int[][] a;").asFieldDeclaration(); + assertEquals(2, fd2.getVariable(0).getType().getArrayLevel()); + } + + @Test + void range() { + Type type = parseType("Long[][]"); + assertEquals(8, type.getRange().get().end.column); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/ClassOrInterfaceTypeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/ClassOrInterfaceTypeTest.java new file mode 100644 index 0000000..d4745ff --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/ClassOrInterfaceTypeTest.java @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.type; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.AnnotationExpr; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import java.util.Optional; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class ClassOrInterfaceTypeTest { + + @Test + void testSetName() { + ClassOrInterfaceType classOrInterfaceType = new ClassOrInterfaceType(); + + assertNotEquals("A", classOrInterfaceType.getName().toString()); + classOrInterfaceType.setName("A"); + assertEquals("A", classOrInterfaceType.getName().toString()); + } + + @Test + void testNestedClass() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(); + classA.setName("A"); + ClassOrInterfaceType classB = new ClassOrInterfaceType(classA, "B"); + + assertEquals("A.B", classB.getNameWithScope()); + } + + @Test + void testWithGeneric() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + ClassOrInterfaceType classB = new ClassOrInterfaceType(classA, new SimpleName("B"), new NodeList<>(classA)); + + assertTrue(classB.getTypeArguments().isPresent()); + assertEquals(1, classB.getTypeArguments().get().size()); + assertEquals(classA, classB.getTypeArguments().get().get(0)); + + assertEquals("A.B", classB.getNameWithScope()); + assertEquals("A.B", classB.asString()); + } + + @Test + void testWithAnnotations() { + AnnotationExpr annotationExpr = StaticJavaParser.parseAnnotation("@Override"); + ClassOrInterfaceType classA = + new ClassOrInterfaceType(null, new SimpleName("A"), null, new NodeList<>(annotationExpr)); + + assertEquals(1, classA.getAnnotations().size()); + assertEquals(annotationExpr, classA.getAnnotation(0)); + } + + @Test + void testResolveWithoutCompilationUnit() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + Assertions.assertThrows(IllegalStateException.class, classA::resolve); + } + + @Test + void testToDescriptorWithoutCompilationUnit() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + Assertions.assertThrows(IllegalStateException.class, classA::toDescriptor); + } + + @Test + void testToClassOrInterfaceType() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + + Optional newClass = classA.toClassOrInterfaceType(); + assertTrue(newClass.isPresent()); + assertSame(classA, newClass.get()); + } + + @Test + void testIfClassOrInterfaceTypeIsCalled() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + classA.ifClassOrInterfaceType(classOrInterfaceType -> assertSame(classA, classOrInterfaceType)); + } + + @Test + void testAsClassOrInterfaceTypeIsTheSame() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + + assertTrue(classA.isClassOrInterfaceType()); + assertEquals(classA, classA.asClassOrInterfaceType()); + } + + @Test + void testCloneClass() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + assertEquals(classA, classA.clone()); + } + + @Test + void testMetaModel() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + assertEquals(JavaParserMetaModel.classOrInterfaceTypeMetaModel, classA.getMetaModel()); + } + + @Test + void testAcceptVoidVisitor() { + ClassOrInterfaceType classA = new ClassOrInterfaceType(null, "A"); + classA.accept( + new VoidVisitorAdapter() { + @Override + public void visit(ClassOrInterfaceType classOrInterfaceType, Object object) { + super.visit(classOrInterfaceType, object); + + assertEquals(classA, classOrInterfaceType); + } + }, + null); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/TypeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/TypeTest.java new file mode 100644 index 0000000..f817d11 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/type/TypeTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.type; + +import static com.github.javaparser.ParseStart.VARIABLE_DECLARATION_EXPR; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.RAW; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.StaticJavaParser.parseType; +import static com.github.javaparser.StaticJavaParser.parseVariableDeclarationExpr; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.validator.language_level_validations.Java5Validator; +import org.junit.jupiter.api.Test; + +class TypeTest { + @Test + void asString() { + assertEquals("int", typeAsString("int x")); + assertEquals("List", typeAsString("List x")); + assertEquals("String", typeAsString("@A String x")); + assertEquals("List", typeAsString("List x")); + } + + @Test + void primitiveTypeArgumentDefaultValidator() { + assertThrows(ParseProblemException.class, () -> typeAsString("List x;")); + } + + @Test + void primitiveTypeArgumentLenientValidator() { + ParserConfiguration config = new ParserConfiguration().setLanguageLevel(RAW); + config.getProcessors() + .add(() -> new Java5Validator() { + { + remove(noPrimitiveGenericArguments); + } + }.processor()); + + ParseResult result = + new JavaParser(config).parse(VARIABLE_DECLARATION_EXPR, provider("List x")); + assertTrue(result.isSuccessful()); + + VariableDeclarationExpr decl = result.getResult().get(); + assertEquals("List", decl.getVariable(0).getType().asString()); + } + + private String typeAsString(String s) { + return parseVariableDeclarationExpr(s).getVariable(0).getType().asString(); + } + + @Test + void arrayType() { + Type type = parseType("int[]"); + assertTrue(type.isArrayType()); + ArrayType arrayType = type.asArrayType(); + final ArrayType[] s = new ArrayType[1]; + type.ifArrayType(t -> s[0] = t); + assertNotNull(s[0]); + } + + @Test + void issue1251() { + final Type type = parseType("TypeUtilsTest.Tester"); + assertEquals("TypeUtilsTest.Tester", type.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java10ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java10ValidatorTest.java new file mode 100644 index 0000000..d038048 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java10ValidatorTest.java @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.CLASS_BODY; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_10; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +class Java10ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_10)); + + @Test + void varAllowedInLocalVariableDeclaration() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a = 5;")); + assertNoProblems(result); + } + + @Test + void varAllowedInForEach() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(var a : as){}")); + assertNoProblems(result); + } + + @Test + void varAllowedInOldFor() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(var a = 5;a<9;a++){}")); + assertNoProblems(result); + } + + @Test + void varAllowedInTryWithResources() { + ParseResult result = + javaParser.parse(STATEMENT, provider("try(var f = new FileReader(\"\")){ }catch (Exception e){ }")); + assertNoProblems(result); + } + + @Test + void varNotAllowedInCast() { + ParseResult result = javaParser.parse(STATEMENT, provider("int a = (var)20;")); + assertNoProblems(result); + } + + @Test + void varNotAllowedInField() { + ParseResult> result = javaParser.parse(CLASS_BODY, provider("var a = 20;")); + assertProblems(result, "(line 1,col 1) \"var\" is not allowed here."); + } + + @Test + void varNotAllowedInTypeArguments() { + ParseResult result = javaParser.parse(STATEMENT, provider("new X();")); + assertProblems(result, "(line 1,col 7) \"var\" is not allowed here."); + } + + @Test + void varNotAllowedInLambdaParameters() { + ParseResult result = javaParser.parse(STATEMENT, provider("x((var x) -> null);")); + assertProblems(result, "(line 1,col 4) \"var\" is not allowed here."); + } + + @Test + void emptyInitializerNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a;")); + assertProblems(result, "(line 1,col 1) \"var\" needs an initializer."); + } + + @Test + void multipleVariablesNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a=1, b=2;")); + assertProblems(result, "(line 1,col 1) \"var\" only takes a single variable."); + } + + @Test + void nullVariablesNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a=null;")); + assertProblems(result, "(line 1,col 1) \"var\" cannot infer type from just null."); + } + + @Test + void extraBracketPairsNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var d[] = new int[4];")); + assertProblems(result, "(line 1,col 5) \"var\" cannot have extra array brackets."); + } + + @Test + void arrayDimensionBracketsNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a={ 6 };")); + assertProblems(result, "(line 1,col 1) \"var\" cannot infer array types."); + } + + // This is pretty hard to impossible to implement correctly with just the AST. + @Disabled + @Test + void selfReferenceNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a=a;")); + assertProblems(result, ""); + } + + // Can be implemented once https://github.com/javaparser/javaparser/issues/1434 is implemented. + @Disabled + @Test + void polyExpressionAsInitializerNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("var a=new ArrayList<>();")); + assertProblems(result, ""); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java11ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java11ValidatorTest.java new file mode 100644 index 0000000..f85128d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java11ValidatorTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_11; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java11ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_11)); + + @Test + void varAllowedInLocalVariableDeclaration() { + ParseResult result = javaParser.parse(STATEMENT, provider("x((var x, var y) -> x+y);")); + assertNoProblems(result); + } + + @Test + void switchExpressionNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("int a = switch(x){};")); + assertProblems( + result, + "(line 1,col 9) Switch expressions are not supported. Pay attention that this feature is supported starting from 'JAVA_12' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void multiLabelCaseNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3,4,5: ;}")); + assertProblems( + result, + "(line 1,col 11) Only one label allowed in a switch-case. Pay attention that this feature is supported starting from 'JAVA_7' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java12ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java12ValidatorTest.java new file mode 100644 index 0000000..294343d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java12ValidatorTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_12_PREVIEW; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java12ValidatorTest { + public static final JavaParser javaParser = + new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_12_PREVIEW)); + + @Test + void expressionsInLabelsNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3+4+5: ;}")); + assertNoProblems(result); + } + + @Test + void switchExpressionNotAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("int a = switch(x){};")); + assertNoProblems(result); + } + + @Test + void multiLabelCaseAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3,4,5: ;}")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java13ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java13ValidatorTest.java new file mode 100644 index 0000000..d7e281b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java13ValidatorTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_13_PREVIEW; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java13ValidatorTest { + public static final JavaParser javaParser = + new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_13_PREVIEW)); + + @Test + void yieldAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3: yield 6;}")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java14PreviewValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java14PreviewValidatorTest.java new file mode 100644 index 0000000..3edc304 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java14PreviewValidatorTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_14_PREVIEW; +import static com.github.javaparser.Providers.provider; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class Java14PreviewValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_14_PREVIEW)); + + /** + * Records are available within Java 14 (preview), Java 15 (2nd preview), and Java 16 (release). + * The introduction of records means that they are no longer able to be used as identifiers. + */ + @Nested + class Record { + + @Nested + class RecordAsTypeIdentifierForbidden { + @Test + void recordUsedAsClassIdentifier() { + String s = "public class record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 14) 'record' is a restricted identifier and cannot be used for type declarations"); + } + + @Test + void recordUsedAsEnumIdentifier() { + String s = "public enum record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 13) 'record' is a restricted identifier and cannot be used for type declarations"); + } + + @Test + void recordUsedAsRecordIdentifier() { + String s = "public record record() {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 15) 'record' is a restricted identifier and cannot be used for type declarations"); + } + } + + @Nested + class RecordUsedAsIdentifierAllowedAsFieldDeclarations { + @Test + void recordUsedAsFieldIdentifierInClass() { + String s = "class X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + + @Test + void recordUsedAsFieldIdentifierInInterface() { + String s = "interface X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + } + + @Nested + class RecordDeclarationPermitted { + @Test + void recordDeclaration() { + String s = "record X() { }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java14ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java14ValidatorTest.java new file mode 100644 index 0000000..243939c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java14ValidatorTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParseStart.EXPRESSION; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_14; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class Java14ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_14)); + + // TODO: Confirm FORBIDDEN - pattern matching instanceof + + // TODO: Confirm PERMITTED - text blocks permitted + + @Nested + class SwitchExpr { + @Test + void switchExprAllowed() { + ParseResult result = + javaParser.parse(EXPRESSION, provider("switch(x){case 3 -> System.out.println(0);}")); + assertNoProblems(result); + } + + @Test + void noSwitchDefaultCaseAllowed() { + ParseResult result = + javaParser.parse(EXPRESSION, provider("switch(x){case null, default -> System.out.println(0);}")); + assertProblems( + result, + "(line 1,col 11) Switch case null, default not supported. Pay attention that this feature is supported starting from 'JAVA_21' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void noSwitchPatternAllowed() { + ParseResult result = + javaParser.parse(EXPRESSION, provider("switch(x){case String s -> System.out.println(0);}")); + assertProblems( + result, + "(line 1,col 11) Switch patterns not supported. Pay attention that this feature is supported starting from 'JAVA_21' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + } + /** + * Records are available within Java 14 (preview), Java 15 (2nd preview), and Java 16 (release). + * The introduction of records means that they are no longer able to be used as identifiers. + */ + @Nested + class Record { + + @Nested + class RecordAsIdentifierPermitted { + @Test + void recordUsedAsClassName() { + String s = "public class record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + + @Test + void recordUsedAsFieldName() { + String s = "class X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + } + + @Nested + class RecordDeclarationForbidden { + @Test + void recordDeclaration() { + String s = "record X() { }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertProblems( + result, + "(line 1,col 1) Record Declarations are not supported. Pay attention that this feature is supported starting from 'JAVA_14' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java15PreviewValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java15PreviewValidatorTest.java new file mode 100644 index 0000000..8737bf6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java15PreviewValidatorTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_15_PREVIEW; +import static com.github.javaparser.Providers.provider; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class Java15PreviewValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_15_PREVIEW)); + + /** + * Records are available within Java 14 (preview), Java 15 (2nd preview), and Java 16 (release). + * The introduction of records means that they are no longer able to be used as identifiers. + */ + @Nested + class Record { + + @Nested + class RecordAsTypeIdentifierForbidden { + @Test + void recordUsedAsClassIdentifier() { + String s = "public class record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 14) 'record' is a restricted identifier and cannot be used for type declarations"); + } + + @Test + void recordUsedAsEnumIdentifier() { + String s = "public enum record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 13) 'record' is a restricted identifier and cannot be used for type declarations"); + } + + @Test + void recordUsedAsRecordIdentifier() { + String s = "public record record() {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 15) 'record' is a restricted identifier and cannot be used for type declarations"); + } + } + + @Nested + class RecordUsedAsIdentifierAllowedAsFieldDeclarations { + @Test + void recordUsedAsFieldIdentifierInClass() { + String s = "class X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + + @Test + void recordUsedAsFieldIdentifierInInterface() { + String s = "interface X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + } + + @Nested + class RecordDeclarationPermitted { + @Test + void recordDeclaration() { + String s = "record X() { }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java15ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java15ValidatorTest.java new file mode 100644 index 0000000..055a039 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java15ValidatorTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_15; +import static com.github.javaparser.Providers.provider; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class Java15ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_15)); + + // TODO: Confirm PERMITTED - text blocks + + /** + * Records are available within Java 14 (preview), Java 15 (2nd preview), and Java 16 (release). + * The introduction of records means that they are no longer able to be used as identifiers. + */ + @Nested + class Record { + + @Nested + class RecordAsIdentifierPermitted { + @Test + void recordUsedAsClassName() { + String s = "public class record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + + @Test + void recordUsedAsFieldName() { + String s = "class X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertNoProblems(result); + } + } + + @Nested + class RecordDeclarationForbidden { + @Test + void recordDeclaration() { + String s = "record X() { }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + TestUtils.assertProblems( + result, + "(line 1,col 1) Record Declarations are not supported. Pay attention that this feature is supported starting from 'JAVA_14' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java16PreviewValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java16PreviewValidatorTest.java new file mode 100644 index 0000000..0f55fc8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java16PreviewValidatorTest.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_16_PREVIEW; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParserConfiguration; + +class Java16PreviewValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_16_PREVIEW)); +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java16ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java16ValidatorTest.java new file mode 100644 index 0000000..ea178cf --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java16ValidatorTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_16; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class Java16ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_16)); + + @Test + void localInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{ void x() {" + "interface I{}}}")); + assertNoProblems(result); + } + + @Nested + class Yield { + @Test + void yieldAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3: yield 6;}")); + assertNoProblems(result); + } + } + + @Nested + class PatternMatching { + @Test + void patternMatchingAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("if (a instanceof String s) {}")); + assertNoProblems(result); + } + + @Test + void recordPatternsForbidden() { + ParseResult result = javaParser.parse(STATEMENT, provider("if (a instanceof Box(String s)) {}")); + assertProblems( + result, + "(line 1,col 18) Record patterns are not supported. Pay attention that this feature is supported starting from 'JAVA_21' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + } + + /** + * Records are available within Java 14 (preview), Java 15 (2nd preview), and Java 16 (release). + * The introduction of records means that they are no longer able to be used as identifiers. + */ + @Nested + class Record { + + @Nested + class RecordAsTypeIdentifierForbidden { + @Test + void recordUsedAsClassIdentifier() { + String s = "public class record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertProblems( + result, + "(line 1,col 14) 'record' is a restricted identifier and cannot be used for type declarations"); + } + + @Test + void recordUsedAsEnumIdentifier() { + String s = "public enum record {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertProblems( + result, + "(line 1,col 13) 'record' is a restricted identifier and cannot be used for type declarations"); + } + + @Test + void recordUsedAsRecordIdentifier() { + String s = "public record record() {}"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertProblems( + result, + "(line 1,col 15) 'record' is a restricted identifier and cannot be used for type declarations"); + } + } + + @Nested + class RecordUsedAsIdentifierAllowedAsFieldDeclarations { + @Test + void recordUsedAsFieldIdentifierInClass() { + String s = "class X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertNoProblems(result); + } + + @Test + void recordUsedAsFieldIdentifierInInterface() { + String s = "interface X { int record; }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertNoProblems(result); + } + } + + @Nested + class RecordDeclarationPermitted { + @Test + void recordDeclaration() { + String s = "record X() { }"; + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(s)); + assertNoProblems(result); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java17ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java17ValidatorTest.java new file mode 100644 index 0000000..5e0eba6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java17ValidatorTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_17; +import static com.github.javaparser.Providers.provider; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class Java17ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_17)); + + @Nested + class Sealed { + + @Test + void sealedAllowed() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("sealed class X permits Y, Z {}")); + TestUtils.assertNoProblems(result); + } + + @Test + void nonSealedAllowed() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("non-sealed class X {}")); + TestUtils.assertNoProblems(result); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java18ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java18ValidatorTest.java new file mode 100755 index 0000000..7c39b1b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java18ValidatorTest.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_18; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParserConfiguration; + +class Java18ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_18)); +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java19ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java19ValidatorTest.java new file mode 100755 index 0000000..5ae7a73 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java19ValidatorTest.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_19; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParserConfiguration; + +class Java19ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_19)); +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_0ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_0ValidatorTest.java new file mode 100644 index 0000000..72a2ca6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_0ValidatorTest.java @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.*; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_1_0; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java1_0ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_1_0)); + + @Test + void tryWithoutResources() { + ParseResult result = javaParser.parse(STATEMENT, provider("try(X x=new Y()){}")); + assertProblems( + result, + "(line 1,col 1) Try has no finally and no catch. Pay attention that this feature is supported starting from 'JAVA_7' language level. If you need that feature the language level must be configured in the configuration before parsing the source files.", + "(line 1,col 1) Catch with resource is not supported. Pay attention that this feature is supported starting from 'JAVA_7' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void classExtendingMoreThanOne() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("class X extends Y, Z {}")); + assertProblems(result, "(line 1,col 20) A class cannot extend more than one other class."); + } + + @Test + void interfaceUsingImplements() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X implements Y {}")); + assertProblems(result, "(line 1,col 24) An interface cannot implement other interfaces."); + } + + @Test + void interfaceWithInitializer() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("interface X {{}}")); + assertProblems(result, "(line 1,col 14) An interface cannot have initializers."); + } + + @Test + void defaultInClass() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X {default void a(){};}")); + assertProblems(result, "(line 1,col 10) 'default' is not allowed here."); + } + + @Test + void leftHandAssignmentCannotBeAConditional() { + ParseResult result = javaParser.parse(EXPRESSION, provider("(1==2)=3")); + assertProblems(result, "(line 1,col 1) Illegal left hand side of an assignment."); + } + + @Test + void leftHandAssignmentCannotBeEmptyBraces() { + ParseResult result = javaParser.parse(EXPRESSION, provider("()=3")); + assertProblems( + result, + "(line 1,col 1) Illegal left hand side of an assignment.", + "(line 1,col 1) Lambdas are not supported. Pay attention that this feature is supported starting from 'JAVA_8' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void leftHandAssignmentCanBeInBraces() { + ParseResult result = javaParser.parse(EXPRESSION, provider("(i) += (i) += 1")); + assertNoProblems(result); + } + + @Test + void noInnerClasses() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("class X{class Y{}}")); + assertProblems( + result, + "(line 1,col 9) inner classes or interfaces are not supported. Pay attention that this feature is supported starting from 'JAVA_1_1' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void noReflection() { + ParseResult result = javaParser.parse(EXPRESSION, provider("Abc.class")); + assertProblems( + result, + "(line 1,col 1) Reflection is not supported. Pay attention that this feature is supported starting from 'JAVA_1_1' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void noForEach() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(X x : xs){}")); + assertProblems( + result, + "(line 1,col 1) For-each loops are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void labelBreakAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3: break bla;}")); + assertNoProblems(result); + } + + @Test + void emptyBreakAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case 3: break;}")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_1ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_1ValidatorTest.java new file mode 100644 index 0000000..9a8aa6b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_1ValidatorTest.java @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.*; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_1_1; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java1_1ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_1_1)); + + public static final String allModifiers = + "public protected private abstract static final transient volatile synchronized native strictfp transitive default "; + + @Test + void topClass() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(allModifiers + "class X{}")); + assertProblems( + result, + "(line 1,col 1) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 1) Can have only one of 'final', 'abstract'.", + "(line 1,col 1) 'transient' is not allowed here.", + "(line 1,col 1) 'default' is not allowed here.", + "(line 1,col 1) 'volatile' is not allowed here.", + "(line 1,col 1) 'strictfp' is not allowed here.", + "(line 1,col 1) 'private' is not allowed here.", + "(line 1,col 1) 'protected' is not allowed here.", + "(line 1,col 1) 'synchronized' is not allowed here.", + "(line 1,col 1) 'native' is not allowed here.", + "(line 1,col 1) 'transitive' is not allowed here.", + "(line 1,col 1) 'static' is not allowed here."); + } + + @Test + void nestedClass() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "class I{}}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void localClass() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{ void x() {" + allModifiers + "class I{}}}")); + assertProblems( + result, + "(line 1,col 20) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 20) Can have only one of 'final', 'abstract'.", + "(line 1,col 20) 'transient' is not allowed here.", + "(line 1,col 20) 'volatile' is not allowed here.", + "(line 1,col 20) 'default' is not allowed here.", + "(line 1,col 20) 'synchronized' is not allowed here.", + "(line 1,col 20) 'native' is not allowed here.", + "(line 1,col 20) 'transitive' is not allowed here.", + "(line 1,col 20) 'strictfp' is not allowed here.", + "(line 1,col 20) 'static' is not allowed here.", + "(line 1,col 20) 'public' is not allowed here.", + "(line 1,col 20) 'private' is not allowed here.", + "(line 1,col 20) 'protected' is not allowed here."); + } + + @Test + void topInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider(allModifiers + "interface X{}")); + assertProblems( + result, + "(line 1,col 1) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 1) Can have only one of 'final', 'abstract'.", + "(line 1,col 1) 'transient' is not allowed here.", + "(line 1,col 1) 'volatile' is not allowed here.", + "(line 1,col 1) 'default' is not allowed here.", + "(line 1,col 1) 'strictfp' is not allowed here.", + "(line 1,col 1) 'synchronized' is not allowed here.", + "(line 1,col 1) 'native' is not allowed here.", + "(line 1,col 1) 'transitive' is not allowed here.", + "(line 1,col 1) 'static' is not allowed here.", + "(line 1,col 1) 'final' is not allowed here.", + "(line 1,col 1) 'private' is not allowed here.", + "(line 1,col 1) 'protected' is not allowed here."); + } + + @Test + void nestedInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "interface I{}}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'final' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void constructor() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "X(){};}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'final' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'abstract' is not allowed here.", + "(line 1,col 9) 'static' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void constructorParameter() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{X(" + allModifiers + " int i){};}")); + assertProblems( + result, + "(line 1,col 11) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 11) Can have only one of 'final', 'abstract'.", + "(line 1,col 11) 'transient' is not allowed here.", + "(line 1,col 11) 'volatile' is not allowed here.", + "(line 1,col 11) 'synchronized' is not allowed here.", + "(line 1,col 11) 'native' is not allowed here.", + "(line 1,col 11) 'strictfp' is not allowed here.", + "(line 1,col 11) 'default' is not allowed here.", + "(line 1,col 11) 'abstract' is not allowed here.", + "(line 1,col 11) 'static' is not allowed here.", + "(line 1,col 11) 'transitive' is not allowed here.", + "(line 1,col 11) 'private' is not allowed here.", + "(line 1,col 11) 'public' is not allowed here.", + "(line 1,col 11) 'protected' is not allowed here."); + } + + @Test + void classMethod() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "int x(){};}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Cannot be 'abstract' and also 'private', 'static', 'final', 'native', 'strictfp', 'synchronized'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void interfaceMethod() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X{" + allModifiers + "int x(){};}")); + assertProblems( + result, + "(line 1,col 13) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 13) Can have only one of 'final', 'abstract'.", + "(line 1,col 13) Cannot be 'abstract' and also 'private', 'static', 'final', 'native', 'strictfp', 'synchronized'.", + "(line 1,col 13) 'transient' is not allowed here.", + "(line 1,col 13) 'strictfp' is not allowed here.", + "(line 1,col 13) 'volatile' is not allowed here.", + "(line 1,col 13) 'default' is not allowed here.", + "(line 1,col 13) 'transitive' is not allowed here.", + "(line 1,col 13) 'private' is not allowed here.", + "(line 1,col 13) 'static' is not allowed here."); + } + + @Test + void methodParameter() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{int x(" + allModifiers + " int i){};}")); + assertProblems( + result, + "(line 1,col 15) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 15) Can have only one of 'final', 'abstract'.", + "(line 1,col 15) 'transient' is not allowed here.", + "(line 1,col 15) 'volatile' is not allowed here.", + "(line 1,col 15) 'synchronized' is not allowed here.", + "(line 1,col 15) 'native' is not allowed here.", + "(line 1,col 15) 'strictfp' is not allowed here.", + "(line 1,col 15) 'abstract' is not allowed here.", + "(line 1,col 15) 'default' is not allowed here.", + "(line 1,col 15) 'static' is not allowed here.", + "(line 1,col 15) 'transitive' is not allowed here.", + "(line 1,col 15) 'private' is not allowed here.", + "(line 1,col 15) 'public' is not allowed here.", + "(line 1,col 15) 'protected' is not allowed here."); + } + + @Test + void field() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "int i;}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'abstract' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void localVariable() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{int x(){" + allModifiers + "int i;}}")); + assertProblems( + result, + "(line 1,col 17) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 17) Can have only one of 'final', 'abstract'.", + "(line 1,col 17) 'transient' is not allowed here.", + "(line 1,col 17) 'volatile' is not allowed here.", + "(line 1,col 17) 'synchronized' is not allowed here.", + "(line 1,col 17) 'native' is not allowed here.", + "(line 1,col 17) 'default' is not allowed here.", + "(line 1,col 17) 'strictfp' is not allowed here.", + "(line 1,col 17) 'abstract' is not allowed here.", + "(line 1,col 17) 'static' is not allowed here.", + "(line 1,col 17) 'transitive' is not allowed here.", + "(line 1,col 17) 'private' is not allowed here.", + "(line 1,col 17) 'public' is not allowed here.", + "(line 1,col 17) 'protected' is not allowed here."); + } + + @Test + void catchParameter() { + ParseResult result = javaParser.parse( + COMPILATION_UNIT, provider("class X{int x(){ try{}catch(" + allModifiers + " Integer x){}}}")); + assertProblems( + result, + "(line 1,col 29) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 29) Can have only one of 'final', 'abstract'.", + "(line 1,col 29) 'transient' is not allowed here.", + "(line 1,col 29) 'volatile' is not allowed here.", + "(line 1,col 29) 'synchronized' is not allowed here.", + "(line 1,col 29) 'native' is not allowed here.", + "(line 1,col 29) 'default' is not allowed here.", + "(line 1,col 29) 'strictfp' is not allowed here.", + "(line 1,col 29) 'abstract' is not allowed here.", + "(line 1,col 29) 'static' is not allowed here.", + "(line 1,col 29) 'transitive' is not allowed here.", + "(line 1,col 29) 'private' is not allowed here.", + "(line 1,col 29) 'public' is not allowed here.", + "(line 1,col 29) 'protected' is not allowed here."); + } + + @Test + void innerClasses() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("class X{class Y{}}")); + assertNoProblems(result); + } + + @Test + void localInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{ void x() {" + allModifiers + "interface I{}}}")); + assertProblems( + result, + "(line 1,col 20) There is no such thing as a local interface. Pay attention that this feature is supported starting from 'JAVA_16' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void reflection() { + ParseResult result = javaParser.parse(EXPRESSION, provider("Abc.class")); + assertNoProblems(result); + } + + @Test + void strictfpAllowedAsIdentifier() { + ParseResult result = javaParser.parse(STATEMENT, provider("int strictfp;")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_2ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_2ValidatorTest.java new file mode 100644 index 0000000..0b27eda --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_2ValidatorTest.java @@ -0,0 +1,308 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_1_2; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java1_2ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_1_2)); + + private final String allModifiers = + "public protected private abstract static final transient volatile synchronized native strictfp transitive default "; + + @Test + void topClass() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(allModifiers + "class X{}")); + assertProblems( + result, + "(line 1,col 1) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 1) Can have only one of 'final', 'abstract'.", + "(line 1,col 1) Can have only one of 'native', 'strictfp'.", + "(line 1,col 1) 'transient' is not allowed here.", + "(line 1,col 1) 'default' is not allowed here.", + "(line 1,col 1) 'volatile' is not allowed here.", + "(line 1,col 1) 'private' is not allowed here.", + "(line 1,col 1) 'protected' is not allowed here.", + "(line 1,col 1) 'synchronized' is not allowed here.", + "(line 1,col 1) 'native' is not allowed here.", + "(line 1,col 1) 'transitive' is not allowed here.", + "(line 1,col 1) 'static' is not allowed here."); + } + + @Test + void nestedClass() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "class I{}}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void localClass() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{ void x() {" + allModifiers + "class I{}}}")); + assertProblems( + result, + "(line 1,col 20) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 20) Can have only one of 'final', 'abstract'.", + "(line 1,col 20) Can have only one of 'native', 'strictfp'.", + "(line 1,col 20) 'transient' is not allowed here.", + "(line 1,col 20) 'volatile' is not allowed here.", + "(line 1,col 20) 'default' is not allowed here.", + "(line 1,col 20) 'synchronized' is not allowed here.", + "(line 1,col 20) 'native' is not allowed here.", + "(line 1,col 20) 'transitive' is not allowed here.", + "(line 1,col 20) 'static' is not allowed here.", + "(line 1,col 20) 'public' is not allowed here.", + "(line 1,col 20) 'private' is not allowed here.", + "(line 1,col 20) 'protected' is not allowed here."); + } + + @Test + void topInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider(allModifiers + "interface X{}")); + assertProblems( + result, + "(line 1,col 1) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 1) Can have only one of 'final', 'abstract'.", + "(line 1,col 1) Can have only one of 'native', 'strictfp'.", + "(line 1,col 1) 'transient' is not allowed here.", + "(line 1,col 1) 'volatile' is not allowed here.", + "(line 1,col 1) 'default' is not allowed here.", + "(line 1,col 1) 'synchronized' is not allowed here.", + "(line 1,col 1) 'native' is not allowed here.", + "(line 1,col 1) 'transitive' is not allowed here.", + "(line 1,col 1) 'static' is not allowed here.", + "(line 1,col 1) 'final' is not allowed here.", + "(line 1,col 1) 'private' is not allowed here.", + "(line 1,col 1) 'protected' is not allowed here."); + } + + @Test + void nestedInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "interface I{}}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'final' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void constructor() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "X(){};}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'final' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'abstract' is not allowed here.", + "(line 1,col 9) 'static' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void constructorParameter() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{X(" + allModifiers + " int i){};}")); + assertProblems( + result, + "(line 1,col 11) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 11) Can have only one of 'final', 'abstract'.", + "(line 1,col 11) Can have only one of 'native', 'strictfp'.", + "(line 1,col 11) 'transient' is not allowed here.", + "(line 1,col 11) 'volatile' is not allowed here.", + "(line 1,col 11) 'synchronized' is not allowed here.", + "(line 1,col 11) 'native' is not allowed here.", + "(line 1,col 11) 'strictfp' is not allowed here.", + "(line 1,col 11) 'default' is not allowed here.", + "(line 1,col 11) 'abstract' is not allowed here.", + "(line 1,col 11) 'static' is not allowed here.", + "(line 1,col 11) 'transitive' is not allowed here.", + "(line 1,col 11) 'private' is not allowed here.", + "(line 1,col 11) 'public' is not allowed here.", + "(line 1,col 11) 'protected' is not allowed here."); + } + + @Test + void classMethod() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "int x(){};}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) Cannot be 'abstract' and also 'private', 'static', 'final', 'native', 'strictfp', 'synchronized'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void interfaceMethod() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X{" + allModifiers + "int x(){};}")); + assertProblems( + result, + "(line 1,col 13) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 13) Can have only one of 'final', 'abstract'.", + "(line 1,col 13) Can have only one of 'native', 'strictfp'.", + "(line 1,col 13) Cannot be 'abstract' and also 'private', 'static', 'final', 'native', 'strictfp', 'synchronized'.", + "(line 1,col 13) 'transient' is not allowed here.", + "(line 1,col 13) 'volatile' is not allowed here.", + "(line 1,col 13) 'default' is not allowed here.", + "(line 1,col 13) 'transitive' is not allowed here.", + "(line 1,col 13) 'private' is not allowed here.", + "(line 1,col 13) 'static' is not allowed here."); + } + + @Test + void methodParameter() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{int x(" + allModifiers + " int i){};}")); + assertProblems( + result, + "(line 1,col 15) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 15) Can have only one of 'final', 'abstract'.", + "(line 1,col 15) Can have only one of 'native', 'strictfp'.", + "(line 1,col 15) 'transient' is not allowed here.", + "(line 1,col 15) 'volatile' is not allowed here.", + "(line 1,col 15) 'synchronized' is not allowed here.", + "(line 1,col 15) 'native' is not allowed here.", + "(line 1,col 15) 'strictfp' is not allowed here.", + "(line 1,col 15) 'abstract' is not allowed here.", + "(line 1,col 15) 'default' is not allowed here.", + "(line 1,col 15) 'static' is not allowed here.", + "(line 1,col 15) 'transitive' is not allowed here.", + "(line 1,col 15) 'private' is not allowed here.", + "(line 1,col 15) 'public' is not allowed here.", + "(line 1,col 15) 'protected' is not allowed here."); + } + + @Test + void field() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "int i;}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'strictfp' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'abstract' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void localVariable() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{int x(){" + allModifiers + "int i;}}")); + assertProblems( + result, + "(line 1,col 17) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 17) Can have only one of 'final', 'abstract'.", + "(line 1,col 17) Can have only one of 'native', 'strictfp'.", + "(line 1,col 17) 'transient' is not allowed here.", + "(line 1,col 17) 'volatile' is not allowed here.", + "(line 1,col 17) 'synchronized' is not allowed here.", + "(line 1,col 17) 'native' is not allowed here.", + "(line 1,col 17) 'default' is not allowed here.", + "(line 1,col 17) 'strictfp' is not allowed here.", + "(line 1,col 17) 'abstract' is not allowed here.", + "(line 1,col 17) 'static' is not allowed here.", + "(line 1,col 17) 'transitive' is not allowed here.", + "(line 1,col 17) 'private' is not allowed here.", + "(line 1,col 17) 'public' is not allowed here.", + "(line 1,col 17) 'protected' is not allowed here."); + } + + @Test + void catchParameter() { + ParseResult result = javaParser.parse( + COMPILATION_UNIT, provider("class X{int x(){ try{}catch(" + allModifiers + " Integer x){}}}")); + assertProblems( + result, + "(line 1,col 29) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 29) Can have only one of 'final', 'abstract'.", + "(line 1,col 29) Can have only one of 'native', 'strictfp'.", + "(line 1,col 29) 'transient' is not allowed here.", + "(line 1,col 29) 'volatile' is not allowed here.", + "(line 1,col 29) 'synchronized' is not allowed here.", + "(line 1,col 29) 'native' is not allowed here.", + "(line 1,col 29) 'default' is not allowed here.", + "(line 1,col 29) 'strictfp' is not allowed here.", + "(line 1,col 29) 'abstract' is not allowed here.", + "(line 1,col 29) 'static' is not allowed here.", + "(line 1,col 29) 'transitive' is not allowed here.", + "(line 1,col 29) 'private' is not allowed here.", + "(line 1,col 29) 'public' is not allowed here.", + "(line 1,col 29) 'protected' is not allowed here."); + } + + @Test + void strictfpNotAllowedAsIdentifier() { + ParseResult result = javaParser.parse(STATEMENT, provider("int strictfp;")); + assertProblems(result, "(line 1,col 5) 'strictfp' cannot be used as an identifier as it is a keyword."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_3ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_3ValidatorTest.java new file mode 100644 index 0000000..da62bc5 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_3ValidatorTest.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_1_3; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java1_3ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_1_3)); + + @Test + void noAssert() { + ParseResult result = javaParser.parse(STATEMENT, provider("assert a;")); + assertProblems( + result, + "(line 1,col 1) 'assert' keyword is not supported. Pay attention that this feature is supported starting from 'JAVA_1_4' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_4ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_4ValidatorTest.java new file mode 100644 index 0000000..1e68214 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java1_4ValidatorTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.*; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_1_4; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java1_4ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_1_4)); + + @Test + void yesAssert() { + ParseResult result = javaParser.parse(STATEMENT, provider("assert a;")); + assertNoProblems(result); + } + + @Test + void noGenerics() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{List b;}")); + assertProblems( + result, + "(line 1,col 1) Generics are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files.", + "(line 1,col 12) Generics are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void noAnnotations() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("@Abc @Def() @Ghi(a=3) @interface X{}")); + assertProblems( + result, + "(line 1,col 13) Annotations are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files.", + "(line 1,col 1) Annotations are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files.", + "(line 1,col 6) Annotations are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void novarargs() { + ParseResult result = javaParser.parse(PARAMETER, provider("String... x")); + assertProblems( + result, + "(line 1,col 1) Varargs are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void noforeach() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(X x: xs){}")); + assertProblems( + result, + "(line 1,col 1) For-each loops are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void staticImport() { + ParseResult result = javaParser.parse( + COMPILATION_UNIT, provider("import static x;import static x.*;import x.X;import x.*;")); + assertProblems( + result, + "(line 1,col 1) Static imports are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files.", + "(line 1,col 17) Static imports are not supported. Pay attention that this feature is supported starting from 'JAVA_5' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void enumAllowedAsIdentifier() { + ParseResult result = javaParser.parse(STATEMENT, provider("int enum;")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java20ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java20ValidatorTest.java new file mode 100755 index 0000000..27a5d8b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java20ValidatorTest.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_20; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParserConfiguration; + +class Java20ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_20)); +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java21ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java21ValidatorTest.java new file mode 100755 index 0000000..faba6e6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java21ValidatorTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.EXPRESSION; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_21; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Test; + +class Java21ValidatorTest { + + private final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_21)); + + @Test + void switchDefaultCaseAllowed() { + ParseResult result = + javaParser.parse(EXPRESSION, provider("switch(x){case null, default -> System.out.println(0);}")); + assertNoProblems(result); + } + + @Test + void switchPatternWithGuardAllowed() { + ParseResult result = javaParser.parse( + EXPRESSION, provider("switch(x){case String s when s.length() > 5 -> System.out.println(0);}")); + assertNoProblems(result); + } + + @Test + void recordPatternsAllowed() { + ParseResult result = javaParser.parse(STATEMENT, provider("if (a instanceof Box(String s)) {}")); + TestUtils.assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java5ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java5ValidatorTest.java new file mode 100644 index 0000000..12adadc --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java5ValidatorTest.java @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.*; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_5; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.ast.validator.Java1_1ValidatorTest.allModifiers; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java5ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_5)); + + @Test + void genericsWithoutDiamond() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{List b = new ArrayList<>();}")); + assertProblems( + result, + "(line 1,col 33) The diamond operator is not supported. Pay attention that this feature is supported starting from 'JAVA_7' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void topAnnotationDeclaration() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider(allModifiers + "@interface X{}")); + assertProblems( + result, + "(line 1,col 1) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 1) Can have only one of 'final', 'abstract'.", + "(line 1,col 1) Can have only one of 'native', 'strictfp'.", + "(line 1,col 1) 'transient' is not allowed here.", + "(line 1,col 1) 'volatile' is not allowed here.", + "(line 1,col 1) 'synchronized' is not allowed here.", + "(line 1,col 1) 'default' is not allowed here.", + "(line 1,col 1) 'native' is not allowed here.", + "(line 1,col 1) 'transitive' is not allowed here.", + "(line 1,col 1) 'static' is not allowed here.", + "(line 1,col 1) 'final' is not allowed here.", + "(line 1,col 1) 'private' is not allowed here.", + "(line 1,col 1) 'protected' is not allowed here."); + } + + @Test + void nestedAnnotationDeclaration() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "@interface I{}}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'final' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void annotationMember() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("@interface X{" + allModifiers + "int x();}")); + assertProblems( + result, + "(line 1,col 14) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 14) Can have only one of 'final', 'abstract'.", + "(line 1,col 14) Can have only one of 'native', 'strictfp'.", + "(line 1,col 14) 'transient' is not allowed here.", + "(line 1,col 14) 'volatile' is not allowed here.", + "(line 1,col 14) 'final' is not allowed here.", + "(line 1,col 14) 'synchronized' is not allowed here.", + "(line 1,col 14) 'default' is not allowed here.", + "(line 1,col 14) 'native' is not allowed here.", + "(line 1,col 14) 'protected' is not allowed here.", + "(line 1,col 14) 'private' is not allowed here.", + "(line 1,col 14) 'strictfp' is not allowed here.", + "(line 1,col 14) 'static' is not allowed here.", + "(line 1,col 14) 'transitive' is not allowed here."); + } + + @Test + void topEnum() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider(allModifiers + "enum X{}")); + assertProblems( + result, + "(line 1,col 1) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 1) Can have only one of 'final', 'abstract'.", + "(line 1,col 1) Can have only one of 'native', 'strictfp'.", + "(line 1,col 1) 'transient' is not allowed here.", + "(line 1,col 1) 'volatile' is not allowed here.", + "(line 1,col 1) 'synchronized' is not allowed here.", + "(line 1,col 1) 'default' is not allowed here.", + "(line 1,col 1) 'native' is not allowed here.", + "(line 1,col 1) 'transitive' is not allowed here.", + "(line 1,col 1) 'static' is not allowed here.", + "(line 1,col 1) 'abstract' is not allowed here.", + "(line 1,col 1) 'final' is not allowed here.", + "(line 1,col 1) 'private' is not allowed here.", + "(line 1,col 1) 'protected' is not allowed here."); + } + + @Test + void nestedEnum() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{" + allModifiers + "enum I{}}")); + assertProblems( + result, + "(line 1,col 9) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 9) Can have only one of 'final', 'abstract'.", + "(line 1,col 9) Can have only one of 'native', 'strictfp'.", + "(line 1,col 9) 'transient' is not allowed here.", + "(line 1,col 9) 'volatile' is not allowed here.", + "(line 1,col 9) 'default' is not allowed here.", + "(line 1,col 9) 'abstract' is not allowed here.", + "(line 1,col 9) 'final' is not allowed here.", + "(line 1,col 9) 'synchronized' is not allowed here.", + "(line 1,col 9) 'native' is not allowed here.", + "(line 1,col 9) 'transitive' is not allowed here."); + } + + @Test + void varargs() { + ParseResult result = javaParser.parse(PARAMETER, provider("String... x")); + assertNoProblems(result); + } + + @Test + void foreach() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(X x: xs){}")); + assertNoProblems(result); + } + + @Test + void noMultipleVariablesInForEach() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(int i, j : nums){}")); + assertProblems( + result, + "(line 1,col 1) A foreach statement's variable declaration must have exactly one variable declarator. Given: 2."); + } + + @Test + void noModifiersInForEachBesideFinal() { + ParseResult result = javaParser.parse(STATEMENT, provider("for(static transient int i : nums){}")); + assertProblems( + result, + "(line 1,col 5) 'static' is not allowed here.", + "(line 1,col 5) 'transient' is not allowed here."); + } + + @Test + void staticImport() { + ParseResult result = javaParser.parse( + COMPILATION_UNIT, provider("import static x;import static x.*;import x.X;import x.*;")); + assertNoProblems(result); + } + + @Test + void noPrimitiveTypeArguments() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("class X extends Y {}")); + assertProblems(result, "(line 1,col 17) Type arguments may not be primitive."); + } + + @Test + void enumAllowedAsIdentifier() { + ParseResult result = javaParser.parse(STATEMENT, provider("int enum;")); + assertProblems(result, "(line 1,col 5) 'enum' cannot be used as an identifier as it is a keyword."); + } + + @Test + void enumAllowedInSwitch() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case GREEN: ;}")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java6ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java6ValidatorTest.java new file mode 100644 index 0000000..cb0eed8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java6ValidatorTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.EXPRESSION; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_6; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java6ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_6)); + + @Test + void nobinaryIntegerLiterals() { + ParseResult result = javaParser.parse(EXPRESSION, provider("0b01")); + assertProblems(result, "(line 1,col 1) Binary literal values are not supported."); + } + + @Test + void noUnderscoresInIntegerLiterals() { + ParseResult result = javaParser.parse(EXPRESSION, provider("1_000_000")); + assertProblems(result, "(line 1,col 1) Underscores in literal values are not supported."); + } + + @Test + void noMultiCatch() { + ParseResult result = javaParser.parse(STATEMENT, provider("try{}catch(Abc|Def e){}")); + assertProblems( + result, + "(line 1,col 12) Multi-catch is not supported. Pay attention that this feature is supported starting from 'JAVA_7' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java7ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java7ValidatorTest.java new file mode 100644 index 0000000..4b519e6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java7ValidatorTest.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.*; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_7; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.Problem; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.UnionType; +import com.github.javaparser.ast.validator.language_level_validations.Java7Validator; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class Java7ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_7)); + + @Test + void generics() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X{List b = new ArrayList<>();}")); + assertNoProblems(result); + } + + @Test + void defaultMethodWithoutBody() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X {default void a();}")); + assertProblems(result, "(line 1,col 14) 'default' is not allowed here."); + } + + @Test + void tryWithoutAnything() { + ParseResult result = javaParser.parse(STATEMENT, provider("try{}")); + assertProblems(result, "(line 1,col 1) Try has no finally, no catch, and no resources."); + } + + @Test + void tryWithResourceVariableDeclaration() { + ParseResult result = javaParser.parse(STATEMENT, provider("try(Reader r = new Reader()){}")); + assertNoProblems(result); + } + + @Test + void tryWithResourceReference() { + ParseResult result = javaParser.parse(STATEMENT, provider("try(a.b.c){}")); + assertProblems(result, "(line 1,col 1) Try with resources only supports variable declarations."); + } + + @Test + void stringsInSwitch() { + ParseResult result = javaParser.parse(STATEMENT, provider("switch(x){case \"abc\": ;}")); + assertNoProblems(result); + } + + @Test + void binaryIntegerLiterals() { + ParseResult result = javaParser.parse(EXPRESSION, provider("0b01")); + assertNoProblems(result); + } + + @Test + void underscoresInIntegerLiterals() { + ParseResult result = javaParser.parse(EXPRESSION, provider("1_000_000")); + assertNoProblems(result); + } + + @Test + void multiCatch() { + ParseResult result = javaParser.parse(STATEMENT, provider("try{}catch(Abc|Def e){}")); + assertNoProblems(result); + } + + @Test + void multiCatchWithoutElements() { + UnionType unionType = new UnionType(); + + List problems = new ArrayList<>(); + new Java7Validator().accept(unionType, new ProblemReporter(problems::add)); + + assertProblems(problems, "UnionType.elements can not be empty."); + } + + @Test + void multiCatchWithOneElement() { + UnionType unionType = new UnionType(); + unionType.getElements().add(new ClassOrInterfaceType()); + + List problems = new ArrayList<>(); + new Java7Validator().accept(unionType, new ProblemReporter(problems::add)); + + assertProblems(problems, "Union type (multi catch) must have at least two elements."); + } + + @Test + void noLambdas() { + ParseResult result = javaParser.parse(STATEMENT, provider("a(() -> 1);")); + assertProblems( + result, + "(line 1,col 3) Lambdas are not supported. Pay attention that this feature is supported starting from 'JAVA_8' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java8ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java8ValidatorTest.java new file mode 100644 index 0000000..45bcd91 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java8ValidatorTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_8; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.ast.validator.Java1_1ValidatorTest.allModifiers; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java8ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_8)); + + @Test + void localInterface() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("class X {void a(){interface I{}};}")); + assertProblems( + result, + "(line 1,col 19) There is no such thing as a local interface. Pay attention that this feature is supported starting from 'JAVA_16' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } + + @Test + void lambdaParameter() { + ParseResult result = javaParser.parse( + COMPILATION_UNIT, provider("class X{int x(){ a((" + allModifiers + " Integer x) -> 10);}}")); + assertProblems( + result, + "(line 1,col 21) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 21) Can have only one of 'final', 'abstract'.", + "(line 1,col 21) Can have only one of 'native', 'strictfp'.", + "(line 1,col 21) 'transient' is not allowed here.", + "(line 1,col 21) 'volatile' is not allowed here.", + "(line 1,col 21) 'synchronized' is not allowed here.", + "(line 1,col 21) 'strictfp' is not allowed here.", + "(line 1,col 21) 'default' is not allowed here.", + "(line 1,col 21) 'native' is not allowed here.", + "(line 1,col 21) 'strictfp' is not allowed here.", + "(line 1,col 21) 'abstract' is not allowed here.", + "(line 1,col 21) 'static' is not allowed here.", + "(line 1,col 21) 'transitive' is not allowed here.", + "(line 1,col 21) 'private' is not allowed here.", + "(line 1,col 21) 'public' is not allowed here.", + "(line 1,col 21) 'protected' is not allowed here."); + } + + @Test + void interfaceMethod() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X{" + allModifiers + "int x(){};}")); + assertProblems( + result, + "(line 1,col 13) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 13) Can have only one of 'final', 'abstract'.", + "(line 1,col 13) Can have only one of 'native', 'strictfp'.", + "(line 1,col 13) Cannot be 'abstract' and also 'private', 'static', 'final', 'native', 'strictfp', 'synchronized'.", + "(line 1,col 13) 'transient' is not allowed here.", + "(line 1,col 13) 'volatile' is not allowed here.", + "(line 1,col 13) 'transitive' is not allowed here.", + "(line 1,col 13) 'private' is not allowed here."); + } + + @Test + void defaultMethodWithoutBody() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X {default void a();}")); + assertProblems(result, "(line 1,col 14) 'default' methods must have a body."); + } + + @Test + void lambdas() { + ParseResult result = javaParser.parse(STATEMENT, provider("a(() -> 1);")); + assertNoProblems(result); + } + + @Test + void noModules() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("open module x {}")); + assertProblems( + result, + "(line 1,col 1) Modules are not supported. Pay attention that this feature is supported starting from 'JAVA_9' language level. If you need that feature the language level must be configured in the configuration before parsing the source files."); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java9ValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java9ValidatorTest.java new file mode 100644 index 0000000..d6527d5 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/Java9ValidatorTest.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_9; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.ast.validator.Java1_1ValidatorTest.allModifiers; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; +import static com.github.javaparser.utils.TestUtils.assertProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class Java9ValidatorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_9)); + + @Test + void underscoreIdentifiers() { + ParseResult result = javaParser.parse(STATEMENT, provider("a.b._.c.d = act(_, _ -> _);")); + assertProblems( + result, + "(line 1,col 5) '_' is a reserved keyword.", + "(line 1,col 17) '_' is a reserved keyword.", + "(line 1,col 20) '_' is a reserved keyword.", + "(line 1,col 25) '_' is a reserved keyword."); + } + + @Test + void moduleRequires() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("module x{requires " + allModifiers + " a;}")); + assertProblems( + result, + "(line 1,col 10) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 10) Can have only one of 'final', 'abstract'.", + "(line 1,col 10) Can have only one of 'native', 'strictfp'.", + "(line 1,col 10) 'transient' is not allowed here.", + "(line 1,col 10) 'volatile' is not allowed here.", + "(line 1,col 10) 'final' is not allowed here.", + "(line 1,col 10) 'synchronized' is not allowed here.", + "(line 1,col 10) 'default' is not allowed here.", + "(line 1,col 10) 'native' is not allowed here.", + "(line 1,col 10) 'private' is not allowed here.", + "(line 1,col 10) 'protected' is not allowed here.", + "(line 1,col 10) 'strictfp' is not allowed here.", + "(line 1,col 10) 'abstract' is not allowed here.", + "(line 1,col 10) 'public' is not allowed here."); + } + + @Test + void interfaceMethod() { + ParseResult result = + javaParser.parse(COMPILATION_UNIT, provider("interface X{" + allModifiers + "int x(){};}")); + assertProblems( + result, + "(line 1,col 13) Can have only one of 'public', 'protected', 'private'.", + "(line 1,col 13) Can have only one of 'final', 'abstract'.", + "(line 1,col 13) Can have only one of 'native', 'strictfp'.", + "(line 1,col 13) Cannot be 'abstract' and also 'private', 'static', 'final', 'native', 'strictfp', 'synchronized'.", + "(line 1,col 13) 'transient' is not allowed here.", + "(line 1,col 13) 'volatile' is not allowed here.", + "(line 1,col 13) 'transitive' is not allowed here."); + } + + @Test + void modules() { + ParseResult result = javaParser.parse(COMPILATION_UNIT, provider("open module x {}")); + assertNoProblems(result); + } + + @Test + void tryWithResourceReference() { + ParseResult result = javaParser.parse(STATEMENT, provider("try(a.b.c){}")); + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/VarValidatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/VarValidatorTest.java new file mode 100755 index 0000000..12175bf --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/validator/VarValidatorTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.validator; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.TestUtils.assertNoProblems; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ParserConfiguration.LanguageLevel; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +class VarValidatorTest { + public static final JavaParser javaParser = + new JavaParser(new ParserConfiguration().setLanguageLevel(LanguageLevel.BLEEDING_EDGE)); + + @Test + void typePatternExpr() { + ParseResult result = javaParser.parse( + STATEMENT, provider("switch (shape) {\n" + " case Circle(var radius) -> { } \n" + "}")); + + assertNoProblems(result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/CloneVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/CloneVisitorTest.java new file mode 100644 index 0000000..26cdf66 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/CloneVisitorTest.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parseType; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.type.Type; +import java.util.Iterator; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class CloneVisitorTest { + CompilationUnit cu; + + @BeforeEach + void setUp() { + cu = new CompilationUnit(); + } + + @AfterEach + void teardown() { + cu = null; + } + + @Test + void cloneJavaDocTest() { + NodeList> bodyDeclarationList = new NodeList<>(); + bodyDeclarationList.add(new AnnotationMemberDeclaration().setJavadocComment("javadoc")); + bodyDeclarationList.add(new ConstructorDeclaration().setJavadocComment("javadoc")); + bodyDeclarationList.add(new EnumConstantDeclaration().setJavadocComment("javadoc")); + bodyDeclarationList.add(new FieldDeclaration().setJavadocComment("javadoc")); + bodyDeclarationList.add(new InitializerDeclaration().setJavadocComment("javadoc")); + bodyDeclarationList.add(new MethodDeclaration().setJavadocComment("javadoc")); + + NodeList> typeDeclarationList = new NodeList<>(); + AnnotationDeclaration annotationDeclaration = new AnnotationDeclaration(); + annotationDeclaration.setName("nnotationDeclarationTest"); + typeDeclarationList.add(annotationDeclaration.setJavadocComment("javadoc")); + + ClassOrInterfaceDeclaration classOrInterfaceDeclaration2 = new ClassOrInterfaceDeclaration(); + classOrInterfaceDeclaration2.setName("emptyTypeDeclarationTest"); + typeDeclarationList.add(classOrInterfaceDeclaration2.setJavadocComment("javadoc")); + + EnumDeclaration enumDeclaration = new EnumDeclaration(); + enumDeclaration.setName("enumDeclarationTest"); + typeDeclarationList.add(enumDeclaration.setJavadocComment("javadoc")); + + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration(); + classOrInterfaceDeclaration.setName("classOrInterfaceDeclarationTest"); + typeDeclarationList.add(classOrInterfaceDeclaration.setJavadocComment("javadoc")); + + ClassOrInterfaceDeclaration classOrInterfaceDeclaration1 = new ClassOrInterfaceDeclaration(); + classOrInterfaceDeclaration1.setName("emptyTypeDeclarationTest1"); + typeDeclarationList.add(classOrInterfaceDeclaration2.setMembers(bodyDeclarationList)); + + cu.setTypes(typeDeclarationList); + CompilationUnit cuClone = (CompilationUnit) new CloneVisitor().visit(cu, null); + + NodeList> typeDeclarationListClone = cuClone.getTypes(); + Iterator> typeItr = typeDeclarationListClone.iterator(); + TypeDeclaration typeDeclaration; + while (typeItr.hasNext()) { + typeDeclaration = typeItr.next(); + if (typeDeclaration.getMembers() == null) { + assertEquals("javadoc", typeDeclaration.getComment().get().getContent()); + } else { + Iterator> bodyItr = + typeDeclaration.getMembers().iterator(); + while (bodyItr.hasNext()) { + BodyDeclaration bodyDeclaration = bodyItr.next(); + assertEquals("javadoc", bodyDeclaration.getComment().get().getContent()); + } + } + } + } + + @Test + void cloneAnnotationOnWildcardTypeArgument() { + Type type = parseType("List<@C ? extends Object>").clone(); + assertEquals("List<@C ? extends Object>", type.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapterTest.java new file mode 100644 index 0000000..a440f07 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapterTest.java @@ -0,0 +1,2579 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import java.util.List; +import java.util.Optional; +import org.junit.jupiter.api.Test; +import org.mockito.InOrder; +import org.mockito.Mockito; + +class GenericListVisitorAdapterTest { + + private final GenericListVisitorAdapter visitor = + new GenericListVisitorAdapter() {}; + + @Test + void visit_GivenAnnotationDeclaration() { + // Given + Object argument = mock(Object.class); + AnnotationDeclaration node = mock(AnnotationDeclaration.class); + + // When + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenAnnotationMemberDeclaration() { + // Given + Object argument = mock(Object.class); + AnnotationMemberDeclaration node = mock(AnnotationMemberDeclaration.class); + + // When + Mockito.when(node.getDefaultValue()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getDefaultValue(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayAccessExpr() { + // Given + Object argument = mock(Object.class); + ArrayAccessExpr node = mock(ArrayAccessExpr.class); + + // When + Mockito.when(node.getIndex()).thenReturn(mock(Expression.class)); + Mockito.when(node.getName()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getIndex(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayCreationExpr() { + // Given + Object argument = mock(Object.class); + ArrayCreationExpr node = mock(ArrayCreationExpr.class); + + // When + Mockito.when(node.getElementType()).thenReturn(mock(Type.class)); + Mockito.when(node.getInitializer()).thenReturn(Optional.of(mock(ArrayInitializerExpr.class))); + Mockito.when(node.getLevels()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getElementType(); + order.verify(node, times(2)).getInitializer(); + order.verify(node).getLevels(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayCreationLevel() { + // Given + Object argument = mock(Object.class); + ArrayCreationLevel node = mock(ArrayCreationLevel.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getDimension()).thenReturn(Optional.of(mock(ArrayInitializerExpr.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getDimension(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayInitializerExpr() { + // Given + Object argument = mock(Object.class); + ArrayInitializerExpr node = mock(ArrayInitializerExpr.class); + + // When + Mockito.when(node.getValues()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getValues(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayType() { + // Given + Object argument = mock(Object.class); + ArrayType node = mock(ArrayType.class); + + // When + Mockito.when(node.getComponentType()).thenReturn(mock(Type.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getComponentType(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenAssertStmt() { + // Given + Object argument = mock(Object.class); + AssertStmt node = mock(AssertStmt.class); + + // When + Mockito.when(node.getCheck()).thenReturn(mock(Expression.class)); + Mockito.when(node.getMessage()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCheck(); + order.verify(node, times(2)).getMessage(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenAssignExpr() { + // Given + Object argument = mock(Object.class); + AssignExpr node = mock(AssignExpr.class); + + // When + Mockito.when(node.getTarget()).thenReturn(mock(Expression.class)); + Mockito.when(node.getValue()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getTarget(); + order.verify(node).getValue(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBinaryExpr() { + // Given + Object argument = mock(Object.class); + BinaryExpr node = mock(BinaryExpr.class); + + // When + Mockito.when(node.getLeft()).thenReturn(mock(Expression.class)); + Mockito.when(node.getRight()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getLeft(); + order.verify(node).getRight(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBlockComment() { + // Given + Object argument = mock(Object.class); + BlockComment node = mock(BlockComment.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBlockStmt() { + // Given + Object argument = mock(Object.class); + BlockStmt node = mock(BlockStmt.class); + + // When + Mockito.when(node.getStatements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getStatements(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBooleanLiteralExpr() { + // Given + Object argument = mock(Object.class); + BooleanLiteralExpr node = mock(BooleanLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBreakStmt() { + // Given + Object argument = mock(Object.class); + BreakStmt node = mock(BreakStmt.class); + + // When + Mockito.when(node.getLabel()).thenReturn(Optional.of(mock(SimpleName.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getLabel(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCastExpr() { + // Given + Object argument = mock(Object.class); + CastExpr node = mock(CastExpr.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCatchClause() { + // Given + Object argument = mock(Object.class); + CatchClause node = mock(CatchClause.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getParameter()).thenReturn(mock(Parameter.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getParameter(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCharLiteralExpr() { + // Given + Object argument = mock(Object.class); + CharLiteralExpr node = mock(CharLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenClassExpr() { + // Given + Object argument = mock(Object.class); + ClassExpr node = mock(ClassExpr.class); + + // When + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenClassOrInterfaceDeclaration() { + // Given + Object argument = mock(Object.class); + ClassOrInterfaceDeclaration node = mock(ClassOrInterfaceDeclaration.class); + + // When + Mockito.when(node.getExtendedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getImplementedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getPermittedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExtendedTypes(); + order.verify(node).getImplementedTypes(); + order.verify(node).getPermittedTypes(); + order.verify(node).getTypeParameters(); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenClassOrInterfaceType() { + // Given + Object argument = mock(Object.class); + ClassOrInterfaceType node = mock(ClassOrInterfaceType.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getScope()).thenReturn(Optional.of(mock(ClassOrInterfaceType.class))); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCompilationUnit() { + // Given + Object argument = mock(Object.class); + CompilationUnit node = mock(CompilationUnit.class); + + // When + Mockito.when(node.getImports()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModule()).thenReturn(Optional.of(mock(ModuleDeclaration.class))); + Mockito.when(node.getPackageDeclaration()).thenReturn(Optional.of(mock(PackageDeclaration.class))); + Mockito.when(node.getTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getImports(); + order.verify(node, times(2)).getModule(); + order.verify(node, times(2)).getPackageDeclaration(); + order.verify(node).getTypes(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenConditionalExpr() { + // Given + Object argument = mock(Object.class); + ConditionalExpr node = mock(ConditionalExpr.class); + + // When + Mockito.when(node.getCondition()).thenReturn(mock(Expression.class)); + Mockito.when(node.getElseExpr()).thenReturn(mock(Expression.class)); + Mockito.when(node.getThenExpr()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCondition(); + order.verify(node).getElseExpr(); + order.verify(node).getThenExpr(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenConstructorDeclaration() { + // Given + Object argument = mock(Object.class); + ConstructorDeclaration node = mock(ConstructorDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getReceiverParameter()).thenReturn(Optional.of(mock(ReceiverParameter.class))); + Mockito.when(node.getThrownExceptions()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getParameters(); + order.verify(node, times(2)).getReceiverParameter(); + order.verify(node).getThrownExceptions(); + order.verify(node).getTypeParameters(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenContinueStmt() { + // Given + Object argument = mock(Object.class); + ContinueStmt node = mock(ContinueStmt.class); + + // When + Mockito.when(node.getLabel()).thenReturn(Optional.of(mock(SimpleName.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getLabel(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenDoStmt() { + // Given + Object argument = mock(Object.class); + DoStmt node = mock(DoStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getCondition()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getCondition(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenDoubleLiteralExpr() { + // Given + Object argument = mock(Object.class); + DoubleLiteralExpr node = mock(DoubleLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEmptyStmt() { + // Given + Object argument = mock(Object.class); + EmptyStmt node = mock(EmptyStmt.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEnclosedExpr() { + // Given + Object argument = mock(Object.class); + EnclosedExpr node = mock(EnclosedExpr.class); + + // When + Mockito.when(node.getInner()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getInner(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEnumConstantDeclaration() { + // Given + Object argument = mock(Object.class); + EnumConstantDeclaration node = mock(EnumConstantDeclaration.class); + + // When + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getClassBody()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getArguments(); + order.verify(node).getClassBody(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEnumDeclaration() { + // Given + Object argument = mock(Object.class); + EnumDeclaration node = mock(EnumDeclaration.class); + + // When + Mockito.when(node.getEntries()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getImplementedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getEntries(); + order.verify(node).getImplementedTypes(); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenExplicitConstructorInvocationStmt() { + // Given + Object argument = mock(Object.class); + ExplicitConstructorInvocationStmt node = mock(ExplicitConstructorInvocationStmt.class); + + // When + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getExpression()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getArguments(); + order.verify(node, times(2)).getExpression(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenExpressionStmt() { + // Given + Object argument = mock(Object.class); + ExpressionStmt node = mock(ExpressionStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenFieldAccessExpr() { + // Given + Object argument = mock(Object.class); + FieldAccessExpr node = mock(FieldAccessExpr.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getScope()).thenReturn(mock(Expression.class)); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenFieldDeclaration() { + // Given + Object argument = mock(Object.class); + FieldDeclaration node = mock(FieldDeclaration.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getVariables()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getVariables(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenForStmt() { + // Given + Object argument = mock(Object.class); + ForStmt node = mock(ForStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getCompare()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getInitialization()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getUpdate()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node, times(2)).getCompare(); + order.verify(node).getInitialization(); + order.verify(node).getUpdate(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenForEachStmt() { + // Given + Object argument = mock(Object.class); + ForEachStmt node = mock(ForEachStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getIterable()).thenReturn(mock(Expression.class)); + Mockito.when(node.getVariable()).thenReturn(mock(VariableDeclarationExpr.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getIterable(); + order.verify(node).getVariable(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenIfStmt() { + // Given + Object argument = mock(Object.class); + IfStmt node = mock(IfStmt.class); + + // When + Mockito.when(node.getCondition()).thenReturn(mock(ConditionalExpr.class)); + Mockito.when(node.getElseStmt()).thenReturn(Optional.of(mock(Statement.class))); + Mockito.when(node.getThenStmt()).thenReturn(mock(Statement.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCondition(); + order.verify(node, times(2)).getElseStmt(); + order.verify(node).getThenStmt(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenImportDeclaration() { + // Given + Object argument = mock(Object.class); + ImportDeclaration node = mock(ImportDeclaration.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenInitializerDeclaration() { + // Given + Object argument = mock(Object.class); + InitializerDeclaration node = mock(InitializerDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenInstanceOfExpr() { + // Given + Object argument = mock(Object.class); + InstanceOfExpr node = mock(InstanceOfExpr.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getPattern()).thenReturn(Optional.of(mock(TypePatternExpr.class))); + Mockito.when(node.getType()).thenReturn(mock(ReferenceType.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getPattern(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenIntegerLiteralExpr() { + // Given + Object argument = mock(Object.class); + IntegerLiteralExpr node = mock(IntegerLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenIntersectionType() { + // Given + Object argument = mock(Object.class); + IntersectionType node = mock(IntersectionType.class); + + // When + Mockito.when(node.getElements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getElements(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenJavadocComment() { + // Given + Object argument = mock(Object.class); + JavadocComment node = mock(JavadocComment.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLabeledStmt() { + // Given + Object argument = mock(Object.class); + LabeledStmt node = mock(LabeledStmt.class); + + // When + Mockito.when(node.getLabel()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getStatement()).thenReturn(mock(Statement.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getLabel(); + order.verify(node).getStatement(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLambdaExpr() { + // Given + Object argument = mock(Object.class); + LambdaExpr node = mock(LambdaExpr.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getParameters(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLineComment() { + // Given + Object argument = mock(Object.class); + LineComment node = mock(LineComment.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLocalClassDeclarationStmt() { + // Given + Object argument = mock(Object.class); + LocalClassDeclarationStmt node = mock(LocalClassDeclarationStmt.class); + + // When + Mockito.when(node.getClassDeclaration()).thenReturn(mock(ClassOrInterfaceDeclaration.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getClassDeclaration(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLocalRecordDeclarationStmt() { + // Given + Object argument = mock(Object.class); + LocalRecordDeclarationStmt node = mock(LocalRecordDeclarationStmt.class); + + // When + Mockito.when(node.getRecordDeclaration()).thenReturn(mock(RecordDeclaration.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getRecordDeclaration(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLongLiteralExpr() { + // Given + Object argument = mock(Object.class); + LongLiteralExpr node = mock(LongLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMarkerAnnotationExpr() { + // Given + Object argument = mock(Object.class); + MarkerAnnotationExpr node = mock(MarkerAnnotationExpr.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMemberValuePair() { + // Given + Object argument = mock(Object.class); + MemberValuePair node = mock(MemberValuePair.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getValue()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getValue(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMethodCallExpr() { + // Given + Object argument = mock(Object.class); + MethodCallExpr node = mock(MethodCallExpr.class); + + // When + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getScope()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getArguments(); + order.verify(node).getName(); + order.verify(node, times(2)).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMethodDeclaration() { + // Given + Object argument = mock(Object.class); + MethodDeclaration node = mock(MethodDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(Optional.of(mock(BlockStmt.class))); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getThrownExceptions()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getBody(); + order.verify(node).getType(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getParameters(); + order.verify(node).getThrownExceptions(); + order.verify(node).getTypeParameters(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMethodReferenceExpr() { + // Given + Object argument = mock(Object.class); + MethodReferenceExpr node = mock(MethodReferenceExpr.class); + + // When + Mockito.when(node.getScope()).thenReturn(mock(Expression.class)); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenNameExpr() { + // Given + Object argument = mock(Object.class); + NameExpr node = mock(NameExpr.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenName() { + // Given + Object argument = mock(Object.class); + Name node = mock(Name.class); + + // When + Mockito.when(node.getQualifier()).thenReturn(Optional.of(mock(Name.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getQualifier(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenNormalAnnotationExpr() { + // Given + Object argument = mock(Object.class); + NormalAnnotationExpr node = mock(NormalAnnotationExpr.class); + + // When + Mockito.when(node.getPairs()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getPairs(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenNullLiteralExpr() { + // Given + Object argument = mock(Object.class); + NullLiteralExpr node = mock(NullLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenObjectCreationExpr() { + // Given + Object argument = mock(Object.class); + ObjectCreationExpr node = mock(ObjectCreationExpr.class); + + // When + Mockito.when(node.getAnonymousClassBody()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getScope()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getType()).thenReturn(mock(ClassOrInterfaceType.class)); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getAnonymousClassBody(); + order.verify(node).getArguments(); + order.verify(node, times(2)).getScope(); + order.verify(node).getType(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenPackageDeclaration() { + // Given + Object argument = mock(Object.class); + PackageDeclaration node = mock(PackageDeclaration.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenParameter() { + // Given + Object argument = mock(Object.class); + Parameter node = mock(Parameter.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getVarArgsAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node).getVarArgsAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenPrimitiveType() { + // Given + Object argument = mock(Object.class); + PrimitiveType node = mock(PrimitiveType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenReturnStmt() { + // Given + Object argument = mock(Object.class); + ReturnStmt node = mock(ReturnStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSimpleName() { + // Given + Object argument = mock(Object.class); + SimpleName node = mock(SimpleName.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSingleMemberAnnotationExpr() { + // Given + Object argument = mock(Object.class); + SingleMemberAnnotationExpr node = mock(SingleMemberAnnotationExpr.class); + + // When + Mockito.when(node.getMemberValue()).thenReturn(mock(Expression.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getMemberValue(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenStringLiteralExpr() { + // Given + Object argument = mock(Object.class); + StringLiteralExpr node = mock(StringLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSuperExpr() { + // Given + Object argument = mock(Object.class); + SuperExpr node = mock(SuperExpr.class); + + // When + Mockito.when(node.getTypeName()).thenReturn(Optional.of(mock(Name.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getTypeName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSwitchEntry() { + // Given + Object argument = mock(Object.class); + SwitchEntry node = mock(SwitchEntry.class); + + // When + Mockito.when(node.getLabels()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getStatements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getLabels(); + order.verify(node).getStatements(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSwitchStmt() { + // Given + Object argument = mock(Object.class); + SwitchStmt node = mock(SwitchStmt.class); + + // When + Mockito.when(node.getEntries()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getSelector()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getEntries(); + order.verify(node).getSelector(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSynchronizedStmt() { + // Given + Object argument = mock(Object.class); + SynchronizedStmt node = mock(SynchronizedStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenThisExpr() { + // Given + Object argument = mock(Object.class); + ThisExpr node = mock(ThisExpr.class); + + // When + Mockito.when(node.getTypeName()).thenReturn(Optional.of(mock(Name.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getTypeName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenThrowStmt() { + // Given + Object argument = mock(Object.class); + ThrowStmt node = mock(ThrowStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTryStmt() { + // Given + Object argument = mock(Object.class); + TryStmt node = mock(TryStmt.class); + + // When + Mockito.when(node.getCatchClauses()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getFinallyBlock()).thenReturn(Optional.of(mock(BlockStmt.class))); + Mockito.when(node.getResources()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTryBlock()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCatchClauses(); + order.verify(node, times(2)).getFinallyBlock(); + order.verify(node).getResources(); + order.verify(node).getTryBlock(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTypeExpr() { + // Given + Object argument = mock(Object.class); + TypeExpr node = mock(TypeExpr.class); + + // When + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTypeParameter() { + // Given + Object argument = mock(Object.class); + TypeParameter node = mock(TypeParameter.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getTypeBound()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getTypeBound(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnaryExpr() { + // Given + Object argument = mock(Object.class); + UnaryExpr node = mock(UnaryExpr.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnionType() { + // Given + Object argument = mock(Object.class); + UnionType node = mock(UnionType.class); + + // When + Mockito.when(node.getElements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getElements(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnknownType() { + // Given + Object argument = mock(Object.class); + UnknownType node = mock(UnknownType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVariableDeclarationExpr() { + // Given + Object argument = mock(Object.class); + VariableDeclarationExpr node = mock(VariableDeclarationExpr.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getVariables()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getModifiers(); + order.verify(node).getVariables(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVariableDeclarator() { + // Given + Object argument = mock(Object.class); + VariableDeclarator node = mock(VariableDeclarator.class); + + // When + Mockito.when(node.getInitializer()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getInitializer(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVoidType() { + // Given + Object argument = mock(Object.class); + VoidType node = mock(VoidType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenWhileStmt() { + // Given + Object argument = mock(Object.class); + WhileStmt node = mock(WhileStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getCondition()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getCondition(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenWildcardType() { + // Given + Object argument = mock(Object.class); + WildcardType node = mock(WildcardType.class); + + // When + Mockito.when(node.getExtendedType()).thenReturn(Optional.of(mock(ReferenceType.class))); + Mockito.when(node.getSuperType()).thenReturn(Optional.of(mock(ReferenceType.class))); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getExtendedType(); + order.verify(node, times(2)).getSuperType(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleDeclaration() { + // Given + Object argument = mock(Object.class); + ModuleDeclaration node = mock(ModuleDeclaration.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getDirectives()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getDirectives(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleExportsDirective() { + // Given + Object argument = mock(Object.class); + ModuleExportsDirective node = mock(ModuleExportsDirective.class); + + // When + Mockito.when(node.getModuleNames()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModuleNames(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleOpensDirective() { + // Given + Object argument = mock(Object.class); + ModuleOpensDirective node = mock(ModuleOpensDirective.class); + + // When + Mockito.when(node.getModuleNames()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModuleNames(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleProvidesDirective() { + // Given + Object argument = mock(Object.class); + ModuleProvidesDirective node = mock(ModuleProvidesDirective.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getWith()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getWith(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleRequiresDirective() { + // Given + Object argument = mock(Object.class); + ModuleRequiresDirective node = mock(ModuleRequiresDirective.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleUsesDirective() { + // Given + Object argument = mock(Object.class); + ModuleUsesDirective node = mock(ModuleUsesDirective.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnparsableStmt() { + // Given + Object argument = mock(Object.class); + UnparsableStmt node = mock(UnparsableStmt.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenReceiverParameter() { + // Given + Object argument = mock(Object.class); + ReceiverParameter node = mock(ReceiverParameter.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVarType() { + // Given + Object argument = mock(Object.class); + VarType node = mock(VarType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModifier() { + // Given + Object argument = mock(Object.class); + Modifier node = mock(Modifier.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSwitchExpr() { + // Given + Object argument = mock(Object.class); + SwitchExpr node = mock(SwitchExpr.class); + + // When + Mockito.when(node.getEntries()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getSelector()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getEntries(); + order.verify(node).getSelector(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenYieldStmt() { + // Given + Object argument = mock(Object.class); + YieldStmt node = mock(YieldStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTextBlockLiteralExpr() { + // Given + Object argument = mock(Object.class); + TextBlockLiteralExpr node = mock(TextBlockLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTypePatternExpr() { + // Given + Object argument = mock(Object.class); + TypePatternExpr node = mock(TypePatternExpr.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(ReferenceType.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenRecordPatternExpr() { + // Given + Object argument = mock(Object.class); + RecordPatternExpr node = mock(RecordPatternExpr.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getType()).thenReturn(mock(ReferenceType.class)); + Mockito.when(node.getPatternList()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getPatternList(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenRecordDeclaration() { + // Given + Object argument = mock(Object.class); + RecordDeclaration node = mock(RecordDeclaration.class); + + // When + Mockito.when(node.getImplementedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getReceiverParameter()).thenReturn(Optional.of(mock(ReceiverParameter.class))); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getImplementedTypes(); + order.verify(node).getParameters(); + order.verify(node, times(2)).getReceiverParameter(); + order.verify(node).getTypeParameters(); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_CompactConstructorDeclaration() { + // Given + Object argument = mock(Object.class); + CompactConstructorDeclaration node = mock(CompactConstructorDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getThrownExceptions()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + List result = visitor.visit(node, argument); + + // Assert + assertNotNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getThrownExceptions(); + order.verify(node).getTypeParameters(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericVisitorAdapterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericVisitorAdapterTest.java new file mode 100644 index 0000000..054a322 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericVisitorAdapterTest.java @@ -0,0 +1,2577 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import java.util.Optional; +import org.junit.jupiter.api.Test; +import org.mockito.InOrder; +import org.mockito.Mockito; + +public class GenericVisitorAdapterTest { + + private final GenericVisitorAdapter visitor = new GenericVisitorAdapter() {}; + + @Test + void visit_GivenAnnotationDeclaration() { + // Given + Object argument = mock(Object.class); + AnnotationDeclaration node = mock(AnnotationDeclaration.class); + + // When + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenAnnotationMemberDeclaration() { + // Given + Object argument = mock(Object.class); + AnnotationMemberDeclaration node = mock(AnnotationMemberDeclaration.class); + + // When + Mockito.when(node.getDefaultValue()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getDefaultValue(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayAccessExpr() { + // Given + Object argument = mock(Object.class); + ArrayAccessExpr node = mock(ArrayAccessExpr.class); + + // When + Mockito.when(node.getIndex()).thenReturn(mock(Expression.class)); + Mockito.when(node.getName()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getIndex(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayCreationExpr() { + // Given + Object argument = mock(Object.class); + ArrayCreationExpr node = mock(ArrayCreationExpr.class); + + // When + Mockito.when(node.getElementType()).thenReturn(mock(Type.class)); + Mockito.when(node.getInitializer()).thenReturn(Optional.of(mock(ArrayInitializerExpr.class))); + Mockito.when(node.getLevels()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getElementType(); + order.verify(node, times(2)).getInitializer(); + order.verify(node).getLevels(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayCreationLevel() { + // Given + Object argument = mock(Object.class); + ArrayCreationLevel node = mock(ArrayCreationLevel.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getDimension()).thenReturn(Optional.of(mock(ArrayInitializerExpr.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getDimension(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayInitializerExpr() { + // Given + Object argument = mock(Object.class); + ArrayInitializerExpr node = mock(ArrayInitializerExpr.class); + + // When + Mockito.when(node.getValues()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getValues(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenArrayType() { + // Given + Object argument = mock(Object.class); + ArrayType node = mock(ArrayType.class); + + // When + Mockito.when(node.getComponentType()).thenReturn(mock(Type.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getComponentType(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenAssertStmt() { + // Given + Object argument = mock(Object.class); + AssertStmt node = mock(AssertStmt.class); + + // When + Mockito.when(node.getCheck()).thenReturn(mock(Expression.class)); + Mockito.when(node.getMessage()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCheck(); + order.verify(node, times(2)).getMessage(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenAssignExpr() { + // Given + Object argument = mock(Object.class); + AssignExpr node = mock(AssignExpr.class); + + // When + Mockito.when(node.getTarget()).thenReturn(mock(Expression.class)); + Mockito.when(node.getValue()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getTarget(); + order.verify(node).getValue(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBinaryExpr() { + // Given + Object argument = mock(Object.class); + BinaryExpr node = mock(BinaryExpr.class); + + // When + Mockito.when(node.getLeft()).thenReturn(mock(Expression.class)); + Mockito.when(node.getRight()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getLeft(); + order.verify(node).getRight(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBlockComment() { + // Given + Object argument = mock(Object.class); + BlockComment node = mock(BlockComment.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBlockStmt() { + // Given + Object argument = mock(Object.class); + BlockStmt node = mock(BlockStmt.class); + + // When + Mockito.when(node.getStatements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getStatements(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBooleanLiteralExpr() { + // Given + Object argument = mock(Object.class); + BooleanLiteralExpr node = mock(BooleanLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenBreakStmt() { + // Given + Object argument = mock(Object.class); + BreakStmt node = mock(BreakStmt.class); + + // When + Mockito.when(node.getLabel()).thenReturn(Optional.of(mock(SimpleName.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getLabel(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCastExpr() { + // Given + Object argument = mock(Object.class); + CastExpr node = mock(CastExpr.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCatchClause() { + // Given + Object argument = mock(Object.class); + CatchClause node = mock(CatchClause.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getParameter()).thenReturn(mock(Parameter.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getParameter(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCharLiteralExpr() { + // Given + Object argument = mock(Object.class); + CharLiteralExpr node = mock(CharLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenClassExpr() { + // Given + Object argument = mock(Object.class); + ClassExpr node = mock(ClassExpr.class); + + // When + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenClassOrInterfaceDeclaration() { + // Given + Object argument = mock(Object.class); + ClassOrInterfaceDeclaration node = mock(ClassOrInterfaceDeclaration.class); + + // When + Mockito.when(node.getExtendedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getImplementedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getPermittedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExtendedTypes(); + order.verify(node).getImplementedTypes(); + order.verify(node).getPermittedTypes(); + order.verify(node).getTypeParameters(); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenClassOrInterfaceType() { + // Given + Object argument = mock(Object.class); + ClassOrInterfaceType node = mock(ClassOrInterfaceType.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getScope()).thenReturn(Optional.of(mock(ClassOrInterfaceType.class))); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenCompilationUnit() { + // Given + Object argument = mock(Object.class); + CompilationUnit node = mock(CompilationUnit.class); + + // When + Mockito.when(node.getImports()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModule()).thenReturn(Optional.of(mock(ModuleDeclaration.class))); + Mockito.when(node.getPackageDeclaration()).thenReturn(Optional.of(mock(PackageDeclaration.class))); + Mockito.when(node.getTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getImports(); + order.verify(node, times(2)).getModule(); + order.verify(node, times(2)).getPackageDeclaration(); + order.verify(node).getTypes(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenConditionalExpr() { + // Given + Object argument = mock(Object.class); + ConditionalExpr node = mock(ConditionalExpr.class); + + // When + Mockito.when(node.getCondition()).thenReturn(mock(Expression.class)); + Mockito.when(node.getElseExpr()).thenReturn(mock(Expression.class)); + Mockito.when(node.getThenExpr()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCondition(); + order.verify(node).getElseExpr(); + order.verify(node).getThenExpr(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenConstructorDeclaration() { + // Given + Object argument = mock(Object.class); + ConstructorDeclaration node = mock(ConstructorDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getReceiverParameter()).thenReturn(Optional.of(mock(ReceiverParameter.class))); + Mockito.when(node.getThrownExceptions()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getParameters(); + order.verify(node, times(2)).getReceiverParameter(); + order.verify(node).getThrownExceptions(); + order.verify(node).getTypeParameters(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenContinueStmt() { + // Given + Object argument = mock(Object.class); + ContinueStmt node = mock(ContinueStmt.class); + + // When + Mockito.when(node.getLabel()).thenReturn(Optional.of(mock(SimpleName.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getLabel(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenDoStmt() { + // Given + Object argument = mock(Object.class); + DoStmt node = mock(DoStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getCondition()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getCondition(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenDoubleLiteralExpr() { + // Given + Object argument = mock(Object.class); + DoubleLiteralExpr node = mock(DoubleLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEmptyStmt() { + // Given + Object argument = mock(Object.class); + EmptyStmt node = mock(EmptyStmt.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEnclosedExpr() { + // Given + Object argument = mock(Object.class); + EnclosedExpr node = mock(EnclosedExpr.class); + + // When + Mockito.when(node.getInner()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getInner(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEnumConstantDeclaration() { + // Given + Object argument = mock(Object.class); + EnumConstantDeclaration node = mock(EnumConstantDeclaration.class); + + // When + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getClassBody()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getArguments(); + order.verify(node).getClassBody(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenEnumDeclaration() { + // Given + Object argument = mock(Object.class); + EnumDeclaration node = mock(EnumDeclaration.class); + + // When + Mockito.when(node.getEntries()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getImplementedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getEntries(); + order.verify(node).getImplementedTypes(); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenExplicitConstructorInvocationStmt() { + // Given + Object argument = mock(Object.class); + ExplicitConstructorInvocationStmt node = mock(ExplicitConstructorInvocationStmt.class); + + // When + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getExpression()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getArguments(); + order.verify(node, times(2)).getExpression(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenExpressionStmt() { + // Given + Object argument = mock(Object.class); + ExpressionStmt node = mock(ExpressionStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenFieldAccessExpr() { + // Given + Object argument = mock(Object.class); + FieldAccessExpr node = mock(FieldAccessExpr.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getScope()).thenReturn(mock(Expression.class)); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenFieldDeclaration() { + // Given + Object argument = mock(Object.class); + FieldDeclaration node = mock(FieldDeclaration.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getVariables()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getVariables(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenForStmt() { + // Given + Object argument = mock(Object.class); + ForStmt node = mock(ForStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getCompare()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getInitialization()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getUpdate()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node, times(2)).getCompare(); + order.verify(node).getInitialization(); + order.verify(node).getUpdate(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenForEachStmt() { + // Given + Object argument = mock(Object.class); + ForEachStmt node = mock(ForEachStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getIterable()).thenReturn(mock(Expression.class)); + Mockito.when(node.getVariable()).thenReturn(mock(VariableDeclarationExpr.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getIterable(); + order.verify(node).getVariable(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenIfStmt() { + // Given + Object argument = mock(Object.class); + IfStmt node = mock(IfStmt.class); + + // When + Mockito.when(node.getCondition()).thenReturn(mock(ConditionalExpr.class)); + Mockito.when(node.getElseStmt()).thenReturn(Optional.of(mock(Statement.class))); + Mockito.when(node.getThenStmt()).thenReturn(mock(Statement.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCondition(); + order.verify(node, times(2)).getElseStmt(); + order.verify(node).getThenStmt(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenImportDeclaration() { + // Given + Object argument = mock(Object.class); + ImportDeclaration node = mock(ImportDeclaration.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenInitializerDeclaration() { + // Given + Object argument = mock(Object.class); + InitializerDeclaration node = mock(InitializerDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenInstanceOfExpr() { + // Given + Object argument = mock(Object.class); + InstanceOfExpr node = mock(InstanceOfExpr.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getPattern()).thenReturn(Optional.of(mock(TypePatternExpr.class))); + Mockito.when(node.getType()).thenReturn(mock(ReferenceType.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getPattern(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenIntegerLiteralExpr() { + // Given + Object argument = mock(Object.class); + IntegerLiteralExpr node = mock(IntegerLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenIntersectionType() { + // Given + Object argument = mock(Object.class); + IntersectionType node = mock(IntersectionType.class); + + // When + Mockito.when(node.getElements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getElements(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenJavadocComment() { + // Given + Object argument = mock(Object.class); + JavadocComment node = mock(JavadocComment.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLabeledStmt() { + // Given + Object argument = mock(Object.class); + LabeledStmt node = mock(LabeledStmt.class); + + // When + Mockito.when(node.getLabel()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getStatement()).thenReturn(mock(Statement.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getLabel(); + order.verify(node).getStatement(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLambdaExpr() { + // Given + Object argument = mock(Object.class); + LambdaExpr node = mock(LambdaExpr.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getParameters(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLineComment() { + // Given + Object argument = mock(Object.class); + LineComment node = mock(LineComment.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLocalClassDeclarationStmt() { + // Given + Object argument = mock(Object.class); + LocalClassDeclarationStmt node = mock(LocalClassDeclarationStmt.class); + + // When + Mockito.when(node.getClassDeclaration()).thenReturn(mock(ClassOrInterfaceDeclaration.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getClassDeclaration(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLocalRecordDeclarationStmt() { + // Given + Object argument = mock(Object.class); + LocalRecordDeclarationStmt node = mock(LocalRecordDeclarationStmt.class); + + // When + Mockito.when(node.getRecordDeclaration()).thenReturn(mock(RecordDeclaration.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getRecordDeclaration(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenLongLiteralExpr() { + // Given + Object argument = mock(Object.class); + LongLiteralExpr node = mock(LongLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMarkerAnnotationExpr() { + // Given + Object argument = mock(Object.class); + MarkerAnnotationExpr node = mock(MarkerAnnotationExpr.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMemberValuePair() { + // Given + Object argument = mock(Object.class); + MemberValuePair node = mock(MemberValuePair.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getValue()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getValue(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMethodCallExpr() { + // Given + Object argument = mock(Object.class); + MethodCallExpr node = mock(MethodCallExpr.class); + + // When + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getScope()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getArguments(); + order.verify(node).getName(); + order.verify(node, times(2)).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMethodDeclaration() { + // Given + Object argument = mock(Object.class); + MethodDeclaration node = mock(MethodDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(Optional.of(mock(BlockStmt.class))); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getThrownExceptions()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getBody(); + order.verify(node).getType(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getParameters(); + order.verify(node).getThrownExceptions(); + order.verify(node).getTypeParameters(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenMethodReferenceExpr() { + // Given + Object argument = mock(Object.class); + MethodReferenceExpr node = mock(MethodReferenceExpr.class); + + // When + Mockito.when(node.getScope()).thenReturn(mock(Expression.class)); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getScope(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenNameExpr() { + // Given + Object argument = mock(Object.class); + NameExpr node = mock(NameExpr.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenName() { + // Given + Object argument = mock(Object.class); + Name node = mock(Name.class); + + // When + Mockito.when(node.getQualifier()).thenReturn(Optional.of(mock(Name.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getQualifier(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenNormalAnnotationExpr() { + // Given + Object argument = mock(Object.class); + NormalAnnotationExpr node = mock(NormalAnnotationExpr.class); + + // When + Mockito.when(node.getPairs()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getPairs(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenNullLiteralExpr() { + // Given + Object argument = mock(Object.class); + NullLiteralExpr node = mock(NullLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenObjectCreationExpr() { + // Given + Object argument = mock(Object.class); + ObjectCreationExpr node = mock(ObjectCreationExpr.class); + + // When + Mockito.when(node.getAnonymousClassBody()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getArguments()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getScope()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getType()).thenReturn(mock(ClassOrInterfaceType.class)); + Mockito.when(node.getTypeArguments()).thenReturn(Optional.of(mock(NodeList.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getAnonymousClassBody(); + order.verify(node).getArguments(); + order.verify(node, times(2)).getScope(); + order.verify(node).getType(); + order.verify(node, times(2)).getTypeArguments(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenPackageDeclaration() { + // Given + Object argument = mock(Object.class); + PackageDeclaration node = mock(PackageDeclaration.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenParameter() { + // Given + Object argument = mock(Object.class); + Parameter node = mock(Parameter.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getVarArgsAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node).getVarArgsAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenPrimitiveType() { + // Given + Object argument = mock(Object.class); + PrimitiveType node = mock(PrimitiveType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenReturnStmt() { + // Given + Object argument = mock(Object.class); + ReturnStmt node = mock(ReturnStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSimpleName() { + // Given + Object argument = mock(Object.class); + SimpleName node = mock(SimpleName.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSingleMemberAnnotationExpr() { + // Given + Object argument = mock(Object.class); + SingleMemberAnnotationExpr node = mock(SingleMemberAnnotationExpr.class); + + // When + Mockito.when(node.getMemberValue()).thenReturn(mock(Expression.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getMemberValue(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenStringLiteralExpr() { + // Given + Object argument = mock(Object.class); + StringLiteralExpr node = mock(StringLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSuperExpr() { + // Given + Object argument = mock(Object.class); + SuperExpr node = mock(SuperExpr.class); + + // When + Mockito.when(node.getTypeName()).thenReturn(Optional.of(mock(Name.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getTypeName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSwitchEntry() { + // Given + Object argument = mock(Object.class); + SwitchEntry node = mock(SwitchEntry.class); + + // When + Mockito.when(node.getLabels()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getStatements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getLabels(); + order.verify(node).getStatements(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSwitchStmt() { + // Given + Object argument = mock(Object.class); + SwitchStmt node = mock(SwitchStmt.class); + + // When + Mockito.when(node.getEntries()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getSelector()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getEntries(); + order.verify(node).getSelector(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSynchronizedStmt() { + // Given + Object argument = mock(Object.class); + SynchronizedStmt node = mock(SynchronizedStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenThisExpr() { + // Given + Object argument = mock(Object.class); + ThisExpr node = mock(ThisExpr.class); + + // When + Mockito.when(node.getTypeName()).thenReturn(Optional.of(mock(Name.class))); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getTypeName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenThrowStmt() { + // Given + Object argument = mock(Object.class); + ThrowStmt node = mock(ThrowStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTryStmt() { + // Given + Object argument = mock(Object.class); + TryStmt node = mock(TryStmt.class); + + // When + Mockito.when(node.getCatchClauses()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getFinallyBlock()).thenReturn(Optional.of(mock(BlockStmt.class))); + Mockito.when(node.getResources()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTryBlock()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getCatchClauses(); + order.verify(node, times(2)).getFinallyBlock(); + order.verify(node).getResources(); + order.verify(node).getTryBlock(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTypeExpr() { + // Given + Object argument = mock(Object.class); + TypeExpr node = mock(TypeExpr.class); + + // When + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTypeParameter() { + // Given + Object argument = mock(Object.class); + TypeParameter node = mock(TypeParameter.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getTypeBound()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getTypeBound(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnaryExpr() { + // Given + Object argument = mock(Object.class); + UnaryExpr node = mock(UnaryExpr.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnionType() { + // Given + Object argument = mock(Object.class); + UnionType node = mock(UnionType.class); + + // When + Mockito.when(node.getElements()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getElements(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnknownType() { + // Given + Object argument = mock(Object.class); + UnknownType node = mock(UnknownType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVariableDeclarationExpr() { + // Given + Object argument = mock(Object.class); + VariableDeclarationExpr node = mock(VariableDeclarationExpr.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getVariables()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getModifiers(); + order.verify(node).getVariables(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVariableDeclarator() { + // Given + Object argument = mock(Object.class); + VariableDeclarator node = mock(VariableDeclarator.class); + + // When + Mockito.when(node.getInitializer()).thenReturn(Optional.of(mock(Expression.class))); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getInitializer(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVoidType() { + // Given + Object argument = mock(Object.class); + VoidType node = mock(VoidType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenWhileStmt() { + // Given + Object argument = mock(Object.class); + WhileStmt node = mock(WhileStmt.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(Statement.class)); + Mockito.when(node.getCondition()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getCondition(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenWildcardType() { + // Given + Object argument = mock(Object.class); + WildcardType node = mock(WildcardType.class); + + // When + Mockito.when(node.getExtendedType()).thenReturn(Optional.of(mock(ReferenceType.class))); + Mockito.when(node.getSuperType()).thenReturn(Optional.of(mock(ReferenceType.class))); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getExtendedType(); + order.verify(node, times(2)).getSuperType(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleDeclaration() { + // Given + Object argument = mock(Object.class); + ModuleDeclaration node = mock(ModuleDeclaration.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getDirectives()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getDirectives(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleExportsDirective() { + // Given + Object argument = mock(Object.class); + ModuleExportsDirective node = mock(ModuleExportsDirective.class); + + // When + Mockito.when(node.getModuleNames()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModuleNames(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleOpensDirective() { + // Given + Object argument = mock(Object.class); + ModuleOpensDirective node = mock(ModuleOpensDirective.class); + + // When + Mockito.when(node.getModuleNames()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModuleNames(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleProvidesDirective() { + // Given + Object argument = mock(Object.class); + ModuleProvidesDirective node = mock(ModuleProvidesDirective.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getWith()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node).getWith(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleRequiresDirective() { + // Given + Object argument = mock(Object.class); + ModuleRequiresDirective node = mock(ModuleRequiresDirective.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModuleUsesDirective() { + // Given + Object argument = mock(Object.class); + ModuleUsesDirective node = mock(ModuleUsesDirective.class); + + // When + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getName(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenUnparsableStmt() { + // Given + Object argument = mock(Object.class); + UnparsableStmt node = mock(UnparsableStmt.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenReceiverParameter() { + // Given + Object argument = mock(Object.class); + ReceiverParameter node = mock(ReceiverParameter.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(Name.class)); + Mockito.when(node.getType()).thenReturn(mock(Type.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenVarType() { + // Given + Object argument = mock(Object.class); + VarType node = mock(VarType.class); + + // When + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenModifier() { + // Given + Object argument = mock(Object.class); + Modifier node = mock(Modifier.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenSwitchExpr() { + // Given + Object argument = mock(Object.class); + SwitchExpr node = mock(SwitchExpr.class); + + // When + Mockito.when(node.getEntries()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getSelector()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getEntries(); + order.verify(node).getSelector(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenYieldStmt() { + // Given + Object argument = mock(Object.class); + YieldStmt node = mock(YieldStmt.class); + + // When + Mockito.when(node.getExpression()).thenReturn(mock(Expression.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getExpression(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTextBlockLiteralExpr() { + // Given + Object argument = mock(Object.class); + TextBlockLiteralExpr node = mock(TextBlockLiteralExpr.class); + + // When + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenTypePatternExpr() { + // Given + Object argument = mock(Object.class); + TypePatternExpr node = mock(TypePatternExpr.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getType()).thenReturn(mock(ReferenceType.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenRecordPatternExpr() { + // Given + Object argument = mock(Object.class); + RecordPatternExpr node = mock(RecordPatternExpr.class); + + // When + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getType()).thenReturn(mock(ReferenceType.class)); + Mockito.when(node.getPatternList()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getModifiers(); + order.verify(node).getPatternList(); + order.verify(node).getType(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_GivenRecordDeclaration() { + // Given + Object argument = mock(Object.class); + RecordDeclaration node = mock(RecordDeclaration.class); + + // When + Mockito.when(node.getImplementedTypes()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getReceiverParameter()).thenReturn(Optional.of(mock(ReceiverParameter.class))); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getMembers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getImplementedTypes(); + order.verify(node).getParameters(); + order.verify(node, times(2)).getReceiverParameter(); + order.verify(node).getTypeParameters(); + order.verify(node).getMembers(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } + + @Test + void visit_CompactConstructorDeclaration() { + // Given + Object argument = mock(Object.class); + CompactConstructorDeclaration node = mock(CompactConstructorDeclaration.class); + + // When + Mockito.when(node.getBody()).thenReturn(mock(BlockStmt.class)); + Mockito.when(node.getModifiers()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getName()).thenReturn(mock(SimpleName.class)); + Mockito.when(node.getThrownExceptions()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getTypeParameters()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getAnnotations()).thenReturn(mock(NodeList.class)); + Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class))); + + // Then + Object result = visitor.visit(node, argument); + + // Assert + assertNull(result); + + // Verify + InOrder order = Mockito.inOrder(node); + order.verify(node).getBody(); + order.verify(node).getModifiers(); + order.verify(node).getName(); + order.verify(node).getThrownExceptions(); + order.verify(node).getTypeParameters(); + order.verify(node).getAnnotations(); + order.verify(node, times(2)).getComment(); + order.verifyNoMoreInteractions(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaultsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaultsTest.java new file mode 100644 index 0000000..0327922 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaultsTest.java @@ -0,0 +1,710 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.mockito.Mockito.*; +import static org.mockito.MockitoAnnotations.openMocks; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; + +/** + * This class contains the tests to validate GenericVisitorWithDefaults. + * + * @author 4everTheOne + */ +class GenericVisitorWithDefaultsTest { + + @Captor + private ArgumentCaptor argumentCaptor; + + private Object argument; + private GenericVisitorWithDefaults visitor; + + @BeforeEach + void initialize() { + openMocks(this); + + argument = new Object(); + visitor = spy(new GenericVisitorWithDefaults() { + @Override + public Node defaultAction(Node n, Object arg) { + super.defaultAction(n, arg); + return n; + } + }); + } + + @Test + void testThatVisitWithNodeListMethodAsParameter() { + NodeList nodeList = new NodeList<>(); + Node node = visitor.visit(nodeList, argument); + assertNull(node); + } + + @Test + void testThatVisitWithAnnotationDeclarationMethodAsParameterCallsDefaultAction() { + Node node = visitor.visit(mock(AnnotationDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithAnnotationMemberDeclarationMethodAsParameterCallsDefaultAction() { + Node node = visitor.visit(mock(AnnotationMemberDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayAccessExprMethodAsParameterCallsDefaultAction() { + Node node = visitor.visit(mock(ArrayAccessExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayCreationExprMethodAsParameterCallsDefaultAction() { + Node node = visitor.visit(mock(ArrayCreationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayInitializerExprMethodAsParameterCallsDefaultAction() { + Node node = visitor.visit(mock(ArrayInitializerExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithAssertStmtMethodAsParameterCallsDefaultAction() { + Node node = visitor.visit(mock(AssertStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithBlockStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(BlockStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithBooleanLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(BooleanLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithBreakStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(BreakStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithCastExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(CastExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithCatchClauseAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(CatchClause.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithCharLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(CharLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithClassExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ClassExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithClassOrInterfaceDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ClassOrInterfaceDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithClassOrInterfaceTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ClassOrInterfaceType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithCompilationUnitAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(CompilationUnit.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithConditionalExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ConditionalExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithConstructorDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ConstructorDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithContinueStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ContinueStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithDoStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(DoStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithDoubleLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(DoubleLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithAnnotationDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(AnnotationDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithAnnotationMemberDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(AnnotationMemberDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayAccessExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ArrayAccessExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayCreationExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ArrayCreationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayCreationLevelAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ArrayCreationLevel.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayInitializerExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ArrayInitializerExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithArrayTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ArrayType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithAssertStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(AssertStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithAssignExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(AssignExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithBinaryExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(BinaryExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithBlockCommentAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(BlockComment.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithEmptyStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(EmptyStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithEnclosedExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(EnclosedExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithEnumConstantDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(EnumConstantDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithEnumDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(EnumDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithExplicitConstructorInvocationStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ExplicitConstructorInvocationStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithExpressionStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ExpressionStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithFieldAccessExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(FieldAccessExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithFieldDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(FieldDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithForEachStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ForEachStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithForStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ForStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithIfStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(IfStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithImportDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ImportDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithInitializerDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(InitializerDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithInstanceOfExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(InstanceOfExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithIntegerLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(IntegerLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithIntersectionTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(IntersectionType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithJavadocCommentAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(JavadocComment.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithLabeledStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(LabeledStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithLambdaExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(LambdaExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithLineCommentAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(LineComment.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithLocalClassDeclarationStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(LocalClassDeclarationStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithLocalRecordDeclarationStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(LocalRecordDeclarationStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithLongLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(LongLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithMarkerAnnotationExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(MarkerAnnotationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithMemberValuePairAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(MemberValuePair.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithMethodCallExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(MethodCallExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithMethodDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(MethodDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithMethodReferenceExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(MethodReferenceExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModifierAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(Modifier.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModuleDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ModuleDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModuleExportsDirectiveAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ModuleExportsDirective.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModuleOpensDirectiveAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ModuleOpensDirective.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModuleProvidesDirectiveAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ModuleProvidesDirective.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModuleRequiresDirectiveAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ModuleRequiresDirective.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithModuleUsesDirectiveAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ModuleUsesDirective.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithNameExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(NameExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithNameAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(Name.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithNormalAnnotationExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(NormalAnnotationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithNullLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(NullLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithObjectCreationExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ObjectCreationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithPackageDeclarationAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(PackageDeclaration.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithParameterAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(Parameter.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithTypePatternExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(TypePatternExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithRecordPatternExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(RecordPatternExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithPrimitiveTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(PrimitiveType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithReceiverParameterAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ReceiverParameter.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithReturnStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ReturnStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSimpleNameAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SimpleName.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSingleMemberAnnotationExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SingleMemberAnnotationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithStringLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(StringLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSuperExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SuperExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSwitchEntryAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SwitchEntry.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSwitchExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SwitchExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSwitchStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SwitchStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithSynchronizedStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(SynchronizedStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithTextBlockLiteralExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(TextBlockLiteralExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithThisExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ThisExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithThrowStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(ThrowStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithTryStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(TryStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithTypeExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(TypeExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithTypeParameterAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(TypeParameter.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithUnaryExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(UnaryExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithUnionTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(UnionType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithUnknownTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(UnknownType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithUnparsableStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(UnparsableStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithVarTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(VarType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithVariableDeclarationExprAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(VariableDeclarationExpr.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithVariableDeclaratorCallDefaultAction() { + Node node = visitor.visit(mock(VariableDeclarator.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithVoidTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(VoidType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithWhileStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(WhileStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithWildcardTypeAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(WildcardType.class), argument); + assertNodeVisitDefaultAction(node); + } + + @Test + void testThatVisitWithYieldStmtAsParameterCallDefaultAction() { + Node node = visitor.visit(mock(YieldStmt.class), argument); + assertNodeVisitDefaultAction(node); + } + + /** + * Assert that at the default methods was called only once and with the same argument. + */ + void assertNodeVisitDefaultAction(Node node) { + // Check if the default method was only called once + verify(visitor, times(1)).defaultAction(same(node), argumentCaptor.capture()); + // Check if the original argument was passed to the default method + assertSame(argument, argumentCaptor.getValue()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/HashCodeVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/HashCodeVisitorTest.java new file mode 100644 index 0000000..6fe14e6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/HashCodeVisitorTest.java @@ -0,0 +1,977 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.ast.type.PrimitiveType.intType; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.mockito.Mockito.*; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import org.junit.jupiter.api.Test; + +class HashCodeVisitorTest { + + @Test + void testEquals() { + CompilationUnit p1 = parse("class X { }"); + CompilationUnit p2 = parse("class X { }"); + assertEquals(p1.hashCode(), p2.hashCode()); + } + + @Test + void testNotEquals() { + CompilationUnit p1 = parse("class X { }"); + CompilationUnit p2 = parse("class Y { }"); + assertNotEquals(p1.hashCode(), p2.hashCode()); + } + + @Test + void testVisitAnnotationDeclaration() { + AnnotationDeclaration node = spy(new AnnotationDeclaration()); + HashCodeVisitor.hashCode(node); + + verify(node, times(1)).getMembers(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitAnnotationMemberDeclaration() { + AnnotationMemberDeclaration node = spy(new AnnotationMemberDeclaration()); + HashCodeVisitor.hashCode(node); + + verify(node, times(1)).getDefaultValue(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitArrayAccessExpr() { + ArrayAccessExpr node = spy(new ArrayAccessExpr()); + HashCodeVisitor.hashCode(node); + + verify(node, times(1)).getIndex(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitArrayCreationExpr() { + ArrayCreationExpr node = spy(new ArrayCreationExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getElementType(); + verify(node, times(2)).getInitializer(); + verify(node, times(1)).getLevels(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitArrayCreationLevel() { + ArrayCreationLevel node = spy(new ArrayCreationLevel()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getDimension(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitArrayInitializerExpr() { + ArrayInitializerExpr node = spy(new ArrayInitializerExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValues(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitArrayType() { + ArrayType node = spy(new ArrayType(intType())); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getComponentType(); + verify(node, times(1)).getOrigin(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitAssertStmt() { + AssertStmt node = spy(new AssertStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getCheck(); + verify(node, times(1)).getMessage(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitAssignExpr() { + AssignExpr node = spy(new AssignExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getOperator(); + verify(node, times(1)).getTarget(); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitBinaryExpr() { + BinaryExpr node = spy(new BinaryExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getLeft(); + verify(node, times(1)).getOperator(); + verify(node, times(1)).getRight(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitBlockComment() { + BlockComment node = spy(new BlockComment()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getContent(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitBlockStmt() { + BlockStmt node = spy(new BlockStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getStatements(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitBooleanLiteralExpr() { + BooleanLiteralExpr node = spy(new BooleanLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).isValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitBreakStmt() { + BreakStmt node = spy(new BreakStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getLabel(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitCastExpr() { + CastExpr node = spy(new CastExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitCatchClause() { + CatchClause node = spy(new CatchClause()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).getParameter(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitCharLiteralExpr() { + CharLiteralExpr node = spy(new CharLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitClassExpr() { + ClassExpr node = spy(new ClassExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitClassOrInterfaceDeclaration() { + ClassOrInterfaceDeclaration node = spy(new ClassOrInterfaceDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExtendedTypes(); + verify(node, times(1)).getImplementedTypes(); + verify(node, times(1)).isInterface(); + verify(node, times(1)).getTypeParameters(); + verify(node, times(1)).getMembers(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitClassOrInterfaceType() { + ClassOrInterfaceType node = spy(new ClassOrInterfaceType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitCompilationUnit() { + CompilationUnit node = spy(new CompilationUnit()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getImports(); + verify(node, times(1)).getModule(); + verify(node, times(1)).getPackageDeclaration(); + verify(node, times(1)).getTypes(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitConditionalExpr() { + ConditionalExpr node = spy(new ConditionalExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getCondition(); + verify(node, times(1)).getElseExpr(); + verify(node, times(1)).getThenExpr(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitConstructorDeclaration() { + ConstructorDeclaration node = spy(new ConstructorDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getParameters(); + verify(node, times(1)).getReceiverParameter(); + verify(node, times(1)).getThrownExceptions(); + verify(node, times(1)).getTypeParameters(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitContinueStmt() { + ContinueStmt node = spy(new ContinueStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getLabel(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitDoStmt() { + DoStmt node = spy(new DoStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).getCondition(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitDoubleLiteralExpr() { + DoubleLiteralExpr node = spy(new DoubleLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitEmptyStmt() { + EmptyStmt node = spy(new EmptyStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitEnclosedExpr() { + EnclosedExpr node = spy(new EnclosedExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getInner(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitEnumConstantDeclaration() { + EnumConstantDeclaration node = spy(new EnumConstantDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getArguments(); + verify(node, times(1)).getClassBody(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitEnumDeclaration() { + EnumDeclaration node = spy(new EnumDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getEntries(); + verify(node, times(1)).getImplementedTypes(); + verify(node, times(1)).getMembers(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitExplicitConstructorInvocationStmt() { + ExplicitConstructorInvocationStmt node = spy(new ExplicitConstructorInvocationStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getArguments(); + verify(node, times(1)).getExpression(); + verify(node, times(1)).isThis(); + verify(node, times(1)).getTypeArguments(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitExpressionStmt() { + ExpressionStmt node = spy(new ExpressionStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitFieldAccessExpr() { + FieldAccessExpr node = spy(new FieldAccessExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitFieldDeclaration() { + FieldDeclaration node = spy(new FieldDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getVariables(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitForEachStmt() { + ForEachStmt node = spy(new ForEachStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).getIterable(); + verify(node, times(1)).getVariable(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitForStmt() { + ForStmt node = spy(new ForStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(2)).getCompare(); + verify(node, times(1)).getInitialization(); + verify(node, times(1)).getUpdate(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitIfStmt() { + IfStmt node = spy(new IfStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getCondition(); + verify(node, times(1)).getElseStmt(); + verify(node, times(1)).getThenStmt(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitImportDeclaration() { + ImportDeclaration node = spy(new ImportDeclaration(new Name(), false, false)); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).isAsterisk(); + verify(node, times(1)).isStatic(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitInitializerDeclaration() { + InitializerDeclaration node = spy(new InitializerDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).isStatic(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitInstanceOfExpr() { + InstanceOfExpr node = spy(new InstanceOfExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getPattern(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitIntegerLiteralExpr() { + IntegerLiteralExpr node = spy(new IntegerLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitIntersectionType() { + NodeList elements = new NodeList<>(); + elements.add(new ClassOrInterfaceType()); + IntersectionType node = spy(new IntersectionType(elements)); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getElements(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitJavadocComment() { + JavadocComment node = spy(new JavadocComment()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getContent(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitLabeledStmt() { + LabeledStmt node = spy(new LabeledStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getLabel(); + verify(node, times(1)).getStatement(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitLambdaExpr() { + LambdaExpr node = spy(new LambdaExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).isEnclosingParameters(); + verify(node, times(1)).getParameters(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitLineComment() { + LineComment node = spy(new LineComment()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getContent(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitLocalClassDeclarationStmt() { + LocalClassDeclarationStmt node = spy(new LocalClassDeclarationStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getClassDeclaration(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitLocalRecordDeclarationStmt() { + LocalRecordDeclarationStmt node = spy(new LocalRecordDeclarationStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getRecordDeclaration(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitLongLiteralExpr() { + LongLiteralExpr node = spy(new LongLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitMarkerAnnotationExpr() { + MarkerAnnotationExpr node = spy(new MarkerAnnotationExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitMemberValuePair() { + MemberValuePair node = spy(new MemberValuePair()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitMethodCallExpr() { + MethodCallExpr node = spy(new MethodCallExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getArguments(); + verify(node, times(1)).getName(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitMethodDeclaration() { + MethodDeclaration node = spy(new MethodDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(2)).getBody(); + verify(node, times(1)).getType(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getParameters(); + verify(node, times(1)).getReceiverParameter(); + verify(node, times(1)).getThrownExceptions(); + verify(node, times(1)).getTypeParameters(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitMethodReferenceExpr() { + MethodReferenceExpr node = spy(new MethodReferenceExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getIdentifier(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModifier() { + Modifier node = spy(new Modifier()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getKeyword(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModuleDeclaration() { + ModuleDeclaration node = spy(new ModuleDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getDirectives(); + verify(node, times(1)).isOpen(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModuleExportsDirective() { + ModuleExportsDirective node = spy(new ModuleExportsDirective()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getModuleNames(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModuleOpensDirective() { + ModuleOpensDirective node = spy(new ModuleOpensDirective()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getModuleNames(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModuleProvidesDirective() { + ModuleProvidesDirective node = spy(new ModuleProvidesDirective()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getWith(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModuleRequiresDirective() { + ModuleRequiresDirective node = spy(new ModuleRequiresDirective()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitModuleUsesDirective() { + ModuleUsesDirective node = spy(new ModuleUsesDirective()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitNameExpr() { + NameExpr node = spy(new NameExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitName() { + Name node = spy(new Name()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getIdentifier(); + verify(node, times(1)).getQualifier(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitNormalAnnotationExpr() { + NormalAnnotationExpr node = spy(new NormalAnnotationExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getPairs(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitNullLiteralExpr() { + NullLiteralExpr node = spy(new NullLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitObjectCreationExpr() { + ObjectCreationExpr node = spy(new ObjectCreationExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnonymousClassBody(); + verify(node, times(1)).getArguments(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getType(); + verify(node, times(2)).getTypeArguments(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitPackageDeclaration() { + PackageDeclaration node = spy(new PackageDeclaration()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitParameter() { + Parameter node = spy(new Parameter()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).isVarArgs(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getVarArgsAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitTypePatternExpr() { + TypePatternExpr node = spy(new TypePatternExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitRecordPatternExpr() { + RecordPatternExpr node = spy(new RecordPatternExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getPatternList(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitPrimitiveType() { + PrimitiveType node = spy(new PrimitiveType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getType(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitReceiverParameter() { + ReceiverParameter node = spy(new ReceiverParameter()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitReturnStmt() { + ReturnStmt node = spy(new ReturnStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSimpleName() { + SimpleName node = spy(new SimpleName()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getIdentifier(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSingleMemberAnnotationExpr() { + SingleMemberAnnotationExpr node = spy(new SingleMemberAnnotationExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getMemberValue(); + verify(node, times(1)).getName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitStringLiteralExpr() { + StringLiteralExpr node = spy(new StringLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSuperExpr() { + SuperExpr node = spy(new SuperExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getTypeName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSwitchEntry() { + SwitchEntry node = spy(new SwitchEntry()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getLabels(); + verify(node, times(1)).getStatements(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSwitchExpr() { + SwitchExpr node = spy(new SwitchExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getEntries(); + verify(node, times(1)).getSelector(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSwitchStmt() { + SwitchStmt node = spy(new SwitchStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getEntries(); + verify(node, times(1)).getSelector(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitSynchronizedStmt() { + SynchronizedStmt node = spy(new SynchronizedStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitTextBlockLiteralExpr() { + TextBlockLiteralExpr node = spy(new TextBlockLiteralExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getValue(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitThisExpr() { + ThisExpr node = spy(new ThisExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getTypeName(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitThrowStmt() { + ThrowStmt node = spy(new ThrowStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitTryStmt() { + TryStmt node = spy(new TryStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getCatchClauses(); + verify(node, times(1)).getFinallyBlock(); + verify(node, times(1)).getResources(); + verify(node, times(1)).getTryBlock(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitTypeExpr() { + TypeExpr node = spy(new TypeExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitTypeParameter() { + TypeParameter node = spy(new TypeParameter()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getName(); + verify(node, times(1)).getTypeBound(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitUnaryExpr() { + UnaryExpr node = spy(new UnaryExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getOperator(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitUnionType() { + UnionType node = spy(new UnionType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getElements(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitUnknownType() { + UnknownType node = spy(new UnknownType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitUnparsableStmt() { + UnparsableStmt node = spy(new UnparsableStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitVarType() { + VarType node = spy(new VarType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitVariableDeclarationExpr() { + VariableDeclarationExpr node = spy(new VariableDeclarationExpr()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getVariables(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitVariableDeclarator() { + VariableDeclarator node = spy(new VariableDeclarator()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getInitializer(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitVoidType() { + VoidType node = spy(new VoidType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitWhileStmt() { + WhileStmt node = spy(new WhileStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getBody(); + verify(node, times(1)).getCondition(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitWildcardType() { + WildcardType node = spy(new WildcardType()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExtendedType(); + verify(node, times(1)).getSuperType(); + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getComment(); + } + + @Test + void testVisitYieldStmt() { + YieldStmt node = spy(new YieldStmt()); + HashCodeVisitor.hashCode(node); + verify(node, times(1)).getExpression(); + verify(node, times(1)).getComment(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ModifierVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ModifierVisitorTest.java new file mode 100644 index 0000000..3da3cd6 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ModifierVisitorTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ModifierVisitorTest extends AbstractLexicalPreservingTest { + @Test + void makeSureParentListsCanBeModified() { + NodeList list = new NodeList<>(); + list.add(new StringLiteralExpr("t")); + list.add(new StringLiteralExpr("a")); + list.add(new StringLiteralExpr("b")); + list.add(new StringLiteralExpr("c")); + + list.accept( + new ModifierVisitor() { + @Override + public Visitable visit(final StringLiteralExpr n, final Void arg) { + String v = n.getValue(); + + list.addFirst(new StringLiteralExpr("extra " + v)); + list.remove(new StringLiteralExpr("t")); + + if (v.equals("a")) { + return new StringLiteralExpr("x"); + } + if (v.equals("b")) { + return null; + } + + return n; + } + }, + null); + + assertEquals("extra c", list.get(0).getValue()); + assertEquals("extra b", list.get(1).getValue()); + assertEquals("extra a", list.get(2).getValue()); + assertEquals("extra t", list.get(3).getValue()); + assertEquals("x", list.get(4).getValue()); + assertEquals("c", list.get(5).getValue()); + assertEquals(6, list.size()); + } + + @Test + void binaryExprReturnsLeftExpressionWhenRightSideIsRemoved() { + Expression expression = parseExpression("1+2"); + Visitable result = expression.accept( + new ModifierVisitor() { + public Visitable visit(IntegerLiteralExpr integerLiteralExpr, Void arg) { + if (integerLiteralExpr.getValue().equals("1")) { + return null; + } + return integerLiteralExpr; + } + }, + null); + assertEquals("2", result.toString()); + } + + @Test + void binaryExprReturnsRightExpressionWhenLeftSideIsRemoved() { + final Expression expression = parseExpression("1+2"); + final Visitable result = expression.accept( + new ModifierVisitor() { + public Visitable visit(IntegerLiteralExpr integerLiteralExpr, Void arg) { + if (integerLiteralExpr.getValue().equals("2")) { + return null; + } + return integerLiteralExpr; + } + }, + null); + assertEquals("1", result.toString()); + } + + @Test + void fieldDeclarationCantSurviveWithoutVariables() { + final BodyDeclaration bodyDeclaration = parseBodyDeclaration("int x=1;"); + + final Visitable result = bodyDeclaration.accept( + new ModifierVisitor() { + public Visitable visit(VariableDeclarator x, Void arg) { + return null; + } + }, + null); + + assertNull(result); + } + + @Test + void variableDeclarationCantSurviveWithoutVariables() { + final BodyDeclaration bodyDeclaration = parseBodyDeclaration("void x() {int x=1;}"); + + final Visitable result = bodyDeclaration.accept( + new ModifierVisitor() { + public Visitable visit(VariableDeclarator x, Void arg) { + return null; + } + }, + null); + + assertEquals("void x() {" + LineSeparator.SYSTEM + "}", result.toString()); + } + + @Test + void issue2124() { + ModifierVisitor modifier = new ModifierVisitor<>(); + considerCode("\n" + "public class ModifierVisitorTest {\n" + + " private void causesException() {\n" + + " String[] listWithExtraCommaAndEqualElements = {\"a\", \"a\",};\n" + + " }\n" + + "}"); + cu.accept(modifier, null); + // there should be no exception + LexicalPreservingPrinter.print(cu); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitorTest.java new file mode 100644 index 0000000..45d76a4 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitorTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import org.junit.jupiter.api.Test; + +class NoCommentEqualsVisitorTest { + + @Test + void testEquals() { + CompilationUnit p1 = parse("class X { }"); + CompilationUnit p2 = parse("class X { }"); + assertTrue(NoCommentEqualsVisitor.equals(p1, p2)); + } + + @Test + void testEqualsWithDifferentComments() { + CompilationUnit p1 = parse("/* a */ class X { /** b */} //c"); + CompilationUnit p2 = parse("/* b */ class X { } //c"); + assertTrue(NoCommentEqualsVisitor.equals(p1, p2)); + } + + @Test + void testNotEquals() { + CompilationUnit p1 = parse("class X { }"); + CompilationUnit p2 = parse("class Y { }"); + assertFalse(NoCommentEqualsVisitor.equals(p1, p2)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitorTest.java new file mode 100644 index 0000000..de92ecd --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitorTest.java @@ -0,0 +1,1076 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.ast.type.PrimitiveType.intType; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.mockito.Mockito.*; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import org.junit.jupiter.api.Test; + +class NoCommentHashCodeVisitorTest { + + @Test + void testEquals() { + CompilationUnit p1 = parse("class X { }"); + CompilationUnit p2 = parse("class X { }"); + assertEquals(p1.hashCode(), p2.hashCode()); + } + + @Test + void testEqualsWithDifferentComments() { + CompilationUnit p1 = parse("/* a */ class X { /** b */} //c"); + CompilationUnit p2 = parse("/* b */ class X { } //c"); + assertEquals(p1.hashCode(), p2.hashCode()); + assertEquals(3, p1.getAllComments().size()); + assertEquals(2, p2.getAllComments().size()); + } + + @Test + void testNotEquals() { + CompilationUnit p1 = parse("class X { }"); + CompilationUnit p2 = parse("class Y { }"); + assertNotEquals(p1.hashCode(), p2.hashCode()); + } + + @Test + void testJavadocCommentDoesNotHaveHashCode() { + JavadocComment node = spy(new JavadocComment()); + assertEquals(0, NoCommentHashCodeVisitor.hashCode(node)); + + verify(node).accept(isA(NoCommentHashCodeVisitor.class), isNull()); + } + + @Test + void testLineCommentDoesNotHaveHashCode() { + LineComment node = spy(new LineComment()); + assertEquals(0, NoCommentHashCodeVisitor.hashCode(node)); + + verify(node).accept(isA(NoCommentHashCodeVisitor.class), isNull()); + } + + @Test + void testBlockCommentDoesNotHaveHashCode() { + BlockComment node = spy(new BlockComment()); + assertEquals(0, NoCommentHashCodeVisitor.hashCode(node)); + + verify(node).accept(isA(NoCommentHashCodeVisitor.class), isNull()); + } + + @Test + void testVisitAnnotationDeclaration() { + AnnotationDeclaration node = spy(new AnnotationDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getMembers(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitAnnotationMemberDeclaration() { + AnnotationMemberDeclaration node = spy(new AnnotationMemberDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getDefaultValue(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitArrayAccessExpr() { + ArrayAccessExpr node = spy(new ArrayAccessExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getIndex(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitArrayCreationExpr() { + ArrayCreationExpr node = spy(new ArrayCreationExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getElementType(); + verify(node, times(2)).getInitializer(); + verify(node, times(1)).getLevels(); + verify(node, never()).getComment(); + } + + @Test + void testVisitArrayCreationLevel() { + ArrayCreationLevel node = spy(new ArrayCreationLevel()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getDimension(); + verify(node, never()).getComment(); + } + + @Test + void testVisitArrayInitializerExpr() { + ArrayInitializerExpr node = spy(new ArrayInitializerExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValues(); + verify(node, never()).getComment(); + } + + @Test + void testVisitArrayType() { + ArrayType node = spy(new ArrayType(intType())); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getComponentType(); + verify(node, times(1)).getOrigin(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitAssertStmt() { + AssertStmt node = spy(new AssertStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getCheck(); + verify(node, times(1)).getMessage(); + verify(node, never()).getComment(); + } + + @Test + void testVisitAssignExpr() { + AssignExpr node = spy(new AssignExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getOperator(); + verify(node, times(1)).getTarget(); + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitBinaryExpr() { + BinaryExpr node = spy(new BinaryExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getLeft(); + verify(node, times(1)).getOperator(); + verify(node, times(1)).getRight(); + verify(node, never()).getComment(); + } + + @Test + void testVisitBlockStmt() { + BlockStmt node = spy(new BlockStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getStatements(); + verify(node, never()).getComment(); + } + + @Test + void testVisitBooleanLiteralExpr() { + BooleanLiteralExpr node = spy(new BooleanLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).isValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitBreakStmt() { + BreakStmt node = spy(new BreakStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getLabel(); + verify(node, never()).getComment(); + } + + @Test + void testVisitCastExpr() { + CastExpr node = spy(new CastExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitCatchClause() { + CatchClause node = spy(new CatchClause()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).getParameter(); + verify(node, never()).getComment(); + } + + @Test + void testVisitCharLiteralExpr() { + CharLiteralExpr node = spy(new CharLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitClassExpr() { + ClassExpr node = spy(new ClassExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitClassOrInterfaceDeclaration() { + ClassOrInterfaceDeclaration node = spy(new ClassOrInterfaceDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExtendedTypes(); + verify(node, times(1)).getImplementedTypes(); + verify(node, times(1)).isInterface(); + verify(node, times(1)).getTypeParameters(); + verify(node, times(1)).getMembers(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitClassOrInterfaceType() { + ClassOrInterfaceType node = spy(new ClassOrInterfaceType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitCompilationUnit() { + CompilationUnit node = spy(new CompilationUnit()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getImports(); + verify(node, times(1)).getModule(); + verify(node, times(1)).getPackageDeclaration(); + verify(node, times(1)).getTypes(); + verify(node, never()).getComment(); + } + + @Test + void testVisitConditionalExpr() { + ConditionalExpr node = spy(new ConditionalExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getCondition(); + verify(node, times(1)).getElseExpr(); + verify(node, times(1)).getThenExpr(); + verify(node, never()).getComment(); + } + + @Test + void testVisitConstructorDeclaration() { + ConstructorDeclaration node = spy(new ConstructorDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getParameters(); + verify(node, times(1)).getReceiverParameter(); + verify(node, times(1)).getThrownExceptions(); + verify(node, times(1)).getTypeParameters(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitContinueStmt() { + ContinueStmt node = spy(new ContinueStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getLabel(); + verify(node, never()).getComment(); + } + + @Test + void testVisitDoStmt() { + DoStmt node = spy(new DoStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).getCondition(); + verify(node, never()).getComment(); + } + + @Test + void testVisitDoubleLiteralExpr() { + DoubleLiteralExpr node = spy(new DoubleLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitEmptyStmt() { + EmptyStmt node = spy(new EmptyStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, never()).getComment(); + } + + @Test + void testVisitEnclosedExpr() { + EnclosedExpr node = spy(new EnclosedExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getInner(); + verify(node, never()).getComment(); + } + + @Test + void testVisitEnumConstantDeclaration() { + EnumConstantDeclaration node = spy(new EnumConstantDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getArguments(); + verify(node, times(1)).getClassBody(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitEnumDeclaration() { + EnumDeclaration node = spy(new EnumDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getEntries(); + verify(node, times(1)).getImplementedTypes(); + verify(node, times(1)).getMembers(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitExplicitConstructorInvocationStmt() { + ExplicitConstructorInvocationStmt node = spy(new ExplicitConstructorInvocationStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getArguments(); + verify(node, times(1)).getExpression(); + verify(node, times(1)).isThis(); + verify(node, times(1)).getTypeArguments(); + verify(node, never()).getComment(); + } + + @Test + void testVisitExpressionStmt() { + ExpressionStmt node = spy(new ExpressionStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, never()).getComment(); + } + + @Test + void testVisitFieldAccessExpr() { + FieldAccessExpr node = spy(new FieldAccessExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, never()).getComment(); + } + + @Test + void testVisitFieldDeclaration() { + FieldDeclaration node = spy(new FieldDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getVariables(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitForStmt() { + ForStmt node = spy(new ForStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(2)).getCompare(); + verify(node, times(1)).getInitialization(); + verify(node, times(1)).getUpdate(); + verify(node, never()).getComment(); + } + + @Test + void testVisitForEachStmt() { + ForEachStmt node = spy(new ForEachStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).getIterable(); + verify(node, times(1)).getVariable(); + verify(node, never()).getComment(); + } + + @Test + void testVisitIfStmt() { + IfStmt node = spy(new IfStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getCondition(); + verify(node, times(1)).getElseStmt(); + verify(node, times(1)).getThenStmt(); + verify(node, never()).getComment(); + } + + @Test + void testVisitImportDeclaration() { + ImportDeclaration node = spy(new ImportDeclaration(new Name(), false, false)); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).isAsterisk(); + verify(node, times(1)).isStatic(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitInitializerDeclaration() { + InitializerDeclaration node = spy(new InitializerDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).isStatic(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitInstanceOfExpr() { + InstanceOfExpr node = spy(new InstanceOfExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, times(1)).getPattern(); + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitIntegerLiteralExpr() { + IntegerLiteralExpr node = spy(new IntegerLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitIntersectionType() { + NodeList elements = new NodeList<>(); + elements.add(new ClassOrInterfaceType()); + IntersectionType node = spy(new IntersectionType(elements)); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getElements(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitLabeledStmt() { + LabeledStmt node = spy(new LabeledStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getLabel(); + verify(node, times(1)).getStatement(); + verify(node, never()).getComment(); + } + + @Test + void testVisitLambdaExpr() { + LambdaExpr node = spy(new LambdaExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).isEnclosingParameters(); + verify(node, times(1)).getParameters(); + verify(node, never()).getComment(); + } + + @Test + void testVisitLocalClassDeclarationStmt() { + LocalClassDeclarationStmt node = spy(new LocalClassDeclarationStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getClassDeclaration(); + verify(node, never()).getComment(); + } + + @Test + void testVisitLocalRecordDeclarationStmt() { + LocalRecordDeclarationStmt node = spy(new LocalRecordDeclarationStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getRecordDeclaration(); + verify(node, never()).getComment(); + } + + @Test + void testVisitLongLiteralExpr() { + LongLiteralExpr node = spy(new LongLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitMarkerAnnotationExpr() { + MarkerAnnotationExpr node = spy(new MarkerAnnotationExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitMemberValuePair() { + MemberValuePair node = spy(new MemberValuePair()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitMethodCallExpr() { + MethodCallExpr node = spy(new MethodCallExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getArguments(); + verify(node, times(1)).getName(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, never()).getComment(); + } + + @Test + void testVisitMethodDeclaration() { + MethodDeclaration node = spy(new MethodDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(2)).getBody(); + verify(node, times(1)).getType(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getParameters(); + verify(node, times(1)).getReceiverParameter(); + verify(node, times(1)).getThrownExceptions(); + verify(node, times(1)).getTypeParameters(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitMethodReferenceExpr() { + MethodReferenceExpr node = spy(new MethodReferenceExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getIdentifier(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getTypeArguments(); + verify(node, never()).getComment(); + } + + @Test + void testVisitNameExpr() { + NameExpr node = spy(new NameExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitName() { + Name node = spy(new Name()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getIdentifier(); + verify(node, times(1)).getQualifier(); + verify(node, never()).getComment(); + } + + @Test + void testVisitNormalAnnotationExpr() { + NormalAnnotationExpr node = spy(new NormalAnnotationExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getPairs(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitNullLiteralExpr() { + NullLiteralExpr node = spy(new NullLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, never()).getComment(); + } + + @Test + void testVisitObjectCreationExpr() { + ObjectCreationExpr node = spy(new ObjectCreationExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnonymousClassBody(); + verify(node, times(1)).getArguments(); + verify(node, times(1)).getScope(); + verify(node, times(1)).getType(); + verify(node, times(2)).getTypeArguments(); + verify(node, never()).getComment(); + } + + @Test + void testVisitPackageDeclaration() { + PackageDeclaration node = spy(new PackageDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitParameter() { + Parameter node = spy(new Parameter()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).isVarArgs(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, times(1)).getVarArgsAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitPrimitiveType() { + PrimitiveType node = spy(new PrimitiveType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getType(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitReturnStmt() { + ReturnStmt node = spy(new ReturnStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSimpleName() { + SimpleName node = spy(new SimpleName()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getIdentifier(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSingleMemberAnnotationExpr() { + SingleMemberAnnotationExpr node = spy(new SingleMemberAnnotationExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getMemberValue(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitStringLiteralExpr() { + StringLiteralExpr node = spy(new StringLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSuperExpr() { + SuperExpr node = spy(new SuperExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getTypeName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSwitchEntry() { + SwitchEntry node = spy(new SwitchEntry()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getLabels(); + verify(node, times(1)).getStatements(); + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSwitchStmt() { + SwitchStmt node = spy(new SwitchStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getEntries(); + verify(node, times(1)).getSelector(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSynchronizedStmt() { + SynchronizedStmt node = spy(new SynchronizedStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).getExpression(); + verify(node, never()).getComment(); + } + + @Test + void testVisitThisExpr() { + ThisExpr node = spy(new ThisExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getTypeName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitThrowStmt() { + ThrowStmt node = spy(new ThrowStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, never()).getComment(); + } + + @Test + void testVisitTryStmt() { + TryStmt node = spy(new TryStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getCatchClauses(); + verify(node, times(1)).getFinallyBlock(); + verify(node, times(1)).getResources(); + verify(node, times(1)).getTryBlock(); + verify(node, never()).getComment(); + } + + @Test + void testVisitTypeExpr() { + TypeExpr node = spy(new TypeExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitTypeParameter() { + TypeParameter node = spy(new TypeParameter()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, times(1)).getTypeBound(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitUnaryExpr() { + UnaryExpr node = spy(new UnaryExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, times(1)).getOperator(); + verify(node, never()).getComment(); + } + + @Test + void testVisitUnionType() { + UnionType node = spy(new UnionType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getElements(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitUnknownType() { + UnknownType node = spy(new UnknownType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitVariableDeclarationExpr() { + VariableDeclarationExpr node = spy(new VariableDeclarationExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getVariables(); + verify(node, never()).getComment(); + } + + @Test + void testVisitVariableDeclarator() { + VariableDeclarator node = spy(new VariableDeclarator()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getInitializer(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitVoidType() { + VoidType node = spy(new VoidType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitWhileStmt() { + WhileStmt node = spy(new WhileStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getBody(); + verify(node, times(1)).getCondition(); + verify(node, never()).getComment(); + } + + @Test + void testVisitWildcardType() { + WildcardType node = spy(new WildcardType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExtendedType(); + verify(node, times(1)).getSuperType(); + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModuleDeclaration() { + ModuleDeclaration node = spy(new ModuleDeclaration()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getDirectives(); + verify(node, times(1)).isOpen(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModuleRequiresDirective() { + ModuleRequiresDirective node = spy(new ModuleRequiresDirective()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getModifiers(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModuleExportsDirective() { + ModuleExportsDirective node = spy(new ModuleExportsDirective()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getModuleNames(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModuleProvidesDirective() { + ModuleProvidesDirective node = spy(new ModuleProvidesDirective()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, times(1)).getWith(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModuleUsesDirective() { + ModuleUsesDirective node = spy(new ModuleUsesDirective()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModuleOpensDirective() { + ModuleOpensDirective node = spy(new ModuleOpensDirective()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getModuleNames(); + verify(node, times(1)).getName(); + verify(node, never()).getComment(); + } + + @Test + void testVisitUnparsableStmt() { + UnparsableStmt node = spy(new UnparsableStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, never()).getComment(); + } + + @Test + void testVisitReceiverParameter() { + ReceiverParameter node = spy(new ReceiverParameter()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitVarType() { + VarType node = spy(new VarType()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getAnnotations(); + verify(node, never()).getComment(); + } + + @Test + void testVisitModifier() { + Modifier node = spy(new Modifier()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getKeyword(); + verify(node, never()).getComment(); + } + + @Test + void testVisitSwitchExpr() { + SwitchExpr node = spy(new SwitchExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getEntries(); + verify(node, times(1)).getSelector(); + verify(node, never()).getComment(); + } + + @Test + void testVisitYieldStmt() { + YieldStmt node = spy(new YieldStmt()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getExpression(); + verify(node, never()).getComment(); + } + + @Test + void testVisitTextBlockLiteralExpr() { + TextBlockLiteralExpr node = spy(new TextBlockLiteralExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getValue(); + verify(node, never()).getComment(); + } + + @Test + void testVisitTypePatternExpr() { + TypePatternExpr node = spy(new TypePatternExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getName(); + verify(node, times(1)).getType(); + verify(node, never()).getComment(); + } + + @Test + void testVisitRecordPatternExpr() { + RecordPatternExpr node = spy(new RecordPatternExpr()); + NoCommentHashCodeVisitor.hashCode(node); + + verify(node, times(1)).getType(); + verify(node, times(1)).getPatternList(); + verify(node, never()).getComment(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NodeFinderVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NodeFinderVisitorTest.java new file mode 100644 index 0000000..49f1796 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/NodeFinderVisitorTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.Position; +import com.github.javaparser.Range; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import org.junit.jupiter.api.Test; + +class NodeFinderVisitorTest { + + NodeFinderVisitor finder = new NodeFinderVisitor(NodeFinderVisitor.fConveringNode); + + @Test + void testNoCoveringNode() { + CompilationUnit cu = parse("class X { }"); + Position position = new Position(0, 0); + Range range = new Range(position, position); + cu.accept(finder, range); + assertTrue(finder.getSelectedNode() == null); + } + + @Test + void testClassOrInterfaceDeclarationIsCovering() { + CompilationUnit cu = parse("class X { }"); + ClassOrInterfaceDeclaration cid = + cu.findFirst(ClassOrInterfaceDeclaration.class).get(); + Range range = new Range(Position.HOME, Position.HOME); + cu.accept(finder, range); + assertEquals(cid, finder.getSelectedNode()); + } + + @Test + void testClassOrInterfaceDeclarationIsCovering2() { + CompilationUnit cu = parse("class X { }"); + ClassOrInterfaceDeclaration cid = + cu.findFirst(ClassOrInterfaceDeclaration.class).get(); + cu.accept(finder, range(1, 11)); + assertEquals(cid, finder.getSelectedNode()); + } + + @Test + void testClassOrInterfaceDeclarationCovering() { + CompilationUnit cu = parse("class X {\n" + " Boolean f;\n" + "}"); + + ClassOrInterfaceDeclaration cid = + cu.findFirst(ClassOrInterfaceDeclaration.class).get(); + cu.accept(finder, range(2, 11)); + assertEquals(cid, finder.getSelectedNode()); + } + + @Test + void testNoCoveringOrCoveredNode2() { + CompilationUnit cu = parse("class X {\n" + " void f() {\n" + " int i = 0;\n" + " }\n" + "}"); + MethodDeclaration md = cu.findFirst(MethodDeclaration.class).get(); + cu.accept(finder, range(3, 11)); + System.out.println(finder.getSelectedNode().toString()); + assertEquals(md.getBody().get(), finder.getSelectedNode()); + } + + private Range range(int line, int length) { + return range(line, 1, length); + } + + private Range range(int line, int begin, int length) { + return new Range(new Position(line, begin), new Position(line, length)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitorTest.java new file mode 100644 index 0000000..0758a06 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitorTest.java @@ -0,0 +1,936 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class ObjectIdentityEqualsVisitorTest { + + @Test + void equals_GivenCompilationUnit() { + Node nodeA = new CompilationUnit(); + Node nodeB = new CompilationUnit(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenPackageDeclaration() { + Node nodeA = new PackageDeclaration(); + Node nodeB = new PackageDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenTypeParameter() { + Node nodeA = new TypeParameter(); + Node nodeB = new TypeParameter(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenLineComment() { + Node nodeA = new LineComment(); + Node nodeB = new LineComment(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenBlockComment() { + Node nodeA = new BlockComment(); + Node nodeB = new BlockComment(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenClassOrInterfaceDeclaration() { + Node nodeA = new ClassOrInterfaceDeclaration(); + Node nodeB = new ClassOrInterfaceDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenEnumDeclaration() { + Node nodeA = new EnumDeclaration(); + Node nodeB = new EnumDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenEnumConstantDeclaration() { + Node nodeA = new EnumConstantDeclaration(); + Node nodeB = new EnumConstantDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenAnnotationDeclaration() { + Node nodeA = new AnnotationDeclaration(); + Node nodeB = new AnnotationDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenAnnotationMemberDeclaration() { + Node nodeA = new AnnotationMemberDeclaration(); + Node nodeB = new AnnotationMemberDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenFieldDeclaration() { + Node nodeA = new FieldDeclaration(); + Node nodeB = new FieldDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenVariableDeclarator() { + Node nodeA = new VariableDeclarator(); + Node nodeB = new VariableDeclarator(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenConstructorDeclaration() { + Node nodeA = new ConstructorDeclaration(); + Node nodeB = new ConstructorDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenMethodDeclaration() { + Node nodeA = new MethodDeclaration(); + Node nodeB = new MethodDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenParameter() { + Node nodeA = new Parameter(); + Node nodeB = new Parameter(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenInitializerDeclaration() { + Node nodeA = new InitializerDeclaration(); + Node nodeB = new InitializerDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenJavadocComment() { + Node nodeA = new JavadocComment(); + Node nodeB = new JavadocComment(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenClassOrInterfaceType() { + Node nodeA = new ClassOrInterfaceType(); + Node nodeB = new ClassOrInterfaceType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenPrimitiveType() { + Node nodeA = new PrimitiveType(); + Node nodeB = new PrimitiveType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenArrayType() { + Node nodeA = new ArrayType(new VoidType()); + Node nodeB = new ArrayType(new VoidType()); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenArrayCreationLevel() { + Node nodeA = new ArrayCreationLevel(); + Node nodeB = new ArrayCreationLevel(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenIntersectionType() { + Node nodeA = new IntersectionType(new NodeList<>()); + Node nodeB = new IntersectionType(new NodeList<>()); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenUnionType() { + Node nodeA = new UnionType(); + Node nodeB = new UnionType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenVoidType() { + Node nodeA = new VoidType(); + Node nodeB = new VoidType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenWildcardType() { + Node nodeA = new WildcardType(); + Node nodeB = new WildcardType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenUnknownType() { + Node nodeA = new UnknownType(); + Node nodeB = new UnknownType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenArrayAccessExpr() { + Node nodeA = new ArrayAccessExpr(); + Node nodeB = new ArrayAccessExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenArrayCreationExpr() { + Node nodeA = new ArrayCreationExpr(); + Node nodeB = new ArrayCreationExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenArrayInitializerExpr() { + Node nodeA = new ArrayInitializerExpr(); + Node nodeB = new ArrayInitializerExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenAssignExpr() { + Node nodeA = new AssignExpr(); + Node nodeB = new AssignExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenBinaryExpr() { + Node nodeA = new BinaryExpr(); + Node nodeB = new BinaryExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenCastExpr() { + Node nodeA = new CastExpr(); + Node nodeB = new CastExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenClassExpr() { + Node nodeA = new ClassExpr(); + Node nodeB = new ClassExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenConditionalExpr() { + Node nodeA = new ConditionalExpr(); + Node nodeB = new ConditionalExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenEnclosedExpr() { + Node nodeA = new EnclosedExpr(); + Node nodeB = new EnclosedExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenFieldAccessExpr() { + Node nodeA = new FieldAccessExpr(); + Node nodeB = new FieldAccessExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenInstanceOfExpr() { + Node nodeA = new InstanceOfExpr(); + Node nodeB = new InstanceOfExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenStringLiteralExpr() { + Node nodeA = new StringLiteralExpr(); + Node nodeB = new StringLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenIntegerLiteralExpr() { + Node nodeA = new IntegerLiteralExpr(); + Node nodeB = new IntegerLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenLongLiteralExpr() { + Node nodeA = new LongLiteralExpr(); + Node nodeB = new LongLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenCharLiteralExpr() { + Node nodeA = new CharLiteralExpr(); + Node nodeB = new CharLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenDoubleLiteralExpr() { + Node nodeA = new DoubleLiteralExpr(); + Node nodeB = new DoubleLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenBooleanLiteralExpr() { + Node nodeA = new BooleanLiteralExpr(); + Node nodeB = new BooleanLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenNullLiteralExpr() { + Node nodeA = new NullLiteralExpr(); + Node nodeB = new NullLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenMethodCallExpr() { + Node nodeA = new MethodCallExpr(); + Node nodeB = new MethodCallExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenNameExpr() { + Node nodeA = new NameExpr(); + Node nodeB = new NameExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenObjectCreationExpr() { + Node nodeA = new ObjectCreationExpr(); + Node nodeB = new ObjectCreationExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenName() { + Node nodeA = new Name(); + Node nodeB = new Name(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSimpleName() { + Node nodeA = new SimpleName(); + Node nodeB = new SimpleName(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenThisExpr() { + Node nodeA = new ThisExpr(); + Node nodeB = new ThisExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSuperExpr() { + Node nodeA = new SuperExpr(); + Node nodeB = new SuperExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenUnaryExpr() { + Node nodeA = new UnaryExpr(); + Node nodeB = new UnaryExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenVariableDeclarationExpr() { + Node nodeA = new VariableDeclarationExpr(); + Node nodeB = new VariableDeclarationExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenMarkerAnnotationExpr() { + Node nodeA = new MarkerAnnotationExpr(); + Node nodeB = new MarkerAnnotationExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSingleMemberAnnotationExpr() { + Node nodeA = new SingleMemberAnnotationExpr(); + Node nodeB = new SingleMemberAnnotationExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenNormalAnnotationExpr() { + Node nodeA = new NormalAnnotationExpr(); + Node nodeB = new NormalAnnotationExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenMemberValuePair() { + Node nodeA = new MemberValuePair(); + Node nodeB = new MemberValuePair(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenExplicitConstructorInvocationStmt() { + Node nodeA = new ExplicitConstructorInvocationStmt(); + Node nodeB = new ExplicitConstructorInvocationStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenLocalClassDeclarationStmt() { + Node nodeA = new LocalClassDeclarationStmt(); + Node nodeB = new LocalClassDeclarationStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenLocalRecordDeclarationStmt() { + Node nodeA = new LocalRecordDeclarationStmt(); + Node nodeB = new LocalRecordDeclarationStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenAssertStmt() { + Node nodeA = new AssertStmt(); + Node nodeB = new AssertStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenBlockStmt() { + Node nodeA = new BlockStmt(); + Node nodeB = new BlockStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenLabeledStmt() { + Node nodeA = new LabeledStmt(); + Node nodeB = new LabeledStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenEmptyStmt() { + Node nodeA = new EmptyStmt(); + Node nodeB = new EmptyStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenExpressionStmt() { + Node nodeA = new ExpressionStmt(); + Node nodeB = new ExpressionStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSwitchStmt() { + Node nodeA = new SwitchStmt(); + Node nodeB = new SwitchStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSwitchEntry() { + Node nodeA = new SwitchEntry(); + Node nodeB = new SwitchEntry(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenBreakStmt() { + Node nodeA = new BreakStmt(); + Node nodeB = new BreakStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenReturnStmt() { + Node nodeA = new ReturnStmt(); + Node nodeB = new ReturnStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenIfStmt() { + Node nodeA = new IfStmt(); + Node nodeB = new IfStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenWhileStmt() { + Node nodeA = new WhileStmt(); + Node nodeB = new WhileStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenContinueStmt() { + Node nodeA = new ContinueStmt(); + Node nodeB = new ContinueStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenDoStmt() { + Node nodeA = new DoStmt(); + Node nodeB = new DoStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenForEachStmt() { + Node nodeA = new ForEachStmt(); + Node nodeB = new ForEachStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenForStmt() { + Node nodeA = new ForStmt(); + Node nodeB = new ForStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenThrowStmt() { + Node nodeA = new ThrowStmt(); + Node nodeB = new ThrowStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSynchronizedStmt() { + Node nodeA = new SynchronizedStmt(); + Node nodeB = new SynchronizedStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenTryStmt() { + Node nodeA = new TryStmt(); + Node nodeB = new TryStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenCatchClause() { + Node nodeA = new CatchClause(); + Node nodeB = new CatchClause(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenLambdaExpr() { + Node nodeA = new LambdaExpr(); + Node nodeB = new LambdaExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenMethodReferenceExpr() { + Node nodeA = new MethodReferenceExpr(); + Node nodeB = new MethodReferenceExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenTypeExpr() { + Node nodeA = new TypeExpr(); + Node nodeB = new TypeExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenImportDeclaration() { + Node nodeA = new ImportDeclaration("a", false, false); + Node nodeB = new ImportDeclaration("b", false, false); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModuleDeclaration() { + Node nodeA = new ModuleDeclaration(); + Node nodeB = new ModuleDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModuleRequiresDirective() { + Node nodeA = new ModuleRequiresDirective(); + Node nodeB = new ModuleRequiresDirective(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModuleExportsDirective() { + Node nodeA = new ModuleExportsDirective(); + Node nodeB = new ModuleExportsDirective(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModuleProvidesDirective() { + Node nodeA = new ModuleProvidesDirective(); + Node nodeB = new ModuleProvidesDirective(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModuleUsesDirective() { + Node nodeA = new ModuleUsesDirective(); + Node nodeB = new ModuleUsesDirective(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModuleOpensDirective() { + Node nodeA = new ModuleOpensDirective(); + Node nodeB = new ModuleOpensDirective(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenUnparsableStmt() { + Node nodeA = new UnparsableStmt(); + Node nodeB = new UnparsableStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenReceiverParameter() { + Node nodeA = new ReceiverParameter(); + Node nodeB = new ReceiverParameter(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenVarType() { + Node nodeA = new VarType(); + Node nodeB = new VarType(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenModifier() { + Node nodeA = new Modifier(); + Node nodeB = new Modifier(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenSwitchExpr() { + Node nodeA = new SwitchExpr(); + Node nodeB = new SwitchExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenYieldStmt() { + Node nodeA = new YieldStmt(); + Node nodeB = new YieldStmt(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenTextBlockLiteralExpr() { + Node nodeA = new TextBlockLiteralExpr(); + Node nodeB = new TextBlockLiteralExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenTypePatternExpr() { + Node nodeA = new TypePatternExpr(); + Node nodeB = new TypePatternExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenRecordPatternExpr() { + Node nodeA = new RecordPatternExpr(); + Node nodeB = new RecordPatternExpr(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenRecordDeclaration() { + Node nodeA = new RecordDeclaration(); + Node nodeB = new RecordDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } + + @Test + void equals_GivenCompactConstructorDeclaration() { + Node nodeA = new CompactConstructorDeclaration(); + Node nodeB = new CompactConstructorDeclaration(); + + Assertions.assertTrue(ObjectIdentityEqualsVisitor.equals(nodeA, nodeA)); + Assertions.assertFalse(ObjectIdentityEqualsVisitor.equals(nodeA, nodeB)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitorTest.java new file mode 100644 index 0000000..21292fb --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitorTest.java @@ -0,0 +1,630 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.ast.type.PrimitiveType.intType; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.spy; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import org.junit.jupiter.api.Test; + +class ObjectIdentityHashCodeVisitorTest { + + @Test + void testVisitAnnotationDeclaration() { + AnnotationDeclaration node = spy(new AnnotationDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitAnnotationMemberDeclaration() { + AnnotationMemberDeclaration node = spy(new AnnotationMemberDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitArrayAccessExpr() { + ArrayAccessExpr node = spy(new ArrayAccessExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitArrayCreationExpr() { + ArrayCreationExpr node = spy(new ArrayCreationExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitArrayCreationLevel() { + ArrayCreationLevel node = spy(new ArrayCreationLevel()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitArrayInitializerExpr() { + ArrayInitializerExpr node = spy(new ArrayInitializerExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitArrayType() { + ArrayType node = spy(new ArrayType(intType())); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitAssertStmt() { + AssertStmt node = spy(new AssertStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitAssignExpr() { + AssignExpr node = spy(new AssignExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitBinaryExpr() { + BinaryExpr node = spy(new BinaryExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitBlockComment() { + BlockComment node = spy(new BlockComment()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitBlockStmt() { + BlockStmt node = spy(new BlockStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitBooleanLiteralExpr() { + BooleanLiteralExpr node = spy(new BooleanLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitBreakStmt() { + BreakStmt node = spy(new BreakStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitCastExpr() { + CastExpr node = spy(new CastExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitCatchClause() { + CatchClause node = spy(new CatchClause()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitCharLiteralExpr() { + CharLiteralExpr node = spy(new CharLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitClassExpr() { + ClassExpr node = spy(new ClassExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitClassOrInterfaceDeclaration() { + ClassOrInterfaceDeclaration node = spy(new ClassOrInterfaceDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitClassOrInterfaceType() { + ClassOrInterfaceType node = spy(new ClassOrInterfaceType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitCompilationUnit() { + CompilationUnit node = spy(new CompilationUnit()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitConditionalExpr() { + ConditionalExpr node = spy(new ConditionalExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitConstructorDeclaration() { + ConstructorDeclaration node = spy(new ConstructorDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitContinueStmt() { + ContinueStmt node = spy(new ContinueStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitDoStmt() { + DoStmt node = spy(new DoStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitDoubleLiteralExpr() { + DoubleLiteralExpr node = spy(new DoubleLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitEmptyStmt() { + EmptyStmt node = spy(new EmptyStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitEnclosedExpr() { + EnclosedExpr node = spy(new EnclosedExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitEnumConstantDeclaration() { + EnumConstantDeclaration node = spy(new EnumConstantDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitEnumDeclaration() { + EnumDeclaration node = spy(new EnumDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitExplicitConstructorInvocationStmt() { + ExplicitConstructorInvocationStmt node = spy(new ExplicitConstructorInvocationStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitExpressionStmt() { + ExpressionStmt node = spy(new ExpressionStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitFieldAccessExpr() { + FieldAccessExpr node = spy(new FieldAccessExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitFieldDeclaration() { + FieldDeclaration node = spy(new FieldDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitForEachStmt() { + ForEachStmt node = spy(new ForEachStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitForStmt() { + ForStmt node = spy(new ForStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitIfStmt() { + IfStmt node = spy(new IfStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitImportDeclaration() { + ImportDeclaration node = spy(new ImportDeclaration(new Name(), false, false)); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitInitializerDeclaration() { + InitializerDeclaration node = spy(new InitializerDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitInstanceOfExpr() { + InstanceOfExpr node = spy(new InstanceOfExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitIntegerLiteralExpr() { + IntegerLiteralExpr node = spy(new IntegerLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitIntersectionType() { + NodeList elements = new NodeList<>(); + elements.add(new ClassOrInterfaceType()); + IntersectionType node = spy(new IntersectionType(elements)); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitJavadocComment() { + JavadocComment node = spy(new JavadocComment()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitLabeledStmt() { + LabeledStmt node = spy(new LabeledStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitLambdaExpr() { + LambdaExpr node = spy(new LambdaExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitLineComment() { + LineComment node = spy(new LineComment()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitLocalClassDeclarationStmt() { + LocalClassDeclarationStmt node = spy(new LocalClassDeclarationStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitLocalRecordDeclarationStmt() { + LocalRecordDeclarationStmt node = spy(new LocalRecordDeclarationStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitLongLiteralExpr() { + LongLiteralExpr node = spy(new LongLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitMarkerAnnotationExpr() { + MarkerAnnotationExpr node = spy(new MarkerAnnotationExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitMemberValuePair() { + MemberValuePair node = spy(new MemberValuePair()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitMethodCallExpr() { + MethodCallExpr node = spy(new MethodCallExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitMethodDeclaration() { + MethodDeclaration node = spy(new MethodDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitMethodReferenceExpr() { + MethodReferenceExpr node = spy(new MethodReferenceExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModifier() { + Modifier node = spy(new Modifier()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModuleDeclaration() { + ModuleDeclaration node = spy(new ModuleDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModuleExportsDirective() { + ModuleExportsDirective node = spy(new ModuleExportsDirective()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModuleOpensDirective() { + ModuleOpensDirective node = spy(new ModuleOpensDirective()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModuleProvidesDirective() { + ModuleProvidesDirective node = spy(new ModuleProvidesDirective()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModuleRequiresDirective() { + ModuleRequiresDirective node = spy(new ModuleRequiresDirective()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitModuleUsesDirective() { + ModuleUsesDirective node = spy(new ModuleUsesDirective()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitNameExpr() { + NameExpr node = spy(new NameExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitName() { + Name node = spy(new Name()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitNormalAnnotationExpr() { + NormalAnnotationExpr node = spy(new NormalAnnotationExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitNullLiteralExpr() { + NullLiteralExpr node = spy(new NullLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitObjectCreationExpr() { + ObjectCreationExpr node = spy(new ObjectCreationExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitPackageDeclaration() { + PackageDeclaration node = spy(new PackageDeclaration()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitParameter() { + Parameter node = spy(new Parameter()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitTypePatternExpr() { + TypePatternExpr node = spy(new TypePatternExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitRecordPatternExpr() { + RecordPatternExpr node = spy(new RecordPatternExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitPrimitiveType() { + PrimitiveType node = spy(new PrimitiveType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitReceiverParameter() { + ReceiverParameter node = spy(new ReceiverParameter()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitReturnStmt() { + ReturnStmt node = spy(new ReturnStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSimpleName() { + SimpleName node = spy(new SimpleName()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSingleMemberAnnotationExpr() { + SingleMemberAnnotationExpr node = spy(new SingleMemberAnnotationExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitStringLiteralExpr() { + StringLiteralExpr node = spy(new StringLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSuperExpr() { + SuperExpr node = spy(new SuperExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSwitchEntry() { + SwitchEntry node = spy(new SwitchEntry()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSwitchExpr() { + SwitchExpr node = spy(new SwitchExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSwitchStmt() { + SwitchStmt node = spy(new SwitchStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitSynchronizedStmt() { + SynchronizedStmt node = spy(new SynchronizedStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitTextBlockLiteralExpr() { + TextBlockLiteralExpr node = spy(new TextBlockLiteralExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitThisExpr() { + ThisExpr node = spy(new ThisExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitThrowStmt() { + ThrowStmt node = spy(new ThrowStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitTryStmt() { + TryStmt node = spy(new TryStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitTypeExpr() { + TypeExpr node = spy(new TypeExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitTypeParameter() { + TypeParameter node = spy(new TypeParameter()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitUnaryExpr() { + UnaryExpr node = spy(new UnaryExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitUnionType() { + UnionType node = spy(new UnionType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitUnknownType() { + UnknownType node = spy(new UnknownType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitUnparsableStmt() { + UnparsableStmt node = spy(new UnparsableStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitVarType() { + VarType node = spy(new VarType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitVariableDeclarationExpr() { + VariableDeclarationExpr node = spy(new VariableDeclarationExpr()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitVariableDeclarator() { + VariableDeclarator node = spy(new VariableDeclarator()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitVoidType() { + VoidType node = spy(new VoidType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitWhileStmt() { + WhileStmt node = spy(new WhileStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitWildcardType() { + WildcardType node = spy(new WildcardType()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } + + @Test + void testVisitYieldStmt() { + YieldStmt node = spy(new YieldStmt()); + assertEquals(node.hashCode(), ObjectIdentityHashCodeVisitor.hashCode(node)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/TreeVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/TreeVisitorTest.java new file mode 100644 index 0000000..8a7f187 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/TreeVisitorTest.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.expr.ArrayInitializerExpr; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.SimpleName; +import org.junit.jupiter.api.Test; + +class TreeVisitorTest { + @Test + void isValidBreadthFirstTraversal() { + Expression expression = parseExpression("(2+3)+(4+5)"); + + StringBuilder result = new StringBuilder(); + + TreeVisitor visitor = new TreeVisitor() { + @Override + public void process(Node node) { + result.append("<").append(node).append("> "); + } + }; + + visitor.visitBreadthFirst(expression); + assertEquals("<(2 + 3) + (4 + 5)> <(2 + 3)> <(4 + 5)> <2 + 3> <4 + 5> <2> <3> <4> <5> ", result.toString()); + } + + @Test + void issue743ConcurrentModificationProblem() { + Expression expression = parseExpression("new int[]{1,2,3,4}"); + + StringBuilder result = new StringBuilder(); + TreeVisitor visitor = new TreeVisitor() { + @Override + public void process(Node node) { + if (node instanceof IntegerLiteralExpr) { + node.getParentNode() + .ifPresent(parent -> + ((ArrayInitializerExpr) parent).getValues().add(new IntegerLiteralExpr("1"))); + } + result.append("<").append(node).append("> "); + } + }; + visitor.visitPreOrder(expression); + // System.out.println(result); + } + + @Test + void isValidPreOrderTraversal() { + StringBuilder result = new StringBuilder(); + new TreeVisitor() { + @Override + public void process(Node node) { + result.append("<").append(node).append("> "); + } + }.visitPreOrder(parseExpression("(2+3)+(4+5)")); + assertEquals("<(2 + 3) + (4 + 5)> <(2 + 3)> <2 + 3> <2> <3> <(4 + 5)> <4 + 5> <4> <5> ", result.toString()); + } + + @Test + void isValidPostOrderTraversal() { + StringBuilder result = new StringBuilder(); + new TreeVisitor() { + @Override + public void process(Node node) { + result.append("<").append(node).append("> "); + } + }.visitPostOrder(parseExpression("(2+3)+(4+5)")); + assertEquals("<2> <3> <2 + 3> <(2 + 3)> <4> <5> <4 + 5> <(4 + 5)> <(2 + 3) + (4 + 5)> ", result.toString()); + } + + @Test + void preOrderConcurrentModificationIsOk() { + new TreeVisitor() { + @Override + public void process(Node node) { + if (node instanceof IntegerLiteralExpr) { + node.getParentNode() + .ifPresent(parent -> + ((ArrayInitializerExpr) parent).getValues().add(new IntegerLiteralExpr("1"))); + } + } + }.visitPreOrder(parseExpression("new int[]{1,2,3,4}")); + } + + @Test + void postOrderConcurrentModificationIsOk() { + new TreeVisitor() { + @Override + public void process(Node node) { + if (node instanceof IntegerLiteralExpr) { + node.getParentNode() + .ifPresent(parent -> + ((ArrayInitializerExpr) parent).getValues().add(new IntegerLiteralExpr("1"))); + } + } + }.visitPostOrder(parseExpression("new int[]{1,2,3,4}")); + } + + @Test + void parents() { + CompilationUnit cu = parse("class X{int x=1;}"); + SimpleName x = cu.getClassByName("X") + .get() + .getMember(0) + .asFieldDeclaration() + .getVariable(0) + .getName(); + + Node.ParentsVisitor visitor = new Node.ParentsVisitor(x); + assertEquals("x = 1", visitor.next().toString()); + assertEquals("int x = 1;", visitor.next().toString()); + assertEqualsStringIgnoringEol( + "class X {\n" + "\n" + " int x = 1;\n" + "}", visitor.next().toString()); + assertEqualsStringIgnoringEol( + "class X {\n" + "\n" + " int x = 1;\n" + "}\n", + visitor.next().toString()); + assertFalse(visitor.hasNext()); + } + + @Test + void isValidDirectChildrenTraversal() { + Expression expression = parseExpression("(2+3)+(4+5)"); + + StringBuilder result = new StringBuilder(); + + TreeVisitor visitor = new TreeVisitor() { + @Override + public void process(Node node) { + result.append("<").append(node).append("> "); + } + }; + + visitor.visitDirectChildren(expression); + assertEquals("<(2 + 3)> <(4 + 5)> ", result.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/VoidVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/VoidVisitorTest.java new file mode 100644 index 0000000..6d58f81 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/VoidVisitorTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class VoidVisitorTest { + @Test() + void compareFindAllSizeWithVoidVisitorAdapterSize() throws IOException { + CompilationUnit unit = createUnit(); + + List oce = unit.findAll(ObjectCreationExpr.class); + + AtomicInteger foundObjs = new AtomicInteger(0); + unit.accept( + new VoidVisitorAdapter() { + @Override + public void visit(ObjectCreationExpr exp, Object arg) { + super.visit(exp, arg); + ((AtomicInteger) arg).incrementAndGet(); + } + }, + foundObjs); + + Assertions.assertEquals(oce.size(), foundObjs.get()); + } + + private CompilationUnit createUnit() { + JavaParser javaParser = new JavaParser(); + + CompilationUnit unit = javaParser + .parse("public class Test\n" + "{\n" + + " public class InnerTest\n" + + " {\n" + + " public InnerTest() {}\n" + + " }\n" + + " \n" + + " public Test() {\n" + + " }\n" + + "\n" + + " public static void main( String[] args ) { \n" + + " new Test().new InnerTest();\n" + + " }\n" + + "}") + .getResult() + .get(); + return unit; + } + + @Test() + void testFindAllSize() throws IOException { + CompilationUnit unit = createUnit(); + + List oce = unit.findAll(ObjectCreationExpr.class); + + Assertions.assertEquals(2, oce.size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaultsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaultsTest.java new file mode 100644 index 0000000..c76fd6c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaultsTest.java @@ -0,0 +1,708 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General License for more details. + */ + +package com.github.javaparser.ast.visitor; + +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.mockito.Mockito.*; +import static org.mockito.MockitoAnnotations.openMocks; + +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.BlockComment; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; + +/** + * This class contains the tests to validate VoidVisitorWithDefaults. + * + * @author 4everTheOne + */ +class VoidVisitorWithDefaultsTest { + + @Captor + private ArgumentCaptor argumentCaptor; + + private Object argument; + private VoidVisitorWithDefaults visitor; + + @BeforeEach + void initialize() { + openMocks(this); + + argument = new Object(); + visitor = spy(new VoidVisitorWithDefaults() {}); + } + + @Test + void testThatVisitWithNodeListMethodAsParameter() { + NodeList nodeList = new NodeList<>(); + visitor.visit(nodeList, argument); + + // Verify that the call was executed + verify(visitor, times(1)).visit(same(nodeList), argumentCaptor.capture()); + verify(visitor, times(1)).defaultAction(same(nodeList), same(argumentCaptor.getValue())); + assertSame(argument, argumentCaptor.getValue()); + verifyNoMoreInteractions(visitor); + } + + @Test + void testThatVisitWithAnnotationDeclarationMethodAsParameterCallsDefaultAction() { + visitor.visit(mock(AnnotationDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithAnnotationMemberDeclarationMethodAsParameterCallsDefaultAction() { + visitor.visit(mock(AnnotationMemberDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayAccessExprMethodAsParameterCallsDefaultAction() { + visitor.visit(mock(ArrayAccessExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayCreationExprMethodAsParameterCallsDefaultAction() { + visitor.visit(mock(ArrayCreationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayInitializerExprMethodAsParameterCallsDefaultAction() { + visitor.visit(mock(ArrayInitializerExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithAssertStmtMethodAsParameterCallsDefaultAction() { + visitor.visit(mock(AssertStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithBlockStmtAsParameterCallDefaultAction() { + visitor.visit(mock(BlockStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithBooleanLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(BooleanLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithBreakStmtAsParameterCallDefaultAction() { + visitor.visit(mock(BreakStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithCastExprAsParameterCallDefaultAction() { + visitor.visit(mock(CastExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithCatchClauseAsParameterCallDefaultAction() { + visitor.visit(mock(CatchClause.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithCharLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(CharLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithClassExprAsParameterCallDefaultAction() { + visitor.visit(mock(ClassExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithClassOrInterfaceDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(ClassOrInterfaceDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithClassOrInterfaceTypeAsParameterCallDefaultAction() { + visitor.visit(mock(ClassOrInterfaceType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithCompilationUnitAsParameterCallDefaultAction() { + visitor.visit(mock(CompilationUnit.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithConditionalExprAsParameterCallDefaultAction() { + visitor.visit(mock(ConditionalExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithConstructorDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(ConstructorDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithContinueStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ContinueStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithDoStmtAsParameterCallDefaultAction() { + visitor.visit(mock(DoStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithDoubleLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(DoubleLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithAnnotationDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(AnnotationDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithAnnotationMemberDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(AnnotationMemberDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayAccessExprAsParameterCallDefaultAction() { + visitor.visit(mock(ArrayAccessExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayCreationExprAsParameterCallDefaultAction() { + visitor.visit(mock(ArrayCreationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayCreationLevelAsParameterCallDefaultAction() { + visitor.visit(mock(ArrayCreationLevel.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayInitializerExprAsParameterCallDefaultAction() { + visitor.visit(mock(ArrayInitializerExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithArrayTypeAsParameterCallDefaultAction() { + visitor.visit(mock(ArrayType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithAssertStmtAsParameterCallDefaultAction() { + visitor.visit(mock(AssertStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithAssignExprAsParameterCallDefaultAction() { + visitor.visit(mock(AssignExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithBinaryExprAsParameterCallDefaultAction() { + visitor.visit(mock(BinaryExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithBlockCommentAsParameterCallDefaultAction() { + visitor.visit(mock(BlockComment.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithEmptyStmtAsParameterCallDefaultAction() { + visitor.visit(mock(EmptyStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithEnclosedExprAsParameterCallDefaultAction() { + visitor.visit(mock(EnclosedExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithEnumConstantDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(EnumConstantDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithEnumDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(EnumDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithExplicitConstructorInvocationStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ExplicitConstructorInvocationStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithExpressionStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ExpressionStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithFieldAccessExprAsParameterCallDefaultAction() { + visitor.visit(mock(FieldAccessExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithFieldDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(FieldDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithForEachStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ForEachStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithForStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ForStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithIfStmtAsParameterCallDefaultAction() { + visitor.visit(mock(IfStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithImportDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(ImportDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithInitializerDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(InitializerDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithInstanceOfExprAsParameterCallDefaultAction() { + visitor.visit(mock(InstanceOfExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithIntegerLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(IntegerLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithIntersectionTypeAsParameterCallDefaultAction() { + visitor.visit(mock(IntersectionType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithJavadocCommentAsParameterCallDefaultAction() { + visitor.visit(mock(JavadocComment.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithLabeledStmtAsParameterCallDefaultAction() { + visitor.visit(mock(LabeledStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithLambdaExprAsParameterCallDefaultAction() { + visitor.visit(mock(LambdaExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithLineCommentAsParameterCallDefaultAction() { + visitor.visit(mock(LineComment.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithLocalClassDeclarationStmtAsParameterCallDefaultAction() { + visitor.visit(mock(LocalClassDeclarationStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithLocalRecordDeclarationStmtAsParameterCallDefaultAction() { + visitor.visit(mock(LocalRecordDeclarationStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithLongLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(LongLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithMarkerAnnotationExprAsParameterCallDefaultAction() { + visitor.visit(mock(MarkerAnnotationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithMemberValuePairAsParameterCallDefaultAction() { + visitor.visit(mock(MemberValuePair.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithMethodCallExprAsParameterCallDefaultAction() { + visitor.visit(mock(MethodCallExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithMethodDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(MethodDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithMethodReferenceExprAsParameterCallDefaultAction() { + visitor.visit(mock(MethodReferenceExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModifierAsParameterCallDefaultAction() { + visitor.visit(mock(Modifier.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModuleDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(ModuleDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModuleExportsDirectiveAsParameterCallDefaultAction() { + visitor.visit(mock(ModuleExportsDirective.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModuleOpensDirectiveAsParameterCallDefaultAction() { + visitor.visit(mock(ModuleOpensDirective.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModuleProvidesDirectiveAsParameterCallDefaultAction() { + visitor.visit(mock(ModuleProvidesDirective.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModuleRequiresDirectiveAsParameterCallDefaultAction() { + visitor.visit(mock(ModuleRequiresDirective.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithModuleUsesDirectiveAsParameterCallDefaultAction() { + visitor.visit(mock(ModuleUsesDirective.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithNameExprAsParameterCallDefaultAction() { + visitor.visit(mock(NameExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithNameAsParameterCallDefaultAction() { + visitor.visit(mock(Name.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithNormalAnnotationExprAsParameterCallDefaultAction() { + visitor.visit(mock(NormalAnnotationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithNullLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(NullLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithObjectCreationExprAsParameterCallDefaultAction() { + visitor.visit(mock(ObjectCreationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithPackageDeclarationAsParameterCallDefaultAction() { + visitor.visit(mock(PackageDeclaration.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithParameterAsParameterCallDefaultAction() { + visitor.visit(mock(Parameter.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithTypePatternExprAsParameterCallDefaultAction() { + visitor.visit(mock(TypePatternExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithRecordPatternExprAsParameterCallDefaultAction() { + visitor.visit(mock(RecordPatternExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithPrimitiveTypeAsParameterCallDefaultAction() { + visitor.visit(mock(PrimitiveType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithReceiverParameterAsParameterCallDefaultAction() { + visitor.visit(mock(ReceiverParameter.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithReturnStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ReturnStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSimpleNameAsParameterCallDefaultAction() { + visitor.visit(mock(SimpleName.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSingleMemberAnnotationExprAsParameterCallDefaultAction() { + visitor.visit(mock(SingleMemberAnnotationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithStringLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(StringLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSuperExprAsParameterCallDefaultAction() { + visitor.visit(mock(SuperExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSwitchEntryAsParameterCallDefaultAction() { + visitor.visit(mock(SwitchEntry.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSwitchExprAsParameterCallDefaultAction() { + visitor.visit(mock(SwitchExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSwitchStmtAsParameterCallDefaultAction() { + visitor.visit(mock(SwitchStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithSynchronizedStmtAsParameterCallDefaultAction() { + visitor.visit(mock(SynchronizedStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithTextBlockLiteralExprAsParameterCallDefaultAction() { + visitor.visit(mock(TextBlockLiteralExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithThisExprAsParameterCallDefaultAction() { + visitor.visit(mock(ThisExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithThrowStmtAsParameterCallDefaultAction() { + visitor.visit(mock(ThrowStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithTryStmtAsParameterCallDefaultAction() { + visitor.visit(mock(TryStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithTypeExprAsParameterCallDefaultAction() { + visitor.visit(mock(TypeExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithTypeParameterAsParameterCallDefaultAction() { + visitor.visit(mock(TypeParameter.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithUnaryExprAsParameterCallDefaultAction() { + visitor.visit(mock(UnaryExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithUnionTypeAsParameterCallDefaultAction() { + visitor.visit(mock(UnionType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithUnknownTypeAsParameterCallDefaultAction() { + visitor.visit(mock(UnknownType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithUnparsableStmtAsParameterCallDefaultAction() { + visitor.visit(mock(UnparsableStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithVarTypeAsParameterCallDefaultAction() { + visitor.visit(mock(VarType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithVariableDeclarationExprAsParameterCallDefaultAction() { + visitor.visit(mock(VariableDeclarationExpr.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithVariableDeclaratorCallDefaultAction() { + visitor.visit(mock(VariableDeclarator.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithVoidTypeAsParameterCallDefaultAction() { + visitor.visit(mock(VoidType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithWhileStmtAsParameterCallDefaultAction() { + visitor.visit(mock(WhileStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithWildcardTypeAsParameterCallDefaultAction() { + visitor.visit(mock(WildcardType.class), argument); + assertNodeVisitDefaultAction(); + } + + @Test + void testThatVisitWithYieldStmtAsParameterCallDefaultAction() { + visitor.visit(mock(YieldStmt.class), argument); + assertNodeVisitDefaultAction(); + } + + /** + * Assert that at the default methods was called only once and with the same argument. + */ + void assertNodeVisitDefaultAction() { + // Check if the default method was only called once + verify(visitor, times(1)).defaultAction(isA(Node.class), argumentCaptor.capture()); + // Check if the original argument was passed to the default method + assertSame(argument, argumentCaptor.getValue()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/ClassOrInterfaceDeclarationBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/ClassOrInterfaceDeclarationBuildersTest.java new file mode 100644 index 0000000..be0af76 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/ClassOrInterfaceDeclarationBuildersTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.utils.LineSeparator; +import java.util.List; +import java.util.function.Function; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class ClassOrInterfaceDeclarationBuildersTest { + CompilationUnit cu; + + @BeforeEach + void setup() { + cu = new CompilationUnit(); + } + + @AfterEach + void teardown() { + cu = null; + } + + @Test + void testAddExtends() { + ClassOrInterfaceDeclaration testClass = cu.addClass("test"); + testClass.addExtendedType(List.class); + assertEquals(1, cu.getImports().size()); + assertEquals( + "import " + List.class.getName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals(1, testClass.getExtendedTypes().size()); + assertEquals(List.class.getSimpleName(), testClass.getExtendedTypes(0).getNameAsString()); + } + + @Test + void testAddImplements() { + ClassOrInterfaceDeclaration testClass = cu.addClass("test"); + testClass.addImplementedType(Function.class); + assertEquals(1, cu.getImports().size()); + assertEquals( + "import " + Function.class.getName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals(1, testClass.getImplementedTypes().size()); + assertEquals( + Function.class.getSimpleName(), testClass.getImplementedTypes(0).getNameAsString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/CompilationUnitBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/CompilationUnitBuildersTest.java new file mode 100644 index 0000000..6dfe046 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/CompilationUnitBuildersTest.java @@ -0,0 +1,326 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static com.github.javaparser.StaticJavaParser.parseImport; +import static com.github.javaparser.ast.Modifier.Keyword.PRIVATE; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.AnnotationDeclaration; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.ast.body.RecordDeclaration; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.utils.LineSeparator; +import java.lang.annotation.ElementType; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class CompilationUnitBuildersTest { + private final CompilationUnit cu = new CompilationUnit(); + + @Test + void testAddImport() { + // duplicate imports + cu.addImport(Map.class); + cu.addImport(Map.class); + cu.addImport(Map.class.getCanonicalName()); + cu.addImport(List.class); + assertEquals(2, cu.getImports().size()); + + cu.addImport(com.github.javaparser.StaticJavaParser.class.getCanonicalName() + ".parseImport", true, false); + assertEquals(3, cu.getImports().size()); + + assertEquals( + "import " + Map.class.getCanonicalName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals( + "import " + List.class.getCanonicalName() + ";" + LineSeparator.SYSTEM, + cu.getImport(1).toString()); + assertEquals( + "import static " + com.github.javaparser.StaticJavaParser.class.getCanonicalName() + ".parseImport;" + + LineSeparator.SYSTEM, + cu.getImport(2).toString()); + } + + // issue https://github.com/javaparser/javaparser/issues/4554 + @Test + void testNoRangeWhenCreatedProgramatically() { + cu.addImport(Map.class); + assertTrue(verifyNoRange(cu.getImports())); + } + + private boolean verifyNoRange(List declarations) { + return declarations.stream().noneMatch(decl -> decl.getRange().isPresent()); + } + + public class $tartsWith$ {} + + @Test + public void test$ImportStarts() { + cu.addImport($tartsWith$.class); + cu.addImport("my.$tartsWith$"); + assertEquals(2, cu.getImports().size()); + assertEquals( + "import " + $tartsWith$.class.getCanonicalName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals( + "import my.$tartsWith$;" + LineSeparator.SYSTEM, cu.getImport(1).toString()); + } + + public class F$F {} + + @Test + public void test$Import() { + cu.addImport(F$F.class); + cu.addImport("my.F$F"); + // doesnt fail, but imports class "F.F" + assertEquals(2, cu.getImports().size()); + assertEquals( + "import " + F$F.class.getCanonicalName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals("import my.F$F;" + LineSeparator.SYSTEM, cu.getImport(1).toString()); + } + + @Test + void ignoreJavaLangImports() { + cu.addImport("java.lang.Long"); + cu.addImport("java.lang.*"); + cu.addImport(String.class); + assertEquals(0, cu.getImports().size()); + } + + @Test + void ignoreImportsWithinSamePackage() { + cu.setPackageDeclaration(new PackageDeclaration(new Name(new Name("one"), "two"))); + cu.addImport("one.two.IgnoreImportWithinSamePackage"); + assertEquals(0, cu.getImports().size()); + cu.addImport("one.two.three.DoNotIgnoreImportWithinSubPackage"); + assertEquals(1, cu.getImports().size()); + assertEquals( + "import one.two.three.DoNotIgnoreImportWithinSubPackage;" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + } + + @Test + void throwIllegalArgumentExceptionOnImportingAnonymousClass() { + assertThrows( + IllegalArgumentException.class, + () -> cu.addImport( + new Comparator() { + + @Override + public int compare(Long o1, Long o2) { + return o1.compareTo(o2); + } + }.getClass())); + } + + @Test + void throwIllegalArgumentExceptionOnImportingLocalClass() { + class LocalClass implements Comparator { + + @Override + public int compare(Long o1, Long o2) { + return o1.compareTo(o2); + } + } + Class localClass = LocalClass.class; + assertThrows(IllegalArgumentException.class, () -> cu.addImport(localClass)); + } + + @Test + void ignoreImportsOfDefaultPackageClasses() { + cu.addImport("MyImport"); + assertEquals(0, cu.getImports().size()); + } + + @Test + void duplicateByAsterisk() { + // check asterisk imports + cu.addImport("my", false, true); + cu.addImport("my.Import"); + cu.addImport("my.AnotherImport"); + cu.addImport("my.other.Import"); + assertEquals(2, cu.getImports().size()); + assertEquals("import my.*;" + LineSeparator.SYSTEM, cu.getImport(0).toString()); + assertEquals( + "import my.other.Import;" + LineSeparator.SYSTEM, + cu.getImport(1).toString()); + cu.addImport("my.other.*"); + assertEquals(2, cu.getImports().size()); + assertEquals("import my.*;" + LineSeparator.SYSTEM, cu.getImport(0).toString()); + assertEquals( + "import my.other.*;" + LineSeparator.SYSTEM, cu.getImport(1).toString()); + } + + @Test + void typesInTheJavaLangPackageDoNotNeedExplicitImports() { + cu.addImport(String.class); + assertEquals(0, cu.getImports().size()); + } + + @Test + void typesInSubPackagesOfTheJavaLangPackageRequireExplicitImports() { + cu.addImport(ElementType.class); + assertEquals(1, cu.getImports().size()); + assertEquals( + "import java.lang.annotation.ElementType;" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + } + + @Test + void doNotAddDuplicateImportsByClass() { + cu.addImport(Map.class); + cu.addImport(Map.class); + assertEquals(1, cu.getImports().size()); + } + + @Test + void doNotAddDuplicateImportsByString() { + cu.addImport(Map.class); + cu.addImport("java.util.Map"); + assertEquals(1, cu.getImports().size()); + } + + @Test + void doNotAddDuplicateImportsByStringAndFlags() { + cu.addImport(Map.class); + cu.addImport("java.util.Map", false, false); + assertEquals(1, cu.getImports().size()); + } + + @Test + void doNotAddDuplicateImportsByImportDeclaration() { + cu.addImport(Map.class); + cu.addImport(parseImport("import java.util.Map;")); + assertEquals(1, cu.getImports().size()); + } + + @Test + void testAddImportArrayTypes() { + cu.addImport(CompilationUnit[][][].class); + cu.addImport(int[][][].class); + cu.addImport(Integer[][][].class); + cu.addImport(List[][][].class); + assertEquals(2, cu.getImports().size()); + assertEquals( + "com.github.javaparser.ast.CompilationUnit", cu.getImport(0).getNameAsString()); + assertEquals("java.util.List", cu.getImport(1).getNameAsString()); + } + + class testInnerClass {} + + @Test + void testAddImportAnonymousClass() { + cu.addImport(testInnerClass.class); + assertEquals( + "import " + testInnerClass.class.getCanonicalName().replace("$", ".") + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + } + + @Test + void testAddClass() { + ClassOrInterfaceDeclaration myClassDeclaration = cu.addClass("testClass", PRIVATE); + assertEquals(1, cu.getTypes().size()); + assertEquals("testClass", cu.getType(0).getNameAsString()); + assertEquals(ClassOrInterfaceDeclaration.class, cu.getType(0).getClass()); + assertTrue(myClassDeclaration.isPrivate()); + assertFalse(myClassDeclaration.isInterface()); + } + + @Test + void testAddInterface() { + ClassOrInterfaceDeclaration myInterfaceDeclaration = cu.addInterface("testInterface"); + assertEquals(1, cu.getTypes().size()); + assertEquals("testInterface", cu.getType(0).getNameAsString()); + assertTrue(myInterfaceDeclaration.isPublic()); + assertEquals(ClassOrInterfaceDeclaration.class, cu.getType(0).getClass()); + assertTrue(myInterfaceDeclaration.isInterface()); + } + + @Test + void testAddEnum() { + EnumDeclaration myEnumDeclaration = cu.addEnum("test"); + assertEquals(1, cu.getTypes().size()); + assertEquals("test", cu.getType(0).getNameAsString()); + assertTrue(myEnumDeclaration.isPublic()); + assertEquals(EnumDeclaration.class, cu.getType(0).getClass()); + } + + @Test + void testAddAnnotationDeclaration() { + AnnotationDeclaration myAnnotationDeclaration = cu.addAnnotationDeclaration("test"); + assertEquals(1, cu.getTypes().size()); + assertEquals("test", cu.getType(0).getNameAsString()); + assertTrue(myAnnotationDeclaration.isPublic()); + assertEquals(AnnotationDeclaration.class, cu.getType(0).getClass()); + } + + @Test + void testAddTypeWithRecordDeclaration() { + RecordDeclaration myRecordDeclaration = new RecordDeclaration(Modifier.createModifierList(PUBLIC), "test"); + cu.addType(myRecordDeclaration); + assertEquals(1, cu.getTypes().size()); + assertEquals("test", cu.getType(0).getNameAsString()); + assertTrue(myRecordDeclaration.isPublic()); + assertTrue(myRecordDeclaration.isFinal()); + assertEquals(RecordDeclaration.class, cu.getType(0).getClass()); + } + + @Test + void testGetClassByName() { + assertEquals(cu.addClass("test"), cu.getClassByName("test").get()); + } + + @Test + void testGetInterfaceByName() { + assertEquals(cu.addInterface("test"), cu.getInterfaceByName("test").get()); + } + + @Test + void testGetEnumByName() { + assertEquals(cu.addEnum("test"), cu.getEnumByName("test").get()); + } + + @Test + void testGetAnnotationDeclarationByName() { + assertEquals( + cu.addAnnotationDeclaration("test"), + cu.getAnnotationDeclarationByName("test").get()); + } + + @Test + void testGetRecordByName() { + assertEquals( + cu.addType(new RecordDeclaration(Modifier.createModifierList(), "test")) + .getType(0), + cu.getRecordByName("test").get()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/EnumDeclarationBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/EnumDeclarationBuildersTest.java new file mode 100644 index 0000000..dd88b1b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/EnumDeclarationBuildersTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.utils.LineSeparator; +import java.util.function.Function; +import org.junit.jupiter.api.Test; + +class EnumDeclarationBuildersTest { + private final CompilationUnit cu = new CompilationUnit(); + + @Test + void testAddImplements() { + EnumDeclaration testEnum = cu.addEnum("test"); + testEnum.addImplementedType(Function.class); + assertEquals(1, cu.getImports().size()); + assertEquals( + "import " + Function.class.getName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals(1, testEnum.getImplementedTypes().size()); + assertEquals( + Function.class.getSimpleName(), testEnum.getImplementedTypes(0).getNameAsString()); + } + + @Test + void testAddEnumConstant() { + EnumDeclaration testEnum = cu.addEnum("test"); + testEnum.addEnumConstant("MY_ENUM_CONSTANT"); + assertEquals(1, testEnum.getEntries().size()); + assertEquals("MY_ENUM_CONSTANT", testEnum.getEntry(0).getNameAsString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/FieldDeclarationBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/FieldDeclarationBuildersTest.java new file mode 100644 index 0000000..eca2bc0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/FieldDeclarationBuildersTest.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static com.github.javaparser.ast.type.PrimitiveType.intType; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.ReturnStmt; +import java.util.List; +import org.junit.jupiter.api.Test; + +class FieldDeclarationBuildersTest { + private final CompilationUnit cu = new CompilationUnit(); + private ClassOrInterfaceDeclaration testClass = cu.addClass("testClass"); + private EnumDeclaration testEnum = cu.addEnum("testEnum"); + + @Test + void testOrphanFieldGetter() { + assertThrows(IllegalStateException.class, () -> new FieldDeclaration().createGetter()); + } + + @Test + void testOrphanFieldSetter() { + assertThrows(IllegalStateException.class, () -> new FieldDeclaration().createSetter()); + } + + @Test + void testCreateGetterInAClass() { + testClass.addPrivateField(int.class, "myField").createGetter(); + assertEquals(2, testClass.getMembers().size()); + assertEquals(MethodDeclaration.class, testClass.getMember(1).getClass()); + List methodsWithName = testClass.getMethodsByName("getMyField"); + assertEquals(1, methodsWithName.size()); + MethodDeclaration getter = methodsWithName.get(0); + assertEquals("getMyField", getter.getNameAsString()); + assertEquals("int", getter.getType().toString()); + assertEquals(ReturnStmt.class, getter.getBody().get().getStatement(0).getClass()); + } + + @Test + void testCreateSetterInAClass() { + testClass.addPrivateField(int.class, "myField").createSetter(); + assertEquals(2, testClass.getMembers().size()); + assertEquals(MethodDeclaration.class, testClass.getMember(1).getClass()); + List methodsWithName = testClass.getMethodsByName("setMyField"); + assertEquals(1, methodsWithName.size()); + MethodDeclaration setter = methodsWithName.get(0); + assertEquals("setMyField", setter.getNameAsString()); + assertEquals("int", setter.getParameter(0).getType().toString()); + assertEquals( + ExpressionStmt.class, setter.getBody().get().getStatement(0).getClass()); + assertEquals( + "this.myField = myField;", + setter.getBody().get().getStatement(0).toString()); + } + + @Test + void testCreateGetterInEnum() { + testEnum.addPrivateField(int.class, "myField").createGetter(); + assertEquals(2, testEnum.getMembers().size()); + assertEquals(MethodDeclaration.class, testEnum.getMember(1).getClass()); + List methodsWithName = testEnum.getMethodsByName("getMyField"); + assertEquals(1, methodsWithName.size()); + MethodDeclaration getter = methodsWithName.get(0); + assertEquals("getMyField", getter.getNameAsString()); + assertEquals("int", getter.getType().toString()); + assertEquals(ReturnStmt.class, getter.getBody().get().getStatement(0).getClass()); + } + + @Test + void testCreateSetterInEnum() { + testEnum.addPrivateField(int.class, "myField").createSetter(); + assertEquals(2, testEnum.getMembers().size()); + assertEquals(MethodDeclaration.class, testEnum.getMember(1).getClass()); + List methodsWithName = testEnum.getMethodsByName("setMyField"); + assertEquals(1, methodsWithName.size()); + MethodDeclaration setter = methodsWithName.get(0); + assertEquals("setMyField", setter.getNameAsString()); + assertEquals("int", setter.getParameter(0).getType().toString()); + assertEquals( + ExpressionStmt.class, setter.getBody().get().getStatement(0).getClass()); + assertEquals( + "this.myField = myField;", + setter.getBody().get().getStatement(0).toString()); + } + + @Test + void testCreateGetterWithANonValidField() { + assertThrows(IllegalStateException.class, () -> { + FieldDeclaration myPrivateField = testClass.addPrivateField(int.class, "myField"); + myPrivateField.getVariables().add(new VariableDeclarator(intType(), "secondField")); + myPrivateField.createGetter(); + }); + } + + @Test + void testCreateSetterWithANonValidField() { + assertThrows(IllegalStateException.class, () -> { + FieldDeclaration myPrivateField = testClass.addPrivateField(int.class, "myField"); + myPrivateField.getVariables().add(new VariableDeclarator(intType(), "secondField")); + myPrivateField.createSetter(); + }); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithAnnotationsBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithAnnotationsBuildersTest.java new file mode 100644 index 0000000..e85fc45 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithAnnotationsBuildersTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.NormalAnnotationExpr; +import com.github.javaparser.ast.expr.SimpleName; +import org.junit.jupiter.api.Test; + +class NodeWithAnnotationsBuildersTest { + private CompilationUnit cu = new CompilationUnit(); + private ClassOrInterfaceDeclaration testClass = cu.addClass("testClass"); + + @interface hey {} + + @Test + void testAddAnnotation() { + NormalAnnotationExpr annotation = testClass.addAndGetAnnotation(hey.class); + assertEquals( + "import com.github.javaparser.builders.NodeWithAnnotationsBuildersTest.hey;", + cu.getImport(0).toString().trim()); + assertEquals(1, testClass.getAnnotations().size()); + assertEquals(annotation, testClass.getAnnotation(0)); + assertEquals(NormalAnnotationExpr.class, testClass.getAnnotation(0).getClass()); + } + + @Test + void testAddMarkerAnnotation() { + testClass.addMarkerAnnotation("test"); + assertEquals(1, testClass.getAnnotations().size()); + } + + @Test + void testAddSingleMemberAnnotation() { + testClass.addSingleMemberAnnotation("test", "value"); + assertEquals(1, testClass.getAnnotations().size()); + assertEquals( + "value", + testClass + .getAnnotation(0) + .asSingleMemberAnnotationExpr() + .getMemberValue() + .toString()); + } + + @Test + void testAddSingleMemberAnnotation2() { + testClass.addSingleMemberAnnotation(hey.class, new NameExpr(new SimpleName("value"))); + assertEquals(1, testClass.getAnnotations().size()); + assertEquals( + "value", + testClass + .getAnnotation(0) + .asSingleMemberAnnotationExpr() + .getMemberValue() + .toString()); + } + + @Test + void testIsAnnotationPresent() { + testClass.addMarkerAnnotation(hey.class); + assertTrue(testClass.isAnnotationPresent(hey.class)); + } + + @Test + void testGetAnnotationByName() { + NormalAnnotationExpr annotation = testClass.addAndGetAnnotation(hey.class); + assertEquals(annotation, testClass.getAnnotationByName("hey").get()); + } + + @Test + void testGetAnnotationByClass() { + NormalAnnotationExpr annotation = testClass.addAndGetAnnotation(hey.class); + assertEquals(annotation, testClass.getAnnotationByClass(hey.class).get()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithMembersBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithMembersBuildersTest.java new file mode 100644 index 0000000..29d2de8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithMembersBuildersTest.java @@ -0,0 +1,322 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.ast.Modifier.Keyword.*; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import java.util.List; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class NodeWithMembersBuildersTest { + private final CompilationUnit cu = new CompilationUnit(); + private final ClassOrInterfaceDeclaration classDeclaration = cu.addClass("test"); + + @Test + void testAddField() { + FieldDeclaration addField = classDeclaration.addField(int.class, "fieldName", PRIVATE); + assertEquals(1, classDeclaration.getMembers().size()); + assertEquals(addField, classDeclaration.getMember(0)); + assertEquals("fieldName", addField.getVariable(0).getNameAsString()); + } + + @Test + void testAddMethod() { + MethodDeclaration addMethod = classDeclaration.addMethod("foo", PUBLIC); + assertEquals(1, classDeclaration.getMembers().size()); + assertEquals(addMethod, classDeclaration.getMember(0)); + assertEquals("foo", addMethod.getNameAsString()); + } + + @Test + void testAddCtor() { + ConstructorDeclaration addCtor = classDeclaration.addConstructor(PUBLIC); + assertEquals(1, classDeclaration.getMembers().size()); + assertEquals(addCtor, classDeclaration.getMember(0)); + assertEquals(classDeclaration.getName(), addCtor.getName()); + } + + @Test + void testAddInitializers() { + classDeclaration.addInitializer(); + assertEquals(1, classDeclaration.getMembers().size()); + assertEquals(InitializerDeclaration.class, classDeclaration.getMember(0).getClass()); + + classDeclaration.addStaticInitializer(); + assertEquals(2, classDeclaration.getMembers().size()); + assertEquals(InitializerDeclaration.class, classDeclaration.getMember(0).getClass()); + } + + @Test + void testGetMethodsWithName() { + MethodDeclaration addMethod = classDeclaration.addMethod("foo", PUBLIC); + MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", PUBLIC).addParameter(int.class, "overload"); + List methodsByName = classDeclaration.getMethodsByName("foo"); + assertEquals(2, methodsByName.size()); + assertTrue(methodsByName.contains(addMethod)); + assertTrue(methodsByName.contains(addMethod2)); + } + + @Test + void testGetMethods() { + MethodDeclaration addMethod = classDeclaration.addMethod("foo", PUBLIC); + MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", PUBLIC).addParameter(int.class, "overload"); + + List methods = classDeclaration.getMethods(); + + assertEquals(2, methods.size()); + assertTrue(methods.contains(addMethod)); + assertTrue(methods.contains(addMethod2)); + } + + @Test + void testGetMethodsWithParameterTypes() { + MethodDeclaration mFoo = classDeclaration.addMethod("foo", PUBLIC); // foo() + MethodDeclaration mFooInt = classDeclaration.addMethod("foo", PUBLIC).addParameter(int.class, "i"); // foo(int) + ClassOrInterfaceType type = parseClassOrInterfaceType("List"); + type.setTypeArguments(parseClassOrInterfaceType("String")); + MethodDeclaration mFooIntList = classDeclaration + .addMethod("foo", PUBLIC) + .addParameter(int.class, "i") + .addParameter(type, "l"); // foo(int, List) + MethodDeclaration mFooListInt = classDeclaration + .addMethod("foo", PUBLIC) + .addParameter(type, "l") + .addParameter(int.class, "i"); // foo(List, int) + MethodDeclaration mFoo2Int = + classDeclaration.addMethod("foo2", PUBLIC).addParameter(int.class, "i"); // foo2(int) + MethodDeclaration mFoo2IntInt = classDeclaration + .addMethod("foo2", PUBLIC) + .addParameter(int.class, "i") + .addParameter(int.class, "j"); // foo2(int, int) + + List methodsWithNoParams = + classDeclaration.getMethodsByParameterTypes(new Class[0]); // should return foo() + assertEquals(1, methodsWithNoParams.size()); + assertTrue(methodsWithNoParams.contains(mFoo)); + + List methodsWithIntParam = + classDeclaration.getMethodsByParameterTypes(int.class); // should return foo(int) and foo2(int) + assertEquals(2, methodsWithIntParam.size()); + assertTrue(methodsWithIntParam.contains(mFooInt)); + assertTrue(methodsWithIntParam.contains(mFoo2Int)); + + List methodsWithListParam = classDeclaration.getMethodsByParameterTypes("List"); + assertEquals(0, methodsWithListParam.size()); + + List methodsWithIntAndListParams = + classDeclaration.getMethodsByParameterTypes("int", "List"); + assertEquals(1, methodsWithIntAndListParams.size()); + assertTrue(methodsWithIntAndListParams.contains(mFooIntList)); + + List methodsWithListAndIntParams = + classDeclaration.getMethodsByParameterTypes(List.class, int.class); + assertEquals(1, methodsWithListAndIntParams.size()); + assertTrue(methodsWithListAndIntParams.contains(mFooListInt)); + + List methodsWithIntAndIntParams = + classDeclaration.getMethodsByParameterTypes(int.class, int.class); + assertEquals(1, methodsWithListAndIntParams.size()); + assertTrue(methodsWithIntAndIntParams.contains(mFoo2IntInt)); + } + + @Test + void testGetConstructors() { + ConstructorDeclaration addConstructor = classDeclaration.addConstructor(PUBLIC); + ConstructorDeclaration addConstructor2 = + classDeclaration.addConstructor(PUBLIC).addParameter(int.class, "overload"); + + List constructors = classDeclaration.getConstructors(); + + assertEquals(2, constructors.size()); + assertTrue(constructors.contains(addConstructor)); + assertTrue(constructors.contains(addConstructor2)); + } + + @Test + void testGetConstructorsWithParameterTypes() { + ConstructorDeclaration c = classDeclaration.addConstructor(PUBLIC); // Foo() + ConstructorDeclaration cInt = classDeclaration.addConstructor(PUBLIC).addParameter(int.class, "i"); // Foo(int) + ClassOrInterfaceType type = parseClassOrInterfaceType("List"); + type.setTypeArguments(parseClassOrInterfaceType("String")); + ConstructorDeclaration cIntList = classDeclaration + .addConstructor(PUBLIC) + .addParameter(int.class, "i") + .addParameter(type, "l"); // Foo(int, List) + ConstructorDeclaration cListInt = classDeclaration + .addConstructor(PUBLIC) + .addParameter(type, "l") + .addParameter(int.class, "i"); // Foo(List, int) + ConstructorDeclaration cIntInt = classDeclaration + .addConstructor(PUBLIC) + .addParameter(int.class, "i") + .addParameter(int.class, "j"); // Foo(int, int) + + Optional constructorWithNoParams = classDeclaration.getDefaultConstructor(); + assertTrue(constructorWithNoParams.isPresent()); + assertSame(c, constructorWithNoParams.get()); + + Optional constructorWithIntParam = + classDeclaration.getConstructorByParameterTypes(int.class); + assertTrue(constructorWithIntParam.isPresent()); + assertSame(cInt, constructorWithIntParam.get()); + + Optional constructorWithListParam = + classDeclaration.getConstructorByParameterTypes("List"); + assertFalse(constructorWithListParam.isPresent()); + + Optional constructorWithIntAndListParams = + classDeclaration.getConstructorByParameterTypes("int", "List"); + assertTrue(constructorWithIntAndListParams.isPresent()); + assertSame(cIntList, constructorWithIntAndListParams.get()); + + Optional constructorWithListAndIntParams = + classDeclaration.getConstructorByParameterTypes(List.class, int.class); + assertTrue(constructorWithListAndIntParams.isPresent()); + assertSame(cListInt, constructorWithListAndIntParams.get()); + + Optional constructorWithIntAndIntParams = + classDeclaration.getConstructorByParameterTypes(int.class, int.class); + assertTrue(constructorWithIntAndIntParams.isPresent()); + assertSame(cIntInt, constructorWithIntAndIntParams.get()); + } + + @Test + void testGetFieldWithName() { + FieldDeclaration addField = classDeclaration.addField(int.class, "fieldName", PRIVATE); + classDeclaration.addField(float.class, "secondField", PRIVATE); + FieldDeclaration fieldByName = + classDeclaration.getFieldByName("fieldName").get(); + assertEquals(addField, fieldByName); + } + + @Test + void testGetFields() { + FieldDeclaration firstField = classDeclaration.addField(int.class, "fieldName", PRIVATE); + FieldDeclaration secondField = classDeclaration.addField(float.class, "secondField", PRIVATE); + + List fields = classDeclaration.getFields(); + + assertTrue(fields.contains(firstField)); + assertTrue(fields.contains(secondField)); + } + + @Test + void testAddPrivateFieldWithType() { + CompilationUnit compilationUnit = new CompilationUnit(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = compilationUnit.addClass("Person"); + classOrInterfaceDeclaration.addPrivateField(parseType("java.lang.String"), "name"); + + assertNotNull(classOrInterfaceDeclaration.getFields()); + assertEquals(1, classOrInterfaceDeclaration.getFields().size()); + + FieldDeclaration fieldDeclaration = + classOrInterfaceDeclaration.getFields().get(0); + assertEquals(PRIVATE, fieldDeclaration.getModifiers().iterator().next().getKeyword()); + assertEquals( + "java.lang.String", + fieldDeclaration.getVariables().get(0).getType().toString()); + assertEquals("name", fieldDeclaration.getVariables().get(0).getName().toString()); + } + + @Test + void testAddPublicFieldWithType() { + CompilationUnit compilationUnit = new CompilationUnit(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = compilationUnit.addClass("Person"); + classOrInterfaceDeclaration.addPublicField(parseType("java.lang.String"), "name"); + + assertNotNull(classOrInterfaceDeclaration.getFields()); + assertEquals(1, classOrInterfaceDeclaration.getFields().size()); + + FieldDeclaration fieldDeclaration = + classOrInterfaceDeclaration.getFields().get(0); + assertEquals(PUBLIC, fieldDeclaration.getModifiers().iterator().next().getKeyword()); + assertEquals( + "java.lang.String", + fieldDeclaration.getVariables().get(0).getType().toString()); + assertEquals("name", fieldDeclaration.getVariables().get(0).getName().toString()); + } + + @Test + void testAddProtectedFieldWithType() { + CompilationUnit compilationUnit = new CompilationUnit(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = compilationUnit.addClass("Person"); + classOrInterfaceDeclaration.addProtectedField(parseType("java.lang.String"), "name"); + + assertNotNull(classOrInterfaceDeclaration.getFields()); + assertEquals(1, classOrInterfaceDeclaration.getFields().size()); + + FieldDeclaration fieldDeclaration = + classOrInterfaceDeclaration.getFields().get(0); + assertEquals( + PROTECTED, fieldDeclaration.getModifiers().iterator().next().getKeyword()); + assertEquals( + "java.lang.String", + fieldDeclaration.getVariables().get(0).getType().toString()); + assertEquals("name", fieldDeclaration.getVariables().get(0).getName().toString()); + } + + @Test + void testClassWithInitializersWithString() { + CompilationUnit compilationUnit = new CompilationUnit(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = compilationUnit.addClass("Person"); + classOrInterfaceDeclaration.addFieldWithInitializer( + "java.lang.String", "name", parseExpression("John"), PUBLIC); + assertNotNull(classOrInterfaceDeclaration.getFields()); + assertEquals(1, classOrInterfaceDeclaration.getFields().size()); + + FieldDeclaration fieldDeclaration = + classOrInterfaceDeclaration.getFields().get(0); + assertEquals(PUBLIC, fieldDeclaration.getModifiers().iterator().next().getKeyword()); + assertEquals( + "java.lang.String", + fieldDeclaration.getVariables().get(0).getType().toString()); + assertEquals("name", fieldDeclaration.getVariables().get(0).getName().toString()); + assertEquals( + "John", + fieldDeclaration.getVariables().get(0).getInitializer().get().toString()); + } + + @Test + void testClassWithInitializersWithClass() { + CompilationUnit compilationUnit = new CompilationUnit(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = compilationUnit.addClass("Person"); + classOrInterfaceDeclaration.addFieldWithInitializer( + List.class, "skills", parseExpression("new ArrayList()"), PUBLIC); + assertNotNull(classOrInterfaceDeclaration.getFields()); + assertEquals(1, classOrInterfaceDeclaration.getFields().size()); + + FieldDeclaration fieldDeclaration = + classOrInterfaceDeclaration.getFields().get(0); + assertEquals(PUBLIC, fieldDeclaration.getModifiers().iterator().next().getKeyword()); + assertEquals("List", fieldDeclaration.getVariables().get(0).getType().toString()); + assertEquals("skills", fieldDeclaration.getVariables().get(0).getName().toString()); + assertEquals( + "new ArrayList()", + fieldDeclaration.getVariables().get(0).getInitializer().get().toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithParametersBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithParametersBuildersTest.java new file mode 100644 index 0000000..d962bf1 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithParametersBuildersTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.utils.LineSeparator; +import java.util.List; +import org.junit.jupiter.api.Test; + +class NodeWithParametersBuildersTest { + private final CompilationUnit cu = new CompilationUnit(); + + @Test + void testAddParameter() { + MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", PUBLIC); + addMethod.addParameter(int.class, "yay"); + Parameter myNewParam = addMethod.addAndGetParameter(List.class, "myList"); + assertEquals(1, cu.getImports().size()); + assertEquals( + "import " + List.class.getName() + ";" + LineSeparator.SYSTEM, + cu.getImport(0).toString()); + assertEquals(2, addMethod.getParameters().size()); + assertEquals("yay", addMethod.getParameter(0).getNameAsString()); + assertEquals("List", addMethod.getParameter(1).getType().toString()); + assertEquals(myNewParam, addMethod.getParameter(1)); + } + + @Test + void testGetParamByName() { + MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", PUBLIC); + Parameter addAndGetParameter = addMethod.addAndGetParameter(int.class, "yay"); + assertEquals(addAndGetParameter, addMethod.getParameterByName("yay").get()); + } + + @Test + void testGetParamByType() { + MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", PUBLIC); + Parameter addAndGetParameter = addMethod.addAndGetParameter(int.class, "yay"); + assertEquals(addAndGetParameter, addMethod.getParameterByType("int").get()); + assertEquals(addAndGetParameter, addMethod.getParameterByType(int.class).get()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithThrownExceptionsBuildersTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithThrownExceptionsBuildersTest.java new file mode 100644 index 0000000..80eb002 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/builders/NodeWithThrownExceptionsBuildersTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.builders; + +import static com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import org.junit.jupiter.api.Test; + +class NodeWithThrownExceptionsBuildersTest { + private final CompilationUnit cu = new CompilationUnit(); + + @Test + void testThrows() { + MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", PUBLIC); + addMethod.addThrownException(IllegalStateException.class); + assertEquals(1, addMethod.getThrownExceptions().size()); + assertTrue(addMethod.isThrown(IllegalStateException.class)); + addMethod.addThrownException(parseClassOrInterfaceType("Test")); + assertEquals(2, addMethod.getThrownExceptions().size()); + assertEquals("Test", addMethod.getThrownException(1).toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue2627Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue2627Test.java new file mode 100644 index 0000000..227739a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue2627Test.java @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.issues; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.Range; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.MethodDeclaration; +import java.io.IOException; +import java.util.stream.Stream; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +public class Issue2627Test { + + private static final String RESOURCE_PATH_STRING_CR = "com/github/javaparser/issue_samples/issue_2627/Ops_cr.java"; + private static final String RESOURCE_PATH_STRING_LF = "com/github/javaparser/issue_samples/issue_2627/Ops_lf.java"; + private static final String RESOURCE_PATH_STRING_CRLF = + "com/github/javaparser/issue_samples/issue_2627/Ops_crlf.java"; + private static final String RESOURCE_PATH_STRING_MINIMAL = + "com/github/javaparser/issue_samples/issue_2627/Ops_minimal.java"; + private static final String RESOURCE_PATH_STRING_ORIGINAL = + "com/github/javaparser/issue_samples/issue_2627/Ops.java"; + private static final String RESOURCE_PATH_GROOVY_ORIGINAL = + "com/github/javaparser/issue_samples/issue_2627/DefaultStrategy.java"; + + private static Stream arguments_minimal() { + return Stream.of( + Arguments.of("methodA", 258, 260), Arguments.of("methodB", 163, 164), Arguments.of("methodC", 3, 4)); + } + + private static Stream arguments_original() { + return Stream.of( + Arguments.of("batchToSpace", 796, 799), + Arguments.of("batchToSpaceNd", 911, 914), + Arguments.of("placeholder", 3686, 3689)); + } + + private static Stream arguments_groovy_original() { + return Stream.of(Arguments.of("buildMethod", 180, 193)); + } + + private void assertMethodInExpectedLines( + CompilationUnit cu, String name, int expectedStartLine, int expectedEndLine) { + MethodDeclaration node = getFirstMethodDeclarationByName(cu, name); + assertNodeInExpectedLines(node, expectedStartLine, expectedEndLine); + } + + private void assertNodeInExpectedLines(Node node, int expectedStartLine, int expectedEndLine) { + Range range = node.getRange().get(); + + assertEquals(expectedStartLine, range.begin.line); + assertEquals(expectedEndLine, range.end.line); + } + + private MethodDeclaration getFirstMethodDeclarationByName(CompilationUnit cu, String name) { + return cu.findAll(MethodDeclaration.class).stream() + .filter(n -> name.equals(n.getNameAsString())) + .findFirst() + .get(); + } + + // @Test + // public void cuLength_minimal() throws IOException { + // CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_MINIMAL); + // + // final Range cuRange = cu.getRange().get(); + // + // int lineCount = cuRange.end.line - cuRange.begin.line; + // + // } + + // @Test + // public void commentPositions_minimal() throws IOException { + // CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_MINIMAL); + // + // List allComments = cu.getAllComments(); + // for (int i = 0; i < allComments.size(); i++) { + // Comment comment = allComments.get(i); + // Optional optionalRange = comment.getRange(); + // if (optionalRange.isPresent()) { + // Range range = optionalRange.get(); + // final TokenRange tokens = comment.getTokenRange().get(); + // int tokenIndex = 0; + // for (JavaToken token : tokens) { + // System.out.println("token " + tokenIndex + " = " + token); + // tokenIndex++; + // } + // System.out.println(tokens); + // } + // } + // + // + //// assertNodeInExpectedLines(cu, 1, 288); + // } + + @ParameterizedTest + @MethodSource("arguments_minimal") + public void method_minimal(String name, int expectedStart, int expectedEnd) throws IOException { + CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_MINIMAL); + assertMethodInExpectedLines(cu, name, expectedStart, expectedEnd); + } + + @ParameterizedTest + @MethodSource("arguments_original") + public void method_original(String name, int expectedStart, int expectedEnd) throws IOException { + CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_ORIGINAL); + assertMethodInExpectedLines(cu, name, expectedStart, expectedEnd); + } + + @ParameterizedTest + @MethodSource("arguments_original") + public void method_original_cr(String name, int expectedStart, int expectedEnd) throws IOException { + CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_CR); + assertMethodInExpectedLines(cu, name, expectedStart, expectedEnd); + } + + @ParameterizedTest + @MethodSource("arguments_original") + public void method_original_crlf(String name, int expectedStart, int expectedEnd) throws IOException { + CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_CRLF); + assertMethodInExpectedLines(cu, name, expectedStart, expectedEnd); + } + + @ParameterizedTest + @MethodSource("arguments_original") + public void method_original_lf(String name, int expectedStart, int expectedEnd) throws IOException { + CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_STRING_LF); + assertMethodInExpectedLines(cu, name, expectedStart, expectedEnd); + } + + @ParameterizedTest + @MethodSource("arguments_groovy_original") + public void method_groovy_original(String name, int expectedStart, int expectedEnd) throws IOException { + CompilationUnit cu = StaticJavaParser.parseResource(RESOURCE_PATH_GROOVY_ORIGINAL); + assertMethodInExpectedLines(cu, name, expectedStart, expectedEnd); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue3113Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue3113Test.java new file mode 100644 index 0000000..4757eed --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue3113Test.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.issues; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.stmt.SwitchStmt; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import org.junit.jupiter.api.Test; + +public class Issue3113Test extends AbstractLexicalPreservingTest { + @Test + public void issue3113() { + StaticJavaParser.getConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_12); + + String originalSourceCode = "public class HelloWorld {\n" + " public static void main(String[] args) {\n" + + " final int value = 2;\n" + + " String numericString;\n" + + " switch (value)\n" + + " {\n" + + " case 1 -> numericString = \"one\";\n" + + " default -> numericString = \"N/A\";\n" + + " }\n" + + " System.out.println(\"value:\" + value + \" as string: \" + numericString);\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = StaticJavaParser.parse(originalSourceCode); + LexicalPreservingPrinter.setup(cu); + SwitchStmt expr = cu.findFirst(SwitchStmt.class).get(); + String modifiedSourceCode = LexicalPreservingPrinter.print(expr); + assertEquals( + "switch (value)\n" + " {\n" + + " case 1 -> numericString = \"one\";\n" + + " default -> numericString = \"N/A\";\n" + + " }", + modifiedSourceCode); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue3255Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue3255Test.java new file mode 100644 index 0000000..9682bb8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/issues/Issue3255Test.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.issues; + +import static com.github.javaparser.utils.TestParser.parseStatement; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +public class Issue3255Test { + + private static final String EOL = LineSeparator.SYSTEM.asRawString(); + + @Test + public void test() { + JavaParser javaParser = new JavaParser(); + ParseResult parseResult = javaParser.parse("class Test {" + EOL + " private void bad() {" + + EOL + " String record = \"\";" + + EOL + " record.getBytes();" + + EOL + " }" + + EOL + "}"); + + assertEquals(0, parseResult.getProblems().size()); + + CompilationUnit compilationUnit = parseResult.getResult().get(); + } + + @Test + public void test2() { + JavaParser javaParser = new JavaParser(); + ParseResult parseResult = javaParser.parse("class Test {" + EOL + " private void bad() {" + + EOL + " String record2 = \"\";" + + EOL + " record2.getBytes();" + + EOL + " }" + + EOL + "}"); + + assertEquals(0, parseResult.getProblems().size()); + + CompilationUnit compilationUnit = parseResult.getResult().get(); + } + + @Test + void recordIsAValidVariableNameWhenParsingAStatement() { + parseStatement("Object record;"); + } + + @Test + public void recordIsAValidVariableNameWhenUsedInAClass() { + JavaParser javaParser = new JavaParser(); + ParseResult parseResult = + javaParser.parse("class Test {" + EOL + " private void goodInJava16() {" + + EOL + " Object record;" + + EOL + " }" + + EOL + "}"); + + assertEquals(0, parseResult.getProblems().size()); + + CompilationUnit compilationUnit = parseResult.getResult().get(); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/JavadocExtractorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/JavadocExtractorTest.java new file mode 100644 index 0000000..4f89c84 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/JavadocExtractorTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.javadoc; + +import static com.github.javaparser.StaticJavaParser.parse; + +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import java.io.File; +import java.io.FileNotFoundException; +import org.junit.jupiter.api.Test; + +class JavadocExtractorTest { + + @Test + void canParseAllJavadocsInJavaParser() throws FileNotFoundException { + processDir(new File("..")); + } + + private void processFile(File file) throws FileNotFoundException { + try { + CompilationUnit cu = parse(file); + new VoidVisitorAdapter() { + @Override + public void visit(JavadocComment n, Object arg) { + super.visit(n, arg); + n.parse(); + } + }.visit(cu, null); + } catch (ParseProblemException e) { + System.err.println("ERROR PROCESSING " + file); + } + } + + private void processDir(File dir) throws FileNotFoundException { + for (File child : dir.listFiles()) { + if (child.isFile() && child.getName().endsWith(".java")) { + processFile(child); + } else if (child.isDirectory()) { + processDir(child); + } + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/JavadocTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/JavadocTest.java new file mode 100644 index 0000000..9c9f926 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/JavadocTest.java @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.javadoc; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseJavadoc; +import static com.github.javaparser.javadoc.description.JavadocInlineTag.Type.*; +import static java.util.stream.Collectors.toList; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.javadoc.description.JavadocDescription; +import com.github.javaparser.javadoc.description.JavadocDescriptionElement; +import com.github.javaparser.javadoc.description.JavadocInlineTag; +import com.github.javaparser.javadoc.description.JavadocSnippet; +import com.github.javaparser.utils.LineSeparator; +import java.util.List; +import org.junit.jupiter.api.Test; + +class JavadocTest { + + @Test + void toTextForEmptyJavadoc() { + Javadoc javadoc = new Javadoc(new JavadocDescription()); + assertEquals("", javadoc.toText()); + } + + @Test + void toTextForJavadocWithTwoLinesOfJustDescription() { + Javadoc javadoc = + new Javadoc(JavadocDescription.parseText("first line" + LineSeparator.SYSTEM + "second line")); + assertEquals("first line" + LineSeparator.SYSTEM + "second line" + LineSeparator.SYSTEM, javadoc.toText()); + } + + @Test + void toTextForJavadocWithTwoLinesOfJustDescriptionAndOneBlockTag() { + Javadoc javadoc = + new Javadoc(JavadocDescription.parseText("first line" + LineSeparator.SYSTEM + "second line")); + javadoc.addBlockTag("foo", "something useful"); + assertEquals( + "first line" + LineSeparator.SYSTEM + "second line" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + "@foo something useful" + LineSeparator.SYSTEM, + javadoc.toText()); + } + + @Test + void toCommentForEmptyJavadoc() { + Javadoc javadoc = new Javadoc(new JavadocDescription()); + assertEquals(new JavadocComment("" + LineSeparator.SYSTEM + "\t\t "), javadoc.toComment("\t\t")); + } + + @Test + void toCommentorJavadocWithTwoLinesOfJustDescription() { + Javadoc javadoc = + new Javadoc(JavadocDescription.parseText("first line" + LineSeparator.SYSTEM + "second line")); + assertEquals( + new JavadocComment("" + LineSeparator.SYSTEM + "\t\t * first line" + LineSeparator.SYSTEM + + "\t\t * second line" + LineSeparator.SYSTEM + "\t\t "), + javadoc.toComment("\t\t")); + } + + @Test + void toCommentForJavadocWithTwoLinesOfJustDescriptionAndOneBlockTag() { + Javadoc javadoc = + new Javadoc(JavadocDescription.parseText("first line" + LineSeparator.SYSTEM + "second line")); + javadoc.addBlockTag("foo", "something useful"); + assertEquals( + new JavadocComment("" + LineSeparator.SYSTEM + "\t\t * first line" + LineSeparator.SYSTEM + + "\t\t * second line" + LineSeparator.SYSTEM + "\t\t * " + LineSeparator.SYSTEM + + "\t\t * @foo something useful" + LineSeparator.SYSTEM + "\t\t "), + javadoc.toComment("\t\t")); + } + + @Test + void descriptionAndBlockTagsAreRetrievable() { + Javadoc javadoc = parseJavadoc("first line" + LineSeparator.SYSTEM + "second line" + LineSeparator.SYSTEM + + LineSeparator.SYSTEM + "@param node a node" + LineSeparator.SYSTEM + "@return result the result"); + assertEquals( + "first line" + LineSeparator.SYSTEM + "second line", + javadoc.getDescription().toText()); + assertEquals(2, javadoc.getBlockTags().size()); + } + + @Test + void inlineTagsAreParsable() { + String docText = "Returns the {@link TOFilename}s of all files that existed during the requested" + + LineSeparator.SYSTEM + "{@link TOVersion}. Set {@systemProperty JAVA_HOME} correctly." + + LineSeparator.SYSTEM + "" + + LineSeparator.SYSTEM + "@param versionID the id of the {@link TOVersion}." + + LineSeparator.SYSTEM + "@return the filenames" + + LineSeparator.SYSTEM + + "@throws InvalidIDException if the {@link IPersistence} doesn't recognize the given versionID." + + LineSeparator.SYSTEM; + Javadoc javadoc = parseJavadoc(docText); + + List inlineTags = javadoc.getDescription().getElements().stream() + .filter(element -> element instanceof JavadocInlineTag) + .map(element -> (JavadocInlineTag) element) + .collect(toList()); + + assertEquals("link", inlineTags.get(0).getName()); + assertEquals(" TOFilename", inlineTags.get(0).getContent()); + assertEquals(LINK, inlineTags.get(0).getType()); + assertEquals("link", inlineTags.get(1).getName()); + assertEquals(" TOVersion", inlineTags.get(1).getContent()); + assertEquals(LINK, inlineTags.get(1).getType()); + assertEquals("systemProperty", inlineTags.get(2).getName()); + assertEquals(" JAVA_HOME", inlineTags.get(2).getContent()); + assertEquals(SYSTEM_PROPERTY, inlineTags.get(2).getType()); + + String javadocText = javadoc.toText(); + assertTrue(javadocText.contains("{@link TOVersion}")); + } + + @Test + void emptyLinesBetweenBlockTagsGetsFiltered() { + String comment = " * The type of the Object to be mapped." + LineSeparator.SYSTEM + + " * This interface maps the given Objects to existing ones in the database and" + + LineSeparator.SYSTEM + " * saves them." + + LineSeparator.SYSTEM + " * " + + LineSeparator.SYSTEM + " * @author censored" + + LineSeparator.SYSTEM + " * " + + LineSeparator.SYSTEM + " * @param " + + LineSeparator.SYSTEM; + Javadoc javadoc = parseJavadoc(comment); + assertEquals(2, javadoc.getBlockTags().size()); + } + + @Test + void blockTagModificationWorks() { + Javadoc javadoc = new Javadoc(new JavadocDescription()); + + assertEquals(0, javadoc.getBlockTags().size()); + JavadocBlockTag blockTag = new JavadocBlockTag(JavadocBlockTag.Type.RETURN, "a value"); + javadoc.addBlockTag(blockTag); + + assertEquals(1, javadoc.getBlockTags().size()); + assertEquals(blockTag, javadoc.getBlockTags().get(0)); + + assertEquals(blockTag, javadoc.getBlockTags().remove(0)); + assertEquals(0, javadoc.getBlockTags().size()); + } + + @Test + void descriptionModificationWorks() { + JavadocDescription description = new JavadocDescription(); + + assertEquals(0, description.getElements().size()); + + JavadocDescriptionElement inlineTag = new JavadocInlineTag("inheritDoc", INHERIT_DOC, ""); + assertTrue(description.addElement(inlineTag)); + + assertEquals(1, description.getElements().size()); + assertEquals(inlineTag, description.getElements().get(0)); + + assertEquals(inlineTag, description.getElements().remove(0)); + assertEquals(0, description.getElements().size()); + } + + @Test + void issue1533() { + CompilationUnit compilationUnit = + parse("/** hallo {@link Foo} welt */ public interface Foo extends Comparable { }"); + List elements = + compilationUnit.getType(0).getJavadoc().get().getDescription().getElements(); + assertEquals(3, elements.size()); + assertEquals(new JavadocSnippet("hallo "), elements.get(0)); + assertEquals(new JavadocInlineTag("link", LINK, " Foo"), elements.get(1)); + assertEquals(new JavadocSnippet(" welt"), elements.get(2)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/description/JavadocInlineTagTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/description/JavadocInlineTagTest.java new file mode 100644 index 0000000..b7d62a0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/javadoc/description/JavadocInlineTagTest.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.javadoc.description; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class JavadocInlineTagTest { + + @Test + void javadocInlineTagShouldPersistCustomTagNames() { + String tag = JavadocInlineTag.fromText("{@foo something}").toText(); + + assertEquals(tag, "{@foo something}"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/manual/BulkParseTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/manual/BulkParseTest.java new file mode 100644 index 0000000..b313d47 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/manual/BulkParseTest.java @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.manual; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.*; +import static com.github.javaparser.utils.CodeGenerationUtils.f; +import static com.github.javaparser.utils.CodeGenerationUtils.mavenModuleRoot; +import static com.github.javaparser.utils.SourceRoot.Callback.Result.DONT_SAVE; +import static com.github.javaparser.utils.TestUtils.download; +import static com.github.javaparser.utils.TestUtils.temporaryDirectory; +import static java.util.Comparator.comparing; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.Problem; +import com.github.javaparser.utils.Log; +import com.github.javaparser.utils.SourceRoot; +import com.github.javaparser.utils.SourceZip; +import java.io.BufferedWriter; +import java.io.IOException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class BulkParseTest { + /** + * Running this will download a version of the OpenJDK, unzip it, and parse it. If it throws a stack overflow + * exception, increase the JVM's stack size. + */ + public static void main(String[] args) throws IOException { + Log.setAdapter(new Log.StandardOutStandardErrorAdapter()); + // This contains all kinds of test cases so it will lead to a lot of errors: + new BulkParseTest().parseOpenJdkLangToolsRepository(); + // This contains the JDK source code, so it should have zero errors: + new BulkParseTest().parseJdkSrcZip(); + } + + private void parseOpenJdkLangToolsRepository() throws IOException { + Path workdir = mavenModuleRoot(BulkParseTest.class) + .resolve(Paths.get(temporaryDirectory(), "javaparser_bulkparsetest")); + workdir.toFile().mkdirs(); + Path openJdkZipPath = workdir.resolve("langtools.zip"); + if (Files.notExists(openJdkZipPath)) { + Log.info("Downloading JDK langtools"); + /* Found by choosing a tag here: http://hg.openjdk.java.net/jdk9/jdk9/langtools/tags + then copying the "zip" link to the line below: */ + download( + new URL("http://hg.openjdk.java.net/jdk10/jdk10/langtools/archive/19293ea3999f.zip"), + openJdkZipPath); + } + bulkTest( + new SourceZip(openJdkZipPath), + "openjdk_src_repo_test_results.txt", + new ParserConfiguration().setLanguageLevel(JAVA_10)); + } + + private void parseJdkSrcZip() throws IOException { + // This is where Ubuntu stores the contents of package openjdk-8-src + Path path = Paths.get("/usr/lib/jvm/openjdk-9/src.zip"); + bulkTest( + new SourceZip(path), + "openjdk_src_zip_test_results.txt", + new ParserConfiguration().setLanguageLevel(JAVA_9)); + } + + @BeforeEach + void startLogging() { + Log.setAdapter(new Log.StandardOutStandardErrorAdapter()); + } + + @AfterEach + void stopLogging() { + Log.setAdapter(new Log.SilentAdapter()); + } + + @Test + void parseOwnSourceCode() throws IOException { + String[] roots = new String[] { + "javaparser-core/src/main/java", + "javaparser-core-testing/src/test/java", + "javaparser-core-generators/src/main/java", + "javaparser-core-metamodel-generator/src/main/java", + "javaparser-symbol-solver-core/src/main/java", + "javaparser-symbol-solver-testing/src/test/java" + }; + for (String root : roots) { + bulkTest( + new SourceRoot( + mavenModuleRoot(BulkParseTest.class).resolve("..").resolve(root)), + "javaparser_test_results_" + root.replace("-", "_").replace("/", "_") + ".txt", + new ParserConfiguration().setLanguageLevel(BLEEDING_EDGE)); + } + } + + public void bulkTest(SourceRoot sourceRoot, String testResultsFileName, ParserConfiguration configuration) + throws IOException { + sourceRoot.setParserConfiguration(configuration); + TreeMap> results = + new TreeMap<>(comparing(o -> o.toString().toLowerCase())); + sourceRoot.parseParallelized((localPath, absolutePath, result) -> { + if (!localPath.toString().contains("target")) { + if (!result.isSuccessful()) { + results.put(localPath, result.getProblems()); + } + } + return DONT_SAVE; + }); + writeResults(results, testResultsFileName); + } + + public void bulkTest(SourceZip sourceRoot, String testResultsFileName, ParserConfiguration configuration) + throws IOException { + sourceRoot.setParserConfiguration(configuration); + TreeMap> results = + new TreeMap<>(comparing(o -> o.toString().toLowerCase())); + sourceRoot.parse((path, result) -> { + if (!path.toString().contains("target")) { + if (!result.isSuccessful()) { + results.put(path, result.getProblems()); + } + } + }); + writeResults(results, testResultsFileName); + } + + private void writeResults(TreeMap> results, String testResultsFileName) throws IOException { + Log.info("Writing results..."); + + Path testResults = mavenModuleRoot(BulkParseTest.class) + .resolve(Paths.get( + "..", + "javaparser-core-testing", + "src", + "test", + "resources", + "com", + "github", + "javaparser", + "bulk_test_results")) + .normalize(); + testResults.toFile().mkdirs(); + testResults = testResults.resolve(testResultsFileName); + + int problemTotal = 0; + try (BufferedWriter writer = Files.newBufferedWriter(testResults)) { + for (Map.Entry> file : results.entrySet()) { + writer.write(file.getKey().toString().replace("\\", "/")); + writer.newLine(); + for (Problem problem : file.getValue()) { + writer.write(problem.getVerboseMessage()); + writer.newLine(); + problemTotal++; + } + writer.newLine(); + } + writer.write(f("%s problems in %s files", problemTotal, results.size())); + } + + Path finalTestResults = testResults; + Log.info("Results are in %s", () -> finalTestResults); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/metamodel/BaseNodeMetaModelTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/metamodel/BaseNodeMetaModelTest.java new file mode 100644 index 0000000..6a0de9c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/metamodel/BaseNodeMetaModelTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.metamodel; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.expr.StringLiteralExpr; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class TestMetaModel extends BaseNodeMetaModel { + + public TestMetaModel() { + super(Optional.empty(), StringLiteralExpr.class, "stri", "com.japa", true, true); + } +} + +class BaseNodeMetaModelTest { + @Test + void testGetters() { + TestMetaModel test = new TestMetaModel(); + + assertEquals("testMetaModel", test.getMetaModelFieldName()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/metamodel/PropertyMetaModelTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/metamodel/PropertyMetaModelTest.java new file mode 100644 index 0000000..51ad105 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/metamodel/PropertyMetaModelTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.metamodel; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.body.BodyDeclaration; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class PropertyMetaModelTest { + @Test + void whenPropertyIsVerySimpleThenTypeInfoIsCorrect() { + PropertyMetaModel bert = + new PropertyMetaModel(null, "bert", int.class, Optional.empty(), false, false, false, false); + assertEquals("int", bert.getTypeName()); + assertEquals("int", bert.getTypeNameGenerified()); + assertEquals("int", bert.getTypeNameForGetter()); + assertEquals("int", bert.getTypeNameForSetter()); + } + + @Test + void whenPropertyIsVeryComplexThenTypeInfoIsCorrect() { + PropertyMetaModel bert = + new PropertyMetaModel(null, "bert", BodyDeclaration.class, Optional.empty(), true, false, true, true); + assertEquals("BodyDeclaration", bert.getTypeName()); + assertEquals("BodyDeclaration", bert.getTypeNameGenerified()); + assertEquals("Optional>>", bert.getTypeNameForGetter()); + assertEquals("NodeList>", bert.getTypeNameForSetter()); + } + + @Test + void whenPropertyIsANodeListThenTypeInfoIsCorrect() { + PropertyMetaModel bert = + new PropertyMetaModel(null, "bert", Modifier.class, Optional.empty(), false, false, true, false); + assertEquals("Modifier", bert.getTypeName()); + assertEquals("Modifier", bert.getTypeNameGenerified()); + assertEquals("NodeList", bert.getTypeNameForGetter()); + assertEquals("NodeList", bert.getTypeNameForSetter()); + } + + @Test + void metaModelFieldName() { + PropertyMetaModel bert = + new PropertyMetaModel(null, "bert", Modifier.class, Optional.empty(), false, false, false, false); + assertEquals("bertPropertyMetaModel", bert.getMetaModelFieldName()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/modules/ModuleDeclarationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/modules/ModuleDeclarationTest.java new file mode 100644 index 0000000..968268e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/modules/ModuleDeclarationTest.java @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.modules; + +import static com.github.javaparser.GeneratedJavaParserConstants.IDENTIFIER; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_9; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.StaticJavaParser.parseName; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.*; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.MarkerAnnotationExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.printer.ConcreteSyntaxModel; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ModuleDeclarationTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_9)); + + private CompilationUnit parse(String code) { + ParseResult result = javaParser.parse(ParseStart.COMPILATION_UNIT, provider(code)); + if (!result.isSuccessful()) { + System.err.println(result); + } + return result.getResult().get(); + } + + @Test + void moduleInfoKeywordsAreSeenAsIdentifiers() { + CompilationUnit cu = parse("class module { }"); + JavaToken moduleToken = cu.getClassByName("module") + .get() + .getName() + .getTokenRange() + .get() + .getBegin(); + assertEquals(IDENTIFIER, moduleToken.getKind()); + } + + @Test + void issue988RequireTransitiveShouldRequireAModuleCalledTransitive() { + CompilationUnit cu = parse("module X { requires transitive; }"); + ModuleRequiresDirective requiresTransitive = + (ModuleRequiresDirective) cu.getModule().get().getDirectives().get(0); + assertEquals("transitive", requiresTransitive.getNameAsString()); + assertEquals( + IDENTIFIER, + requiresTransitive.getName().getTokenRange().get().getBegin().getKind()); + } + + @Test + void jlsExample1() { + CompilationUnit cu = parse("@Foo(1) @Foo(2) @Bar " + "module M.N {" + + " requires A.B;" + + " requires transitive C.D;" + + " requires static E.F;" + + " requires transitive static G.H;" + + "" + + " exports P.Q;" + + " exports R.S to T1.U1, T2.U2;" + + "" + + " opens P.Q;" + + " opens R.S to T1.U1, T2.U2;" + + "" + + " uses V.W;" + + " provides X.Y with Z1.Z2, Z3.Z4;" + + "}"); + + ModuleDeclaration module = cu.getModule().get(); + assertEquals("M.N", module.getNameAsString()); + assertFalse(module.isOpen()); + assertThat(module.getAnnotations()) + .containsExactly( + new SingleMemberAnnotationExpr(new Name("Foo"), new IntegerLiteralExpr("1")), + new SingleMemberAnnotationExpr(new Name("Foo"), new IntegerLiteralExpr("2")), + new MarkerAnnotationExpr(new Name("Bar"))); + + ModuleRequiresDirective moduleRequiresStmt = + module.getDirectives().get(0).asModuleRequiresStmt(); + assertThat(moduleRequiresStmt.getNameAsString()).isEqualTo("A.B"); + assertThat(moduleRequiresStmt.getModifiers()).isEmpty(); + + ModuleExportsDirective moduleExportsStmt = module.getDirectives().get(5).asModuleExportsStmt(); + assertThat(moduleExportsStmt.getNameAsString()).isEqualTo("R.S"); + assertThat(moduleExportsStmt.getModuleNames()).containsExactly(parseName("T1.U1"), parseName("T2.U2")); + + ModuleOpensDirective moduleOpensStmt = module.getDirectives().get(7).asModuleOpensStmt(); + assertThat(moduleOpensStmt.getNameAsString()).isEqualTo("R.S"); + assertThat(moduleOpensStmt.getModuleNames()).containsExactly(parseName("T1.U1"), parseName("T2.U2")); + + ModuleUsesDirective moduleUsesStmt = module.getDirectives().get(8).asModuleUsesStmt(); + assertThat(moduleUsesStmt.getNameAsString()).isEqualTo("V.W"); + + ModuleProvidesDirective moduleProvidesStmt = + module.getDirectives().get(9).asModuleProvidesStmt(); + assertThat(moduleProvidesStmt.getNameAsString()).isEqualTo("X.Y"); + assertThat(moduleProvidesStmt.getWith()).containsExactly(parseName("Z1.Z2"), parseName("Z3.Z4")); + } + + @Test + void jlsExample2HasAnOpenModule() { + CompilationUnit cu = parse("open module M.N {}"); + + ModuleDeclaration module = cu.getModule().get(); + assertEquals("M.N", module.getNameAsString()); + assertTrue(module.isOpen()); + } + + @Test + void testPrettyPrinting() { + CompilationUnit cu = parse("@Foo(1) @Foo(2) @Bar " + "module M.N {" + + " requires A.B;" + + " requires transitive C.D;" + + " requires static E.F;" + + " requires static transitive G.H;" + + "" + + " exports P.Q;" + + " exports R.S to T1.U1, T2.U2;" + + "" + + " opens P.Q;" + + " opens R.S to T1.U1, T2.U2;" + + "" + + " uses V.W;" + + " provides X.Y with Z1.Z2, Z3.Z4;" + + "}"); + + assertEquals( + "@Foo(1)" + LineSeparator.SYSTEM + "@Foo(2)" + + LineSeparator.SYSTEM + "@Bar" + + LineSeparator.SYSTEM + "module M.N {" + + LineSeparator.SYSTEM + " requires A.B;" + + LineSeparator.SYSTEM + " requires transitive C.D;" + + LineSeparator.SYSTEM + " requires static E.F;" + + LineSeparator.SYSTEM + " requires static transitive G.H;" + + LineSeparator.SYSTEM + " exports P.Q;" + + LineSeparator.SYSTEM + " exports R.S to T1.U1, T2.U2;" + + LineSeparator.SYSTEM + " opens P.Q;" + + LineSeparator.SYSTEM + " opens R.S to T1.U1, T2.U2;" + + LineSeparator.SYSTEM + " uses V.W;" + + LineSeparator.SYSTEM + " provides X.Y with Z1.Z2, Z3.Z4;" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM, + cu.toString()); + } + + @Test + void testCsmPrinting() { + CompilationUnit cu = parse("@Foo(1) @Foo(2) @Bar " + "open module M.N {" + + " requires A.B;" + + " requires transitive C.D;" + + " requires static E.F;" + + " requires transitive static G.H;" + + "" + + " exports P.Q;" + + " exports R.S to T1.U1, T2.U2;" + + "" + + " opens P.Q;" + + " opens R.S to T1.U1, T2.U2;" + + "" + + " uses V.W;" + + " provides X.Y with Z1.Z2, Z3.Z4;" + + "}"); + + assertEquals( + "@Foo(1)" + LineSeparator.SYSTEM + "@Foo(2)" + + LineSeparator.SYSTEM + "@Bar" + + LineSeparator.SYSTEM + "open module M.N {" + + LineSeparator.SYSTEM + " requires A.B;" + + LineSeparator.SYSTEM + " requires transitive C.D;" + + LineSeparator.SYSTEM + " requires static E.F;" + + LineSeparator.SYSTEM + " requires transitive static G.H;" + + LineSeparator.SYSTEM + " exports P.Q;" + + LineSeparator.SYSTEM + " exports R.S to T1.U1, T2.U2;" + + LineSeparator.SYSTEM + " opens P.Q;" + + LineSeparator.SYSTEM + " opens R.S to T1.U1, T2.U2;" + + LineSeparator.SYSTEM + " uses V.W;" + + LineSeparator.SYSTEM + " provides X.Y with Z1.Z2, Z3.Z4;" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM, + ConcreteSyntaxModel.genericPrettyPrint(cu)); + } + + @Test + void fluentInterface() { + ModuleDeclaration moduleDeclaration = new CompilationUnit() + .setModule("com.laamella.base") + .addSingleMemberAnnotation(SuppressWarnings.class, "\"module\"") + .addDirective("requires transitive java.desktop;") + .addDirective("exports com.laamella.base.entity.channel;") + .addDirective("exports com.laamella.base.entity.channel.internal to com.laamella.core;") + .addDirective("uses com.laamella.base.util.internal.FactoryDelegate;"); + + moduleDeclaration + .getDirectives() + .addLast(new ModuleExportsDirective() + .setName("foo.bar") + .addModuleName("other.foo") + .addModuleName("other.bar")); + + moduleDeclaration.addDirective(new ModuleExportsDirective() + .setName("foo.bar.x") + .addModuleName("other.foo") + .addModuleName("other.bar")); + + assertEqualsStringIgnoringEol( + "@SuppressWarnings(\"module\")\n" + "module com.laamella.base {\n" + + " requires transitive java.desktop;\n" + + " exports com.laamella.base.entity.channel;\n" + + " exports com.laamella.base.entity.channel.internal to com.laamella.core;\n" + + " uses com.laamella.base.util.internal.FactoryDelegate;\n" + + " exports foo.bar to other.foo, other.bar;\n" + + " exports foo.bar.x to other.foo, other.bar;\n" + + "}\n", + moduleDeclaration.toString()); + } + + @Test + void testModifierRequire() { + ModuleDeclaration moduleDeclaration = + new CompilationUnit().setModule("com.laamella.base").addDirective("requires transitive java.desktop;"); + ModuleRequiresDirective moduleRequiresStmt = + moduleDeclaration.getDirectives().get(0).asModuleRequiresStmt(); + assertTrue(moduleRequiresStmt.isTransitive()); + } + + @Test + void testModifierStatic() { + ModuleDeclaration moduleDeclaration = + new CompilationUnit().setModule("com.laamella.base").addDirective("requires static java.desktop;"); + ModuleRequiresDirective moduleRequiresStmt = + moduleDeclaration.getDirectives().get(0).asModuleRequiresStmt(); + assertTrue(moduleRequiresStmt.isStatic()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/ConcreteSyntaxModelAcceptanceTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/ConcreteSyntaxModelAcceptanceTest.java new file mode 100644 index 0000000..2a11955 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/ConcreteSyntaxModelAcceptanceTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.StaticJavaParser.parse; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.utils.CodeGenerationUtils; +import com.github.javaparser.utils.TestUtils; +import java.io.IOException; +import java.nio.file.Path; +import org.junit.jupiter.api.Test; + +class ConcreteSyntaxModelAcceptanceTest { + private final Path rootDir = CodeGenerationUtils.mavenModuleRoot(ConcreteSyntaxModelAcceptanceTest.class) + .resolve("src/test/test_sourcecode"); + + private String prettyPrint(Node node) { + return ConcreteSyntaxModel.genericPrettyPrint(node); + } + + private String prettyPrintedExpectation(String name) throws IOException { + return TestUtils.readResource("com/github/javaparser/printer/" + name + "_prettyprinted"); + } + + @Test + void printingExamplePrettyPrintVisitor() throws IOException { + CompilationUnit cu = parse(rootDir.resolve("com/github/javaparser/printer/PrettyPrintVisitor.java")); + TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("PrettyPrintVisitor"), prettyPrint(cu)); + } + + @Test + void printingExampleJavaConcepts() throws IOException { + CompilationUnit base = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsBase.java")); + CompilationUnit enums = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsEnums.java")); + CompilationUnit innerClass = + parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsInnerClasses.java")); + CompilationUnit methods = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsMethods.java")); + CompilationUnit ugly = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsUgly.java")); + TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsBase"), prettyPrint(base)); + TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsEnums"), prettyPrint(enums)); + TestUtils.assertEqualsStringIgnoringEol( + prettyPrintedExpectation("JavaConceptsInnerClasses"), prettyPrint(innerClass)); + TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsMethods"), prettyPrint(methods)); + TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsUgly"), prettyPrint(ugly)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/ConcreteSyntaxModelTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/ConcreteSyntaxModelTest.java new file mode 100644 index 0000000..9dc851c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/ConcreteSyntaxModelTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.StaticJavaParser.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.expr.ClassExpr; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +class ConcreteSyntaxModelTest { + + private String print(Node node) { + return ConcreteSyntaxModel.genericPrettyPrint(node); + } + + @Test + void printSimpleClassExpr() { + ClassExpr expr = parseExpression("Foo.class"); + assertEquals("Foo.class", print(expr)); + } + + @Test + void printArrayClassExpr() { + ClassExpr expr = parseExpression("Foo[].class"); + assertEquals("Foo[].class", print(expr)); + } + + @Test + void printGenericClassExpr() { + ClassExpr expr = parseExpression("Foo.class"); + assertEquals("Foo.class", print(expr)); + } + + @Test + void printSimplestClass() { + Node node = parse("class A {}"); + assertEquals("class A {" + LineSeparator.SYSTEM + "}" + LineSeparator.SYSTEM, print(node)); + } + + @Test + void printAClassWithField() { + Node node = parse("class A { int a; }"); + assertEquals( + "class A {" + LineSeparator.SYSTEM + + LineSeparator.SYSTEM + " int a;" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM, + print(node)); + } + + @Test + void printParameters() { + Node node = parseBodyDeclaration("int x(int y, int z) {}"); + assertEquals("int x(int y, int z) {" + LineSeparator.SYSTEM + "}", print(node)); + } + + @Test + void printReceiverParameter() { + Node node = parseBodyDeclaration("int x(X A.B.this, int y, int z) {}"); + assertEquals("int x(X A.B.this, int y, int z) {" + LineSeparator.SYSTEM + "}", print(node)); + } + + @Test + void printAnEmptyInterface() { + Node node = parse("interface A {}"); + assertEquals("interface A {" + LineSeparator.SYSTEM + "}" + LineSeparator.SYSTEM, print(node)); + } + + @Test + void printAnEmptyInterfaceWithModifier() { + Node node = parse("public interface A {}"); + assertEquals("public interface A {" + LineSeparator.SYSTEM + "}" + LineSeparator.SYSTEM, print(node)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/DefaultPrettyPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/DefaultPrettyPrinterTest.java new file mode 100644 index 0000000..530b90a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/DefaultPrettyPrinterTest.java @@ -0,0 +1,730 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_9; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.*; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.TypeDeclaration; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.Indentation; +import com.github.javaparser.printer.configuration.Indentation.IndentType; +import com.github.javaparser.printer.configuration.PrinterConfiguration; +import com.github.javaparser.printer.configuration.imports.EclipseImportOrderingStrategy; +import com.github.javaparser.printer.configuration.imports.IntelliJImportOrderingStrategy; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +class DefaultPrettyPrinterTest { + + private final JavaParser javaParser = new JavaParser(); + + private final JavaParserAdapter parserAdapter = JavaParserAdapter.of(javaParser); + + private final PrinterConfiguration printerConfiguration = new DefaultPrinterConfiguration(); + + private Printer getDefaultPrinter() { + PrinterConfiguration configuration = new DefaultPrinterConfiguration(); + return new DefaultPrettyPrinter(configuration); + } + + private Printer getDefaultPrinter(PrinterConfiguration configuration) { + return new DefaultPrettyPrinter(configuration); + } + + private String prettyPrintField(String code) { + CompilationUnit cu = parse(code); + return getDefaultPrinter().print(cu.findFirst(FieldDeclaration.class).get()); + } + + private String prettyPrintVar(String code) { + CompilationUnit cu = parse(code); + return getDefaultPrinter() + .print(cu.findAll(VariableDeclarationExpr.class).get(0)); + } + + @Test + void printingArrayFields() { + String code; + code = "class A { int a, b[]; }"; + assertEquals("int a, b[];", prettyPrintField(code)); + + code = "class A { int[] a[], b[]; }"; + assertEquals("int[][] a, b;", prettyPrintField(code)); + + code = "class A { int[] a[][], b; }"; + assertEquals("int[] a[][], b;", prettyPrintField(code)); + + code = "class A { int[] a, b; }"; + assertEquals("int[] a, b;", prettyPrintField(code)); + + code = "class A { int a[], b[]; }"; + assertEquals("int[] a, b;", prettyPrintField(code)); + } + + @Test + void printingArrayVariables() { + String code; + code = "class A { void foo(){ int a, b[]; }}"; + assertEquals("int a, b[]", prettyPrintVar(code)); + + code = "class A { void foo(){ int[] a[], b[]; }}"; + assertEquals("int[][] a, b", prettyPrintVar(code)); + + code = "class A { void foo(){ int[] a[][], b; }}"; + assertEquals("int[] a[][], b", prettyPrintVar(code)); + + code = "class A { void foo(){ int[] a, b; }}"; + assertEquals("int[] a, b", prettyPrintVar(code)); + + code = "class A { void foo(){ int a[], b[]; }}"; + assertEquals("int[] a, b", prettyPrintVar(code)); + } + + @Disabled + private String prettyPrintConfigurable(String code) { + CompilationUnit cu = parse(code); + return getDefaultPrinter() + .print(cu.findFirst(ClassOrInterfaceDeclaration.class).get().getName()); + } + + @Test + void printUseTestVisitor() { + String code; + code = "class A { void foo(){ int a, b[]; }}"; + assertEquals("A", prettyPrintConfigurable(code)); + } + + @Test + void prettyColumnAlignParameters_enabled() { + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)); + + final String EOL = configuration + .get(new DefaultConfigurationOption(ConfigOption.END_OF_LINE_CHARACTER)) + .get() + .asString(); + + String code = "class Example { void foo(Object arg0,Object arg1){ myMethod(1, 2, 3, 5, Object.class); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo(Object arg0, Object arg1) {" + + EOL + " myMethod(1," + + EOL + " 2," + + EOL + " 3," + + EOL + " 5," + + EOL + " Object.class);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + assertEquals(expected, getDefaultPrinter(configuration).print(parse(code))); + } + + @Test + void prettyColumnAlignParameters_disabled() { + + PrinterConfiguration configuration = new DefaultPrinterConfiguration(); + final String EOL = configuration + .get(new DefaultConfigurationOption(ConfigOption.END_OF_LINE_CHARACTER)) + .get() + .asString(); + + String code = "class Example { void foo(Object arg0,Object arg1){ myMethod(1, 2, 3, 5, Object.class); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo(Object arg0, Object arg1) {" + + EOL + " myMethod(1, 2, 3, 5, Object.class);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + assertEquals(expected, getDefaultPrinter(configuration).print(parse(code))); + } + + @Test + void prettyAlignMethodCallChains_enabled() { + + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)); + + final String EOL = configuration + .get(new DefaultConfigurationOption(ConfigOption.END_OF_LINE_CHARACTER)) + .get() + .asString(); + + String code = + "class Example { void foo() { IntStream.range(0, 10).filter(x -> x % 2 == 0).map(x -> x * IntStream.of(1,3,5,1).sum()).forEach(System.out::println); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo() {" + + EOL + " IntStream.range(0, 10)" + + EOL + " .filter(x -> x % 2 == 0)" + + EOL + " .map(x -> x * IntStream.of(1, 3, 5, 1)" + + EOL + " .sum())" + + EOL + " .forEach(System.out::println);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + String printed = getDefaultPrinter(configuration).print(parse(code)); + + assertEquals(expected, printed); + } + + @Test + void prettyAlignMethodCallChains_disabled() { + + PrinterConfiguration configuration = new DefaultPrinterConfiguration(); + final String EOL = configuration + .get(new DefaultConfigurationOption(ConfigOption.END_OF_LINE_CHARACTER)) + .get() + .asString(); + + String code = + "class Example { void foo() { IntStream.range(0, 10).filter(x -> x % 2 == 0).map(x -> x * IntStream.of(1,3,5,1).sum()).forEach(System.out::println); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo() {" + + EOL + + " IntStream.range(0, 10).filter(x -> x % 2 == 0).map(x -> x * IntStream.of(1, 3, 5, 1).sum()).forEach(System.out::println);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + assertEquals(expected, getDefaultPrinter(configuration).print(parse(code))); + } + + @Test + void enumConstantsHorizontally() { + CompilationUnit cu = parse("enum X{A, B, C, D, E}"); + assertEqualsStringIgnoringEol("enum X {\n\n A, B, C, D, E\n}\n", new DefaultPrettyPrinter().print(cu)); + } + + @Test + void enumConstantsVertically() { + CompilationUnit cu = parse("enum X{A, B, C, D, E, F}"); + assertEqualsStringIgnoringEol( + "enum X {\n\n A,\n B,\n C,\n D,\n E,\n F\n}\n", new DefaultPrettyPrinter().print(cu)); + } + + @Test + void printingInconsistentVariables() { + FieldDeclaration fieldDeclaration = parseBodyDeclaration("int a, b;").asFieldDeclaration(); + + assertEquals("int a, b;", fieldDeclaration.toString()); + + fieldDeclaration.getVariable(0).setType(PrimitiveType.doubleType()); + + assertEquals("??? a, b;", fieldDeclaration.toString()); + + fieldDeclaration.getVariable(1).setType(PrimitiveType.doubleType()); + + assertEquals("double a, b;", fieldDeclaration.toString()); + } + + @Test + void prettyAlignMethodCallChainsIndentsArgumentsWithBlocksCorrectly() { + + CompilationUnit cu = parse( + "class Foo { void bar() { a.b.c.d.e; a.b.c().d().e(); a.b.c().d.e(); foo().bar().baz(boo().baa().bee()).bam(); foo().bar().baz(boo().baa().bee()).bam; foo().bar(Long.foo().b.bar(), bam).baz(); foo().bar().baz(foo, () -> { boo().baa().bee(); }).baz(() -> { boo().baa().bee(); }).bam(() -> { boo().baa().bee(); }); } }"); + + Indentation indentation = new Indentation(IndentType.TABS_WITH_SPACE_ALIGN, 1); + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)) + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, indentation)); + String printed = getDefaultPrinter(configuration).print(cu); + + assertEqualsStringIgnoringEol( + "class Foo {\n" + "\n" + + "\tvoid bar() {\n" + + "\t\ta.b.c.d.e;\n" + + "\t\ta.b.c()\n" + + "\t\t .d()\n" + + "\t\t .e();\n" + + "\t\ta.b.c().d\n" + + "\t\t .e();\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(boo().baa().bee())\n" + + "\t\t .bam();\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(boo().baa().bee()).bam;\n" + + "\t\tfoo().bar(Long.foo().b.bar(),\n" + + "\t\t bam)\n" + + "\t\t .baz();\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(foo,\n" + + "\t\t () -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee();\n" + + "\t\t })\n" + + "\t\t .baz(() -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee();\n" + + "\t\t })\n" + + "\t\t .bam(() -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee();\n" + + "\t\t });\n" + + "\t}\n" + + "}\n", + printed); + } + + @Test + void noChainsIndentsInIf() { + Statement cu = parseStatement("if (x.y().z()) { boo().baa().bee(); }"); + + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)); + String printed = getDefaultPrinter(configuration).print(cu); + + assertEqualsStringIgnoringEol("if (x.y().z()) {\n" + " boo().baa()\n" + " .bee();\n" + "}", printed); + } + + @Test + void noChainsIndentsInFor() { + Statement cu = parseStatement("for(int x=1; x.y().z(); x.z().z()) { boo().baa().bee(); }"); + + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)); + String printed = getDefaultPrinter(configuration).print(cu); + + assertEqualsStringIgnoringEol( + "for (int x = 1; x.y().z(); x.z().z()) {\n" + " boo().baa()\n" + " .bee();\n" + "}", + printed); + } + + @Test + void noChainsIndentsInWhile() { + Statement cu = parseStatement("while(x.y().z()) { boo().baa().bee(); }"); + + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)); + String printed = getDefaultPrinter(configuration).print(cu); + + assertEqualsStringIgnoringEol( + "while (x.y().z()) {\n" + " boo().baa()\n" + " .bee();\n" + "}", printed); + } + + @Test + void indentWithTabsAsFarAsPossible() { + + CompilationUnit cu = + parse("class Foo { void bar() { foo().bar().baz(() -> { boo().baa().bee(a, b, c); }).bam(); } }"); + + Indentation indentation = new Indentation(IndentType.TABS, 1); + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)) + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, indentation)); + + String printed = getDefaultPrinter(configuration).print(cu); + + assertEqualsStringIgnoringEol( + "class Foo {\n" + "\n" + + "\tvoid bar() {\n" + + "\t\tfoo().bar()\n" + + "\t\t\t .baz(() -> {\n" + + "\t\t\t\t boo().baa()\n" + + "\t\t\t\t\t .bee(a,\n" + + "\t\t\t\t\t\t b,\n" + + "\t\t\t\t\t\t c);\n" + + "\t\t\t })\n" + + "\t\t\t .bam();\n" + + "\t}\n" + + "}\n", + printed); + } + + @Test + void indentWithTabsAlignWithSpaces() { + + CompilationUnit cu = parse( + "class Foo { void bar() { foo().bar().baz(() -> { boo().baa().bee(a, b, c); }).baz(() -> { return boo().baa(); }).bam(); } }"); + + Indentation indentation = new Indentation(IndentType.TABS_WITH_SPACE_ALIGN, 1); + PrinterConfiguration configuration = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)) + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, indentation)); + + String printed = getDefaultPrinter(configuration).print(cu); + + assertEqualsStringIgnoringEol( + "class Foo {\n" + "\n" + + "\tvoid bar() {\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(() -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee(a,\n" + + "\t\t \t b,\n" + + "\t\t \t c);\n" + + "\t\t })\n" + + "\t\t .baz(() -> {\n" + + "\t\t \treturn boo().baa();\n" + + "\t\t })\n" + + "\t\t .bam();\n" + + "\t}\n" + + "}\n", + printed); + } + + @Test + void printAnnotationsAtPrettyPlaces() { + + JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_9)); + ParseResult parseResult = javaParser.parse( + COMPILATION_UNIT, + provider("@Documented\n" + "@Repeatable\n" + + "package com.github.javaparser;\n" + + "\n" + + "import java.lang.annotation.Documented;\n" + + "import java.lang.annotation.Repeatable;\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "@interface Annotation {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " String value();\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "class Class<@Documented @Repeatable T> {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " byte b;\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " Class(@Documented @Repeatable int i) {\n" + + " @Documented\n" + + " @Repeatable\n" + + " short s;\n" + + " }\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " void method(@Documented @Repeatable Class this) {\n" + + " for (@Deprecated int i : arr4[0]) {\n" + + " x--;\n" + + " }\n" + + " }\n" + + "\n" + + " void method(@Documented @Repeatable Class this, int i) {\n" + + " }\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "enum Foo {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " BAR\n" + + "}\n" + + "@Documented\n" + + "@Repeatable\n" + + "module foo.bar {\n" + + "}\n")); + if (!parseResult.isSuccessful()) { + throw new ParseProblemException(parseResult.getProblems()); + } + CompilationUnit cu = parseResult.getResult().orElseThrow(AssertionError::new); + String printed = getDefaultPrinter().print(cu); + + assertEqualsStringIgnoringEol( + "@Documented\n" + "@Repeatable\n" + + "package com.github.javaparser;\n" + + "\n" + + "import java.lang.annotation.Documented;\n" + + "import java.lang.annotation.Repeatable;\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "@interface Annotation {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " String value();\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "class Class<@Documented @Repeatable T> {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " byte b;\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " Class(@Documented @Repeatable int i) {\n" + + " @Documented\n" + + " @Repeatable\n" + + " short s;\n" + + " }\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " void method(@Documented @Repeatable Class this) {\n" + + " for (@Deprecated int i : arr4[0]) {\n" + + " x--;\n" + + " }\n" + + " }\n" + + "\n" + + " void method(@Documented @Repeatable Class this, int i) {\n" + + " }\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "enum Foo {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " BAR\n" + + "}\n" + + "@Documented\n" + + "@Repeatable\n" + + "module foo.bar {\n" + + "}\n", + printed); + } + + @Test + public void testIssue2578() { + String code = "class C{\n" + " //orphan\n" + " /*orphan*/\n" + "}"; + CompilationUnit cu = StaticJavaParser.parse(code); + TypeDeclaration td = cu.findFirst(TypeDeclaration.class).get(); + assertEquals(2, td.getAllContainedComments().size()); + td.setPublic(true); // --- simple AST change ----- + assertEquals(2, td.getAllContainedComments().size()); // the orphaned comments exist + } + + @Test + public void testIssue2535() { + + String code = "public class A {\n" + " public static A m() {\n" + + " System.out.println(\"\");\n" + + " // TODO\n" + + " /* TODO */\n" + + " /** TODO */\n" + + " }\n" + + "}"; + + StaticJavaParser.setConfiguration(new ParserConfiguration()); + + CompilationUnit cu = StaticJavaParser.parse(code); + + // default indent is 4 spaces + assertTrue(cu.toString().contains(" // TODO")); + assertTrue(cu.toString().contains(" /* TODO */")); + } + + @Test + public void testIndentationWithDefaultSize() { + Indentation indentation = new Indentation(IndentType.SPACES); + assertTrue(indentation.getSize() == 4); + assertEquals(" ", indentation.getIndent()); + // on-the-fly modification + indentation.setSize(2); + assertTrue(indentation.getSize() == 2); + assertEquals(" ", indentation.getIndent()); + } + + @Test + public void testIndentationWithCustomSize() { + Indentation indentation = new Indentation(IndentType.TABS, 2); + assertTrue(indentation.getSize() == 2); + assertEquals("\t\t", indentation.getIndent()); + } + + @Test + public void testIndentationWithOnTheFlyModifcation() { + Indentation indentation = new Indentation(IndentType.SPACES); + // on-the-fly modification + indentation.setSize(2); + assertTrue(indentation.getSize() == 2); + assertEquals(" ", indentation.getIndent()); + indentation.setType(IndentType.TABS); + assertTrue(indentation.getType() == IndentType.TABS); + assertEquals("\t\t", indentation.getIndent()); + } + + @Test + public void testIssue3317() { + + String code = "public class Test {\n" + " protected void someMethod() {\n" + + " // Before\n" + + " System.out\n" + + " // Middle Comment\n" + + " .println(\"\");\n" + + " // After\n" + + " }\n" + + "}"; + + String expected = "public class Test {\n" + "\n" + + " protected void someMethod() {\n" + + " // Before\n" + + " System.out.// Middle Comment\n" + + " println(\"\");\n" + + " // After\n" + + " }\n" + + "}\n"; + + StaticJavaParser.setConfiguration(new ParserConfiguration()); + + CompilationUnit cu = StaticJavaParser.parse(code); + + assertEqualsStringIgnoringEol(expected, cu.toString()); + } + + @Test + void testPrinterWithIntelliJImportOrdering() { + + String expectedCode = "package com.github.javaparser.printer;\n" + "\n" + + "import com.github.javaparser.ast.Node;\n" + + "\n" + + "import java.util.Optional;\n" + + "import java.util.List;\n" + + "\n" + + "public interface TestClass {\n" + + "\n" + + " Node getRoot();\n" + + "\n" + + " List getChildern();\n" + + "}\n"; + + IntelliJImportOrderingStrategy strategy = new IntelliJImportOrderingStrategy(); + printerConfiguration.addOption(new DefaultConfigurationOption(ConfigOption.SORT_IMPORTS_STRATEGY, strategy)); + + CompilationUnit cu = parserAdapter.parse(expectedCode); + Printer printer = getDefaultPrinter(printerConfiguration); + String actualCode = printer.print(cu); + + assertEqualsStringIgnoringEol(expectedCode, actualCode); + } + + @Test + void testPrinterWithEclipseImportOrdering() { + + String expectedCode = "package com.github.javaparser.printer;\n" + "\n" + + "import java.util.Optional;\n" + + "import java.util.List;\n" + + "\n" + + "import com.github.javaparser.ast.Node;\n" + + "\n" + + "public interface TestClass {\n" + + "\n" + + " Node getRoot();\n" + + "\n" + + " List getChildern();\n" + + "}\n"; + + EclipseImportOrderingStrategy strategy = new EclipseImportOrderingStrategy(); + printerConfiguration.addOption(new DefaultConfigurationOption(ConfigOption.SORT_IMPORTS_STRATEGY, strategy)); + + CompilationUnit cu = parserAdapter.parse(expectedCode); + Printer printer = getDefaultPrinter(printerConfiguration); + String actualCode = printer.print(cu); + + assertEqualsStringIgnoringEol(expectedCode, actualCode); + } + + @Test + void testArrayOfAnnotationsFormat() { + String expectedCode = "import io.swagger.v3.oas.annotations.Operation;\n" + + "import io.swagger.v3.oas.annotations.Parameter;\n" + + "import io.swagger.v3.oas.annotations.responses.ApiResponse;\n" + + "import io.swagger.v3.oas.annotations.responses.ApiResponses;\n" + + "import org.springframework.http.HttpStatus;\n" + + "import org.springframework.http.ResponseEntity;\n" + + "import org.springframework.web.bind.annotation.DeleteMapping;\n" + + "\n" + + "@Deprecated\n" + + "public class UserController2 {\n" + + "\n" + + " @Operation(summary = \"Delete a user\")\n" + + " @ApiResponses(value = {\n" + + " @ApiResponse(responseCode = \"204\", description = \"OK\"),\n" + + " @ApiResponse(responseCode = \"404\", description = \"Failed\")\n" + + " })\n" + + " @DeleteMapping(\"/{id}\")\n" + + " public ResponseEntity deleteUser(@Parameter(description = \"ID of the user\", required = true) int id) {\n" + + " return new ResponseEntity<>(HttpStatus.NOT_FOUND);\n" + + " }\n" + + "}\n"; + + printerConfiguration.addOption( + new DefaultConfigurationOption(ConfigOption.INDENT_PRINT_ARRAYS_OF_ANNOTATIONS, true)); + CompilationUnit cu = parserAdapter.parse(expectedCode); + Printer printer = getDefaultPrinter(printerConfiguration); + String actualCode = printer.print(cu); + + assertEqualsStringIgnoringEol(expectedCode, actualCode); + } + + @Test + void testArrayOfAnnotationsDisableFormat() { + String expectedCode = "import io.swagger.v3.oas.annotations.Operation;\n" + + "import io.swagger.v3.oas.annotations.Parameter;\n" + + "import io.swagger.v3.oas.annotations.responses.ApiResponse;\n" + + "import io.swagger.v3.oas.annotations.responses.ApiResponses;\n" + + "import org.springframework.http.HttpStatus;\n" + + "import org.springframework.http.ResponseEntity;\n" + + "import org.springframework.web.bind.annotation.DeleteMapping;\n" + + "\n" + + "@Deprecated\n" + + "public class UserController2 {\n" + + "\n" + + " @Operation(summary = \"Delete a user\")\n" + + " @ApiResponses(value = { @ApiResponse(responseCode = \"204\", description = \"OK\"), @ApiResponse(responseCode = \"404\", description = \"Failed\") })\n" + + " @DeleteMapping(\"/{id}\")\n" + + " public ResponseEntity deleteUser(@Parameter(description = \"ID of the user\", required = true) int id) {\n" + + " return new ResponseEntity<>(HttpStatus.NOT_FOUND);\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = parserAdapter.parse(expectedCode); + Printer printer = getDefaultPrinter(printerConfiguration); + String actualCode = printer.print(cu); + + assertEqualsStringIgnoringEol(expectedCode, actualCode); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/DotPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/DotPrinterTest.java new file mode 100644 index 0000000..493681c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/DotPrinterTest.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import org.junit.jupiter.api.Test; + +class DotPrinterTest { + @Test + void testWithType() { + String expectedOutput = "digraph {" + System.lineSeparator(); + expectedOutput += "n0 [label=\"root (MethodCallExpr)\"];" + System.lineSeparator(); + expectedOutput += "n1 [label=\"name (SimpleName)\"];" + System.lineSeparator(); + expectedOutput += "n0 -> n1;" + System.lineSeparator(); + expectedOutput += "n2 [label=\"identifier='x'\"];" + System.lineSeparator(); + expectedOutput += "n1 -> n2;" + System.lineSeparator(); + expectedOutput += "n3 [label=\"arguments\"];" + System.lineSeparator(); + expectedOutput += "n0 -> n3;" + System.lineSeparator(); + expectedOutput += "n4 [label=\"argument (IntegerLiteralExpr)\"];" + System.lineSeparator(); + expectedOutput += "n3 -> n4;" + System.lineSeparator(); + expectedOutput += "n5 [label=\"value='1'\"];" + System.lineSeparator(); + expectedOutput += "n4 -> n5;" + System.lineSeparator(); + expectedOutput += "n6 [label=\"argument (IntegerLiteralExpr)\"];" + System.lineSeparator(); + expectedOutput += "n3 -> n6;" + System.lineSeparator(); + expectedOutput += "n7 [label=\"value='1'\"];" + System.lineSeparator(); + expectedOutput += "n6 -> n7;" + System.lineSeparator(); + expectedOutput += "}"; + + DotPrinter dotPrinter = new DotPrinter(true); + Expression expression = parseExpression("x(1,1)"); + String output = dotPrinter.output(expression); + assertEquals(expectedOutput, output); + } + + @Test + void testWithoutType() { + String expectedOutput = "digraph {" + System.lineSeparator(); + expectedOutput += "n0 [label=\"root\"];" + System.lineSeparator(); + expectedOutput += "n1 [label=\"operator='PLUS'\"];" + System.lineSeparator(); + expectedOutput += "n0 -> n1;" + System.lineSeparator(); + expectedOutput += "n2 [label=\"left\"];" + System.lineSeparator(); + expectedOutput += "n0 -> n2;" + System.lineSeparator(); + expectedOutput += "n3 [label=\"value='1'\"];" + System.lineSeparator(); + expectedOutput += "n2 -> n3;" + System.lineSeparator(); + expectedOutput += "n4 [label=\"right\"];" + System.lineSeparator(); + expectedOutput += "n0 -> n4;" + System.lineSeparator(); + expectedOutput += "n5 [label=\"value='1'\"];" + System.lineSeparator(); + expectedOutput += "n4 -> n5;" + System.lineSeparator(); + expectedOutput += "}"; + + DotPrinter dotPrinter = new DotPrinter(false); + Expression expression = parseExpression("1+1"); + String output = dotPrinter.output(expression); + assertEquals(expectedOutput, output); + } + + @Test + void testIssue1871() { + DotPrinter printer = new DotPrinter(false); + CompilationUnit cu = parse("//q\"q\nclass X{}"); + String output = printer.output(cu); + assertEqualsStringIgnoringEol( + "digraph {\n" + "n0 [label=\"root\"];\n" + + "n1 [label=\"types\"];\n" + + "n0 -> n1;\n" + + "n2 [label=\"type\"];\n" + + "n1 -> n2;\n" + + "n3 [label=\"isInterface='false'\"];\n" + + "n2 -> n3;\n" + + "n4 [label=\"name\"];\n" + + "n2 -> n4;\n" + + "n5 [label=\"identifier='X'\"];\n" + + "n4 -> n5;\n" + + "n6 [label=\"comment\"];\n" + + "n2 -> n6;\n" + + "n7 [label=\"content='q\\\"q'\"];\n" + + "n6 -> n7;\n" + + "}", + output); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/JsonPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/JsonPrinterTest.java new file mode 100644 index 0000000..fd70eee --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/JsonPrinterTest.java @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrettyPrintVisitorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrettyPrintVisitorTest.java new file mode 100644 index 0000000..5c69481 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrettyPrintVisitorTest.java @@ -0,0 +1,524 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.CastExpr; +import com.github.javaparser.ast.expr.ClassExpr; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.printer.configuration.ConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.PrinterConfiguration; +import com.github.javaparser.utils.LineSeparator; +import com.github.javaparser.utils.TestParser; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class PrettyPrintVisitorTest extends TestParser { + + private Optional getOption(PrinterConfiguration config, ConfigOption cOption) { + return config.get(new DefaultConfigurationOption(cOption)); + } + + @Test + void getMaximumCommonTypeWithoutAnnotations() { + VariableDeclarationExpr vde1 = parseVariableDeclarationExpr("int a[], b[]"); + assertEquals("int[]", vde1.getMaximumCommonType().get().toString()); + + VariableDeclarationExpr vde2 = parseVariableDeclarationExpr("int[][] a[], b[]"); + assertEquals("int[][][]", vde2.getMaximumCommonType().get().toString()); + + VariableDeclarationExpr vde3 = parseVariableDeclarationExpr("int[][] a, b[]"); + assertEquals("int[][]", vde3.getMaximumCommonType().get().toString()); + } + + @Test + void getMaximumCommonTypeWithAnnotations() { + VariableDeclarationExpr vde1 = parseVariableDeclarationExpr("int a @Foo [], b[]"); + assertEquals("int", vde1.getMaximumCommonType().get().toString()); + + VariableDeclarationExpr vde2 = parseVariableDeclarationExpr("int[]@Foo [] a[], b[]"); + assertEquals("int[][] @Foo []", vde2.getMaximumCommonType().get().toString()); + } + + private String print(Node node) { + return new DefaultPrettyPrinter().print(node); + } + + private String print(Node node, PrinterConfiguration conf) { + return new DefaultPrettyPrinter(conf).print(node); + } + + @Test + void printSimpleClassExpr() { + ClassExpr expr = parseExpression("Foo.class"); + assertEquals("Foo.class", print(expr)); + } + + /** + * Here is a simple test according to R0 (removing spaces) + */ + @Test + void printOperatorsR0() { + PrinterConfiguration conf1 = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + Statement statement1 = parseStatement("a = 1 + 1;"); + assertEquals("a=1+1;", print(statement1, conf1)); + } + + /** + * Here we test different operators according to requirement R1 (handling different operators) + */ + @Test + void printOperatorsR1() { + + Statement statement1 = parseStatement("a = 1 + 1;"); + assertEquals("a = 1 + 1;", print(statement1)); + + Statement statement2 = parseStatement("a = 1 - 1;"); + assertEquals("a = 1 - 1;", print(statement2)); + + Statement statement3 = parseStatement("a = 1 * 1;"); + assertEquals("a = 1 * 1;", print(statement3)); + + Statement statement4 = parseStatement("a = 1 % 1;"); + assertEquals("a = 1 % 1;", print(statement4)); + + Statement statement5 = parseStatement("a=1/1;"); + assertEquals("a = 1 / 1;", print(statement5)); + + Statement statement6 = parseStatement("if (1 > 2 && 1 < 3 || 1 < 3){}"); + assertEquals("if (1 > 2 && 1 < 3 || 1 < 3) {" + LineSeparator.SYSTEM + "}", print(statement6)); + } + + /** + * Here is a simple test according to R2 (that it should be optional/modifiable) + */ + @Test + void printOperatorsR2() { + PrinterConfiguration conf1 = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + Statement statement1 = parseStatement("a = 1 + 1;"); + assertEquals("a=1+1;", print(statement1, conf1)); + + PrinterConfiguration conf2 = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + Statement statement2 = parseStatement("a=1+1;"); + assertEquals("a=1+1;", print(statement2, conf2)); + + PrinterConfiguration conf3 = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + Statement statement3 = parseStatement("a = 1 + 1;"); + assertEquals("a = 1 + 1;", print(statement3, conf3)); + + PrinterConfiguration conf4 = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + Statement statement4 = parseStatement("a=1+1;"); + assertEquals("a = 1 + 1;", print(statement4, conf4)); + } + + @Test + void printOperatorA() { + PrinterConfiguration conf = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + Statement statement6 = parseStatement("if(1>2&&1<3||1<3){}"); + assertEquals("if (1>2&&1<3||1<3) {" + LineSeparator.SYSTEM + "}", print(statement6, conf)); + } + + @Test + void printOperator2() { + Expression expression = parseExpression("1+1"); + PrinterConfiguration spaces = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.SPACE_AROUND_OPERATORS)); + assertEquals("1+1", print(expression, spaces)); + } + + @Test + void printArrayClassExpr() { + ClassExpr expr = parseExpression("Foo[].class"); + assertEquals("Foo[].class", print(expr)); + } + + @Test + void printGenericClassExpr() { + ClassExpr expr = parseExpression("Foo.class"); + assertEquals("Foo.class", print(expr)); + } + + @Test + void printSimplestClass() { + Node node = parse("class A {}"); + assertEquals("class A {" + LineSeparator.SYSTEM + "}" + LineSeparator.SYSTEM, print(node)); + } + + @Test + void printAClassWithField() { + Node node = parse("class A { int a; }"); + assertEquals( + "class A {" + LineSeparator.SYSTEM + + LineSeparator.SYSTEM + " int a;" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM, + print(node)); + } + + @Test + void printAReceiverParameter() { + Node node = parseBodyDeclaration("int x(@O X A.B.this, int y) { }"); + assertEquals("int x(@O X A.B.this, int y) {" + LineSeparator.SYSTEM + "}", print(node)); + } + + @Test + void printLambdaIntersectionTypeAssignment() { + String code = "class A {" + LineSeparator.SYSTEM + " void f() {" + + LineSeparator.SYSTEM + " Runnable r = (Runnable & Serializable) (() -> {});" + + LineSeparator.SYSTEM + " r = (Runnable & Serializable)() -> {};" + + LineSeparator.SYSTEM + " r = (Runnable & I)() -> {};" + + LineSeparator.SYSTEM + " }}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = (MethodDeclaration) cu.getType(0).getMember(0); + + assertEquals( + "Runnable r = (Runnable & Serializable) (() -> {" + LineSeparator.SYSTEM + "});", + print(methodDeclaration.getBody().get().getStatements().get(0))); + } + + @Test + void printIntersectionType() { + String code = "(Runnable & Serializable) (() -> {})"; + Expression expression = parseExpression(code); + Type type = ((CastExpr) expression).getType(); + + assertEquals("Runnable & Serializable", print(type)); + } + + @Test + void printLambdaIntersectionTypeReturn() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + CompilationUnit cu = parse(code); + MethodDeclaration methodDeclaration = (MethodDeclaration) cu.getType(0).getMember(0); + + assertEquals( + "return (Comparator> & Serializable) (c1, c2) -> c1.getKey().compareTo(c2.getKey());", + print(methodDeclaration.getBody().get().getStatements().get(0))); + } + + @Test + void printClassWithoutJavaDocButWithComment() { + String code = String.format( + "/** javadoc */ public class A { %s// stuff%s}", LineSeparator.SYSTEM, LineSeparator.SYSTEM); + CompilationUnit cu = parse(code); + PrinterConfiguration ignoreJavaDoc = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.PRINT_JAVADOC)); + String content = cu.toString(ignoreJavaDoc); + assertEquals( + String.format( + "public class A {%s // stuff%s}%s", + LineSeparator.SYSTEM, LineSeparator.SYSTEM, LineSeparator.SYSTEM), + content); + } + + @Test + void printImportsDefaultOrder() { + String code = "import x.y.z;import a.b.c;import static b.c.d;class c {}"; + CompilationUnit cu = parse(code); + String content = cu.toString(); + assertEqualsStringIgnoringEol( + "import x.y.z;\n" + "import a.b.c;\n" + "import static b.c.d;\n" + "\n" + "class c {\n" + "}\n", + content); + } + + @Test + void printImportsOrdered() { + String code = "import x.y.z;import a.b.c;import static b.c.d;class c {}"; + CompilationUnit cu = parse(code); + PrinterConfiguration orderImports = + new DefaultPrinterConfiguration().addOption(new DefaultConfigurationOption(ConfigOption.ORDER_IMPORTS)); + String content = cu.toString(orderImports); + assertEqualsStringIgnoringEol( + "import static b.c.d;\n" + "import a.b.c;\n" + "import x.y.z;\n" + "\n" + "class c {\n" + "}\n", + content); + } + + @Test + void multilineJavadocGetsFormatted() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setJavadocComment("line1\n line2 *\n * line3"); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + + " /**\n" + + " * line1\n" + + " * line2 *\n" + + " * line3\n" + + " */\n" + + " void abc() {\n" + + " }\n" + + "}\n", + cu.toString()); + } + + @Test + void emptyJavadocGetsFormatted() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setJavadocComment(""); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + " /**\n" + " */\n" + " void abc() {\n" + " }\n" + "}\n", + cu.toString()); + } + + @Test + void multilineJavadocWithLotsOfEmptyLinesGetsFormattedNeatly() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setJavadocComment("\n\n\n ab\n\n\n cd\n\n\n"); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + + " /**\n" + + " * ab\n" + + " *\n" + + " * cd\n" + + " */\n" + + " void abc() {\n" + + " }\n" + + "}\n", + cu.toString()); + } + + @Test + void singlelineJavadocGetsFormatted() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setJavadocComment("line1"); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + + " /**\n" + + " * line1\n" + + " */\n" + + " void abc() {\n" + + " }\n" + + "}\n", + cu.toString()); + } + + @Test + void javadocAlwaysGetsASpaceBetweenTheAsteriskAndTheRestOfTheLine() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setJavadocComment("line1\nline2"); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + + " /**\n" + + " * line1\n" + + " * line2\n" + + " */\n" + + " void abc() {\n" + + " }\n" + + "}\n", + cu.toString()); + } + + @Test + void javadocAlwaysGetsAnAdditionalSpaceOrNeverGetsIt() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setJavadocComment("line1\n" + "line2\n" + " 3"); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + + " /**\n" + + " * line1\n" + + " * line2\n" + + " * 3\n" + + " */\n" + + " void abc() {\n" + + " }\n" + + "}\n", + cu.toString()); + } + + @Test + void singlelineCommentGetsFormatted() { + CompilationUnit cu = new CompilationUnit(); + cu.addClass("X").addMethod("abc").setComment(new LineComment(" line1 \n ")); + + assertEqualsStringIgnoringEol( + "public class X {\n" + "\n" + " // line1\n" + " void abc() {\n" + " }\n" + "}\n", + cu.toString()); + } + + @Test + void blockcommentGetsNoFormatting() { + CompilationUnit cu = parse("class A {\n" + " public void helloWorld(String greeting, String name) {\n" + + " //sdfsdfsdf\n" + + " //sdfds\n" + + " /*\n" + + " dgfdgfdgfdgfdgfd\n" + + " */\n" + + " }\n" + + "}\n"); + + assertEqualsStringIgnoringEol( + "class A {\n" + "\n" + + " public void helloWorld(String greeting, String name) {\n" + + " //sdfsdfsdf\n" + + " //sdfds\n" + + " /*\n" + + " dgfdgfdgfdgfdgfd\n" + + " */\n" + + " }\n" + + "}\n", + cu.toString()); + } + + private String expected = "public class SomeClass {\n" + "\n" + + " /**\n" + + " * tester line\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " */\n" + + " public void add(int x, int y) {\n" + + " }\n" + + "}\n"; + + @Test + void javadocIssue1907_allLeadingSpaces() { + String input_allLeadingSpaces = "public class SomeClass{" + "/**\n" + + " * tester line\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " multi line comment\n" + + " */\n" + + "public void add(int x, int y){}}"; + + CompilationUnit cu_allLeadingSpaces = parse(input_allLeadingSpaces); + assertEqualsStringIgnoringEol(expected, cu_allLeadingSpaces.toString()); + } + + @Test + void javadocIssue1907_singleMissingLeadingSpace() { + String input_singleMissingLeadingSpace = "public class SomeClass{" + "/**\n" + + "* tester line\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " multi line comment\n" + + " */\n" + + "public void add(int x, int y){}}"; + + CompilationUnit cu_singleMissingLeadingSpace = parse(input_singleMissingLeadingSpace); + assertEqualsStringIgnoringEol(expected, cu_singleMissingLeadingSpace.toString()); + } + + @Test + void javadocIssue1907_leadingTab() { + String input_leadingTab = "public class SomeClass{" + "/**\n" + + "\t * tester line\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " * multi line comment\n" + + " multi line comment\n" + + " */\n" + + "public void add(int x, int y){}}"; + + CompilationUnit cu_leadingTab = parseCompilationUnit(input_leadingTab); + assertEqualsStringIgnoringEol(expected, cu_leadingTab.toString()); + } + + @Test + void printYield() { + Statement statement = parseStatement("yield 5*5;"); + assertEqualsStringIgnoringEol("yield 5 * 5;", statement.toString()); + } + + @Test + void printTextBlock() { + CompilationUnit cu = parseCompilationUnit( + ParserConfiguration.LanguageLevel.JAVA_13_PREVIEW, + "class X{String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + " \"\"\";}"); + + assertEqualsStringIgnoringEol( + "String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + " \"\"\";", + cu.getClassByName("X").get().getFieldByName("html").get().toString()); + } + + @Test + void printTextBlock2() { + CompilationUnit cu = parseCompilationUnit( + ParserConfiguration.LanguageLevel.JAVA_13_PREVIEW, + "class X{String html = \"\"\"\n" + " \n" + " \"\"\";}"); + + assertEqualsStringIgnoringEol( + "String html = \"\"\"\n" + " \n" + " \"\"\";", + cu.getClassByName("X").get().getFieldByName("html").get().toString()); + } + + @Test + void innerClassWithConstructorReceiverParameterTest() { + String innerClassWithConstructorReceiverParam = "public class A {\n\n" + " class InnerA {\n\n" + + " InnerA(A A.this) {\n" + + " }\n" + + " }\n" + + "}\n"; + CompilationUnit cu = parseCompilationUnit(innerClassWithConstructorReceiverParam); + assertEqualsStringIgnoringEol(innerClassWithConstructorReceiverParam, print(cu)); + } + + @Test + void printPermitsKeyworld() { + CompilationUnit cu = parseCompilationUnit( + ParserConfiguration.LanguageLevel.JAVA_17, "public sealed interface I1 permits I2, C, D {}"); + String expected = "public sealed interface I1 permits I2, C, D {\n" + "}\n"; + + assertEqualsStringIgnoringEol(expected, cu.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrettyPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrettyPrinterTest.java new file mode 100644 index 0000000..e3afa38 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrettyPrinterTest.java @@ -0,0 +1,669 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.ParseStart.COMPILATION_UNIT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_9; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.StaticJavaParser.*; +import static com.github.javaparser.printer.configuration.Indentation.IndentType.TABS; +import static com.github.javaparser.printer.configuration.Indentation.IndentType.TABS_WITH_SPACE_ALIGN; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.*; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.TypeDeclaration; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.ast.visitor.VoidVisitor; +import com.github.javaparser.printer.configuration.*; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.Indentation.IndentType; +import java.util.Optional; +import java.util.function.Function; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class PrettyPrinterTest { + + private String prettyPrintField(String code) { + CompilationUnit cu = parse(code); + return new DefaultPrettyPrinter() + .print(cu.findFirst(FieldDeclaration.class).get()); + } + + private String prettyPrintVar(String code) { + CompilationUnit cu = parse(code); + return new DefaultPrettyPrinter() + .print(cu.findAll(VariableDeclarationExpr.class).get(0)); + } + + private Optional getOption(PrinterConfiguration config, ConfigOption cOption) { + return config.get(new DefaultConfigurationOption(cOption)); + } + + private static final ParserConfiguration.LanguageLevel storedLanguageLevel = + StaticJavaParser.getParserConfiguration().getLanguageLevel(); + + @BeforeEach + public void setLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + } + + @AfterEach + public void resetLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(storedLanguageLevel); + } + + @Test + void printingArrayFields() { + String code; + code = "class A { int a, b[]; }"; + assertEquals("int a, b[];", prettyPrintField(code)); + + code = "class A { int[] a[], b[]; }"; + assertEquals("int[][] a, b;", prettyPrintField(code)); + + code = "class A { int[] a[][], b; }"; + assertEquals("int[] a[][], b;", prettyPrintField(code)); + + code = "class A { int[] a, b; }"; + assertEquals("int[] a, b;", prettyPrintField(code)); + + code = "class A { int a[], b[]; }"; + assertEquals("int[] a, b;", prettyPrintField(code)); + } + + @Test + void printingArrayVariables() { + String code; + code = "class A { void foo(){ int a, b[]; }}"; + assertEquals("int a, b[]", prettyPrintVar(code)); + + code = "class A { void foo(){ int[] a[], b[]; }}"; + assertEquals("int[][] a, b", prettyPrintVar(code)); + + code = "class A { void foo(){ int[] a[][], b; }}"; + assertEquals("int[] a[][], b", prettyPrintVar(code)); + + code = "class A { void foo(){ int[] a, b; }}"; + assertEquals("int[] a, b", prettyPrintVar(code)); + + code = "class A { void foo(){ int a[], b[]; }}"; + assertEquals("int[] a, b", prettyPrintVar(code)); + } + + private String prettyPrintConfigurable(String code) { + CompilationUnit cu = parse(code); + PrinterConfiguration configuration = new DefaultPrinterConfiguration(); + Function> visitorFactory = + (config) -> new TestVisitor(config, new SourcePrinter(config)); + Printer printer = new DefaultPrettyPrinter(visitorFactory, configuration); + return printer.print(cu.findFirst(ClassOrInterfaceDeclaration.class).get()); + } + + @Test + void printUseTestVisitor() { + String code; + code = "class A { void foo(){ int a, b[]; }}"; + assertEquals("test", prettyPrintConfigurable(code)); + } + + @Test + void prettyColumnAlignParameters_enabled() { + PrinterConfiguration config = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)); + final String EOL = + getOption(config, ConfigOption.END_OF_LINE_CHARACTER).get().asValue(); + + String code = "class Example { void foo(Object arg0,Object arg1){ myMethod(1, 2, 3, 5, Object.class); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo(Object arg0, Object arg1) {" + + EOL + " myMethod(1," + + EOL + " 2," + + EOL + " 3," + + EOL + " 5," + + EOL + " Object.class);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + assertEquals(expected, new DefaultPrettyPrinter(config).print(parse(code))); + } + + @Test + void prettyColumnAlignParameters_disabled() { + + PrinterConfiguration config = new DefaultPrinterConfiguration(); + final String EOL = + getOption(config, ConfigOption.END_OF_LINE_CHARACTER).get().asValue(); + + String code = "class Example { void foo(Object arg0,Object arg1){ myMethod(1, 2, 3, 5, Object.class); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo(Object arg0, Object arg1) {" + + EOL + " myMethod(1, 2, 3, 5, Object.class);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + assertEquals(expected, new DefaultPrettyPrinter(config).print(parse(code))); + } + + @Test + void prettyAlignMethodCallChains_enabled() { + + PrinterConfiguration config = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)); + final String EOL = + getOption(config, ConfigOption.END_OF_LINE_CHARACTER).get().asValue(); + + String code = + "class Example { void foo() { IntStream.range(0, 10).filter(x -> x % 2 == 0).map(x -> x * IntStream.of(1,3,5,1).sum()).forEach(System.out::println); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo() {" + + EOL + " IntStream.range(0, 10)" + + EOL + " .filter(x -> x % 2 == 0)" + + EOL + " .map(x -> x * IntStream.of(1, 3, 5, 1)" + + EOL + " .sum())" + + EOL + " .forEach(System.out::println);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + assertEquals(expected, new DefaultPrettyPrinter(config).print(parse(code))); + } + + @Test + void prettyAlignMethodCallChains_disabled() { + + PrinterConfiguration config = new DefaultPrinterConfiguration(); + final String EOL = + getOption(config, ConfigOption.END_OF_LINE_CHARACTER).get().asValue(); + + String code = + "class Example { void foo() { IntStream.range(0, 10).filter(x -> x % 2 == 0).map(x -> x * IntStream.of(1,3,5,1).sum()).forEach(System.out::println); } }"; + String expected = "class Example {" + EOL + "" + + EOL + " void foo() {" + + EOL + + " IntStream.range(0, 10).filter(x -> x % 2 == 0).map(x -> x * IntStream.of(1, 3, 5, 1).sum()).forEach(System.out::println);" + + EOL + " }" + + EOL + "}" + + EOL + ""; + + String printed = new DefaultPrettyPrinter(config).print(parse(code)); + + assertEquals(expected, printed); + } + + @Test + void enumConstantsHorizontally() { + CompilationUnit cu = parse("enum X{A, B, C, D, E}"); + assertEqualsStringIgnoringEol("enum X {\n\n A, B, C, D, E\n}\n", new DefaultPrettyPrinter().print(cu)); + } + + @Test + void enumConstantsVertically() { + CompilationUnit cu = parse("enum X{A, B, C, D, E, F}"); + assertEqualsStringIgnoringEol( + "enum X {\n\n A,\n B,\n C,\n D,\n E,\n F\n}\n", new DefaultPrettyPrinter().print(cu)); + } + + @Test + void printingInconsistentVariables() { + FieldDeclaration fieldDeclaration = parseBodyDeclaration("int a, b;").asFieldDeclaration(); + + assertEquals("int a, b;", fieldDeclaration.toString()); + + fieldDeclaration.getVariable(0).setType(PrimitiveType.doubleType()); + + assertEquals("??? a, b;", fieldDeclaration.toString()); + + fieldDeclaration.getVariable(1).setType(PrimitiveType.doubleType()); + + assertEquals("double a, b;", fieldDeclaration.toString()); + } + + @Test + void prettyAlignMethodCallChainsIndentsArgumentsWithBlocksCorrectly() { + + CompilationUnit cu = parse( + "class Foo { void bar() { a.b.c.d.e; a.b.c().d().e(); a.b.c().d.e(); foo().bar().baz(boo().baa().bee()).bam(); foo().bar().baz(boo().baa().bee()).bam; foo().bar(Long.foo().b.bar(), bam).baz(); foo().bar().baz(foo, () -> { boo().baa().bee(); }).baz(() -> { boo().baa().bee(); }).bam(() -> { boo().baa().bee(); }); } }"); + Indentation indentation = new Indentation(TABS_WITH_SPACE_ALIGN, 1); + + PrinterConfiguration config = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)) + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, indentation)); + + String printed = new DefaultPrettyPrinter(config).print(cu); + + assertEqualsStringIgnoringEol( + "class Foo {\n" + "\n" + + "\tvoid bar() {\n" + + "\t\ta.b.c.d.e;\n" + + "\t\ta.b.c()\n" + + "\t\t .d()\n" + + "\t\t .e();\n" + + "\t\ta.b.c().d\n" + + "\t\t .e();\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(boo().baa().bee())\n" + + "\t\t .bam();\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(boo().baa().bee()).bam;\n" + + "\t\tfoo().bar(Long.foo().b.bar(),\n" + + "\t\t bam)\n" + + "\t\t .baz();\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(foo,\n" + + "\t\t () -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee();\n" + + "\t\t })\n" + + "\t\t .baz(() -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee();\n" + + "\t\t })\n" + + "\t\t .bam(() -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee();\n" + + "\t\t });\n" + + "\t}\n" + + "}\n", + printed); + } + + @Test + void noChainsIndentsInIf() { + Statement cu = parseStatement("if (x.y().z()) { boo().baa().bee(); }"); + + String printed = new DefaultPrettyPrinter(new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN))) + .print(cu); + + assertEqualsStringIgnoringEol("if (x.y().z()) {\n" + " boo().baa()\n" + " .bee();\n" + "}", printed); + } + + @Test + void noChainsIndentsInFor() { + Statement cu = parseStatement("for(int x=1; x.y().z(); x.z().z()) { boo().baa().bee(); }"); + + String printed = new DefaultPrettyPrinter(new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN))) + .print(cu); + + assertEqualsStringIgnoringEol( + "for (int x = 1; x.y().z(); x.z().z()) {\n" + " boo().baa()\n" + " .bee();\n" + "}", + printed); + } + + @Test + void noChainsIndentsInWhile() { + Statement cu = parseStatement("while(x.y().z()) { boo().baa().bee(); }"); + + String printed = new DefaultPrettyPrinter(new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN))) + .print(cu); + + assertEqualsStringIgnoringEol( + "while (x.y().z()) {\n" + " boo().baa()\n" + " .bee();\n" + "}", printed); + } + + @Test + void indentWithTabsAsFarAsPossible() { + + CompilationUnit cu = + parse("class Foo { void bar() { foo().bar().baz(() -> { boo().baa().bee(a, b, c); }).bam(); } }"); + Indentation indentation = new Indentation(TABS, 1); + String printed = new DefaultPrettyPrinter(new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)) + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, indentation))) + .print(cu); + + assertEqualsStringIgnoringEol( + "class Foo {\n" + "\n" + + "\tvoid bar() {\n" + + "\t\tfoo().bar()\n" + + "\t\t\t .baz(() -> {\n" + + "\t\t\t\t boo().baa()\n" + + "\t\t\t\t\t .bee(a,\n" + + "\t\t\t\t\t\t b,\n" + + "\t\t\t\t\t\t c);\n" + + "\t\t\t })\n" + + "\t\t\t .bam();\n" + + "\t}\n" + + "}\n", + printed); + } + + @Test + void initializeWithSpecificConfiguration() { + CompilationUnit cu = parse("class Foo { // this is a comment \n" + "}"); + PrinterConfiguration config = new DefaultPrinterConfiguration() + .removeOption(new DefaultConfigurationOption(ConfigOption.PRINT_COMMENTS)); + + ConfigurablePrinter printer = new DefaultPrettyPrinter(config); + assertFalse(printer.getConfiguration() + .get(new DefaultConfigurationOption(ConfigOption.PRINT_COMMENTS)) + .isPresent()); + String printed = printer.print(cu); + assertEqualsStringIgnoringEol("class Foo {\n" + "}\n", printed); + } + + @Test + void indentWithTabsAlignWithSpaces() { + + CompilationUnit cu = parse( + "class Foo { void bar() { foo().bar().baz(() -> { boo().baa().bee(a, b, c); }).baz(() -> { return boo().baa(); }).bam(); } }"); + Indentation indentation = new Indentation(TABS_WITH_SPACE_ALIGN, 1); + String printed = new DefaultPrettyPrinter(new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN)) + .addOption(new DefaultConfigurationOption(ConfigOption.COLUMN_ALIGN_PARAMETERS)) + .addOption(new DefaultConfigurationOption(ConfigOption.INDENTATION, indentation))) + .print(cu); + + assertEqualsStringIgnoringEol( + "class Foo {\n" + "\n" + + "\tvoid bar() {\n" + + "\t\tfoo().bar()\n" + + "\t\t .baz(() -> {\n" + + "\t\t \tboo().baa()\n" + + "\t\t \t .bee(a,\n" + + "\t\t \t b,\n" + + "\t\t \t c);\n" + + "\t\t })\n" + + "\t\t .baz(() -> {\n" + + "\t\t \treturn boo().baa();\n" + + "\t\t })\n" + + "\t\t .bam();\n" + + "\t}\n" + + "}\n", + printed); + } + + @Test + void printAnnotationsAtPrettyPlaces() { + + JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_9)); + ParseResult parseResult = javaParser.parse( + COMPILATION_UNIT, + provider("@Documented\n" + "@Repeatable\n" + + "package com.github.javaparser;\n" + + "\n" + + "import java.lang.annotation.Documented;\n" + + "import java.lang.annotation.Repeatable;\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "@interface Annotation {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " String value();\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "class Class<@Documented @Repeatable T> {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " byte b;\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " Class(@Documented @Repeatable int i) {\n" + + " @Documented\n" + + " @Repeatable\n" + + " short s;\n" + + " }\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " void method(@Documented @Repeatable Class this) {\n" + + " for (@Deprecated int i : arr4[0]) {\n" + + " x--;\n" + + " }\n" + + " }\n" + + "\n" + + " void method(@Documented @Repeatable Class this, int i) {\n" + + " }\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "enum Foo {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " BAR\n" + + "}\n" + + "@Documented\n" + + "@Repeatable\n" + + "module foo.bar {\n" + + "}\n")); + if (!parseResult.isSuccessful()) { + throw new ParseProblemException(parseResult.getProblems()); + } + CompilationUnit cu = parseResult.getResult().orElseThrow(AssertionError::new); + String printed = new DefaultPrettyPrinter().print(cu); + + assertEqualsStringIgnoringEol( + "@Documented\n" + "@Repeatable\n" + + "package com.github.javaparser;\n" + + "\n" + + "import java.lang.annotation.Documented;\n" + + "import java.lang.annotation.Repeatable;\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "@interface Annotation {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " String value();\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "class Class<@Documented @Repeatable T> {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " byte b;\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " Class(@Documented @Repeatable int i) {\n" + + " @Documented\n" + + " @Repeatable\n" + + " short s;\n" + + " }\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " void method(@Documented @Repeatable Class this) {\n" + + " for (@Deprecated int i : arr4[0]) {\n" + + " x--;\n" + + " }\n" + + " }\n" + + "\n" + + " void method(@Documented @Repeatable Class this, int i) {\n" + + " }\n" + + "}\n" + + "\n" + + "@Documented\n" + + "@Repeatable\n" + + "enum Foo {\n" + + "\n" + + " @Documented\n" + + " @Repeatable\n" + + " BAR\n" + + "}\n" + + "@Documented\n" + + "@Repeatable\n" + + "module foo.bar {\n" + + "}\n", + printed); + } + + @Test + public void testIssue2578() { + String code = "class C{\n" + " //orphan\n" + " /*orphan*/\n" + "}"; + CompilationUnit cu = StaticJavaParser.parse(code); + TypeDeclaration td = cu.findFirst(TypeDeclaration.class).get(); + assertEquals(2, td.getAllContainedComments().size()); + td.setPublic(true); // --- simple AST change ----- + assertEquals(2, td.getAllContainedComments().size()); // the orphaned comments exist + } + + @Test + public void testIssue2535() { + + String code = "public class A {\n" + " public static A m() {\n" + + " System.out.println(\"\");\n" + + " // TODO\n" + + " /* TODO */\n" + + " /** TODO */\n" + + " }\n" + + "}"; + + StaticJavaParser.setConfiguration(new ParserConfiguration()); + + CompilationUnit cu = StaticJavaParser.parse(code); + + // default indent is 4 spaces + assertTrue(cu.toString().contains(" // TODO")); + assertTrue(cu.toString().contains(" /* TODO */")); + } + + @Test + public void testIndentationWithDefaultSize() { + Indentation indentation = new Indentation(IndentType.SPACES); + assertTrue(indentation.getSize() == 4); + assertEquals(" ", indentation.getIndent()); + // on-the-fly modification + indentation.setSize(2); + assertTrue(indentation.getSize() == 2); + assertEquals(" ", indentation.getIndent()); + } + + @Test + public void testIndentationWithCustomSize() { + Indentation indentation = new Indentation(IndentType.TABS, 2); + assertTrue(indentation.getSize() == 2); + assertEquals("\t\t", indentation.getIndent()); + } + + @Test + public void testIndentationWithOnTheFlyModifcation() { + Indentation indentation = new Indentation(IndentType.SPACES); + // on-the-fly modification + indentation.setSize(2); + assertTrue(indentation.getSize() == 2); + assertEquals(" ", indentation.getIndent()); + indentation.setType(IndentType.TABS); + assertTrue(indentation.getType() == IndentType.TABS); + assertEquals("\t\t", indentation.getIndent()); + } + + @Test + public void testSwitchDefault() { + String code = "class Foo {\n" + "\n" + + " void foo(Integer arg) {\n" + + " switch(foo) {\n" + + " default ->\n" + + " System.out.println(-1);\n" + + " }\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = parse(code); + assertEqualsStringIgnoringEol(code, new DefaultPrettyPrinter().print(cu)); + } + + @Test + public void testSwitchNullDefault() { + String code = "class Foo {\n" + "\n" + + " void foo(Integer arg) {\n" + + " switch(foo) {\n" + + " case null, default ->\n" + + " System.out.println(-1);\n" + + " }\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = parse(code); + assertEqualsStringIgnoringEol(code, new DefaultPrettyPrinter().print(cu)); + } + + @Test + public void testSwitchPattern() { + String code = "class Foo {\n" + "\n" + + " void foo(Integer arg) {\n" + + " switch(foo) {\n" + + " case String s ->\n" + + " System.out.println(s);\n" + + " }\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = parse(code); + assertEqualsStringIgnoringEol(code, new DefaultPrettyPrinter().print(cu)); + } + + @Test + public void testSwitchPatternWithGuard() { + String code = "class Foo {\n" + "\n" + + " void foo(Integer arg) {\n" + + " switch(foo) {\n" + + " case String s when s.length() > 5 ->\n" + + " System.out.println(s);\n" + + " }\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = parse(code); + assertEqualsStringIgnoringEol(code, new DefaultPrettyPrinter().print(cu)); + } + + @Test + public void testNestedRecordPattern() { + String code = "class Foo {\n" + "\n" + + " void foo(Integer arg) {\n" + + " switch(foo) {\n" + + " case TwoBox(String s, Box(Integer i)) ->\n" + + " System.out.println(s);\n" + + " }\n" + + " }\n" + + "}\n"; + + CompilationUnit cu = parse(code); + assertEqualsStringIgnoringEol(code, new DefaultPrettyPrinter().print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrinterConfigurationTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrinterConfigurationTest.java new file mode 100644 index 0000000..9b49658 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/PrinterConfigurationTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.printer.configuration.ConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.PrinterConfiguration; +import com.github.javaparser.utils.LineSeparator; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class PrinterConfigurationTest { + + private Optional getOption(PrinterConfiguration config, ConfigOption cOption) { + return config.get(new DefaultConfigurationOption(cOption)); + } + + @Test + void testDefaultConfigurationAndValue() { + PrinterConfiguration config = new DefaultPrinterConfiguration(); + assertTrue(getOption(config, ConfigOption.PRINT_COMMENTS).isPresent()); + assertTrue(getOption(config, ConfigOption.PRINT_JAVADOC).isPresent()); + assertTrue(getOption(config, ConfigOption.SPACE_AROUND_OPERATORS).isPresent()); + assertTrue(getOption(config, ConfigOption.INDENT_CASE_IN_SWITCH).isPresent()); + assertTrue(getOption(config, ConfigOption.MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY) + .isPresent()); + assertTrue(getOption(config, ConfigOption.END_OF_LINE_CHARACTER).isPresent()); + // values + assertEquals( + getOption(config, ConfigOption.MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY) + .get() + .asValue(), + Integer.valueOf(5)); + assertEquals( + getOption(config, ConfigOption.MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY) + .get() + .asValue(), + Integer.valueOf(5)); + assertTrue(getOption(config, ConfigOption.MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY) + .get() + .asValue() + == Integer.valueOf(5)); + assertEquals( + getOption(config, ConfigOption.END_OF_LINE_CHARACTER).get().asString(), + LineSeparator.SYSTEM.asRawString()); + } + + @Test + void testConfigurationError() { + PrinterConfiguration config = new DefaultPrinterConfiguration(); + // verify configuration error case + assertThrows(IllegalArgumentException.class, () -> { + getOption(config, ConfigOption.PRINT_COMMENTS).get().asValue(); + }); + + // verify currentValue assignment: example we cannot assign a string to a boolean + assertThrows(IllegalArgumentException.class, () -> { + config.addOption(new DefaultConfigurationOption(ConfigOption.PRINT_COMMENTS, "1")); + }); + } + + @Test + void testUpdatedConfigurationOption() { + PrinterConfiguration config = new DefaultPrinterConfiguration(); + // change the default currentValue of the MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY option + getOption(config, ConfigOption.MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY) + .get() + .value(2); + // verify the currentValue is updated + assertEquals( + getOption(config, ConfigOption.MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY) + .get() + .asValue(), + Integer.valueOf(2)); + } + + @Test + void testRemoveOption() { + PrinterConfiguration config = new DefaultPrinterConfiguration(); + assertTrue(getOption(config, ConfigOption.PRINT_COMMENTS).isPresent()); + assertTrue(getOption(config, ConfigOption.END_OF_LINE_CHARACTER).isPresent()); + // remove option PRINT_COMMENTS + config.removeOption(new DefaultConfigurationOption(ConfigOption.PRINT_COMMENTS)); + assertFalse(getOption(config, ConfigOption.PRINT_COMMENTS).isPresent()); + // remove option with currentValue + config.removeOption(new DefaultConfigurationOption(ConfigOption.END_OF_LINE_CHARACTER, "\n")); + assertFalse(getOption(config, ConfigOption.END_OF_LINE_CHARACTER).isPresent()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/TestVisitor.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/TestVisitor.java new file mode 100644 index 0000000..54da894 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/TestVisitor.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.printer.configuration.PrinterConfiguration; + +public class TestVisitor extends DefaultPrettyPrinterVisitor { + + public TestVisitor(PrinterConfiguration configuration, SourcePrinter printer) { + super(configuration, printer); + } + + @Override + public void visit(final ClassOrInterfaceDeclaration n, final Void arg) { + printer.print("test"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/XmlPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/XmlPrinterTest.java new file mode 100644 index 0000000..4258fce --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/XmlPrinterTest.java @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static org.junit.jupiter.api.Assertions.fail; + +import com.github.javaparser.ast.expr.Expression; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.Files; +import java.util.HashSet; +import java.util.Set; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +class XmlPrinterTest { + + // Used for building XML documents + private static DocumentBuilderFactory documentBuilderFactory; + private static DocumentBuilder documentBuilder; + + @BeforeAll + public static void setupDocumentBuilder() { + try { + documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setNamespaceAware(true); + documentBuilderFactory.setCoalescing(true); + documentBuilderFactory.setIgnoringElementContentWhitespace(true); + documentBuilderFactory.setIgnoringComments(true); + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + } catch (ParserConfigurationException ex) { + throw new RuntimeException(ex); + } + } + + // Used for serializing XML documents (Necessary only when doing error reporting) + private static TransformerFactory transformerFactory; + private static Transformer transformer; + + @BeforeAll + public static void setupTransformerFactory() { + try { + transformerFactory = TransformerFactory.newInstance(); + transformer = transformerFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + } catch (TransformerConfigurationException ex) { + throw new RuntimeException(ex); + } + } + + /** + * Set of cleanups to be done at the end of each test execution. + */ + private Set cleanupSet; + + /** + * Add given runnable to set of elements to be called. + * + * @param cleanup Object to be called at the end of each test execution + */ + private void onEnd(Cleanup cleanup) { + cleanupSet.add(cleanup); + } + + @BeforeEach + public void clearCleanupSet() { + cleanupSet = new HashSet<>(); + } + + @AfterEach + public void runCleanup() throws Exception { + for (Cleanup cleanup : cleanupSet) { + cleanup.run(); + } + } + + public Document getDocument(String xml) throws SAXException, IOException { + InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); + Document result = documentBuilder.parse(inputStream); + result.normalizeDocument(); + return result; + } + + public String getXML(Document document) throws TransformerException { + StringWriter result = new StringWriter(); // Closing a StringWriter is not needed + transformer.transform(new DOMSource(document), new StreamResult(result)); + return result.toString(); + } + + private File createTempFile() throws IOException { + File result = File.createTempFile("javaparser", "test.xml"); + onEnd(result::delete); // Schedule file deletion at the end of Test + return result; + } + + public void assertXMLEquals(String expected, String actual) throws SAXException, IOException { + final Document expectedDocument = getDocument(expected); + final Document actualDocument = getDocument(actual); + + if (!expectedDocument.isEqualNode(actualDocument)) { + try { + fail(String.format("-- expected:\n%s-- actual:\n%s", getXML(expectedDocument), getXML(actualDocument))); + } catch (TransformerException ex) { + fail( + String.format( + "" + + "expected: <%s>, but it was <%s>\n" + + "Additionally, a TransformerException was raised when trying to report XML document contents", + expected, actual), + ex); + } + } + } + + @Test + void testWithType() throws SAXException, IOException { + Expression expression = parseExpression("1+1"); + XmlPrinter xmlOutput = new XmlPrinter(true); + + String output = xmlOutput.output(expression); + + assertXMLEquals( + "", + output); + } + + @Test + void testWithoutType() throws SAXException, IOException { + Expression expression = parseExpression("1+1"); + + XmlPrinter xmlOutput = new XmlPrinter(false); + + String output = xmlOutput.output(expression); + + assertXMLEquals("", output); + } + + @Test + void testList() throws SAXException, IOException { + Expression expression = parseExpression("a(1,2)"); + + XmlPrinter xmlOutput = new XmlPrinter(true); + + String output = xmlOutput.output(expression); + + assertXMLEquals( + "", + output); + } + + // Demonstrate the use of streaming, without use of temporary strings. + @Test + void testStreamToFile() throws SAXException, IOException, XMLStreamException { + + File tempFile = createTempFile(); + + try (FileWriter fileWriter = new FileWriter(tempFile)) { + XmlPrinter xmlOutput = new XmlPrinter(false); + xmlOutput.outputDocument(parseExpression("1+1"), "root", fileWriter); + } + + assertXMLEquals( + "" + // Expected + + "" + + "" + + "" + + "", + // Actual (Using temporary string for checking results. No one has been used when generating XML) + new String(Files.readAllBytes(tempFile.toPath()))); + } + + @Test + void testCustomXML() throws SAXException, IOException, XMLStreamException { + + StringWriter stringWriter = new StringWriter(); + + XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); + XMLStreamWriter xmlWriter = outputFactory.createXMLStreamWriter(stringWriter); + onEnd(xmlWriter::close); + + XmlPrinter xmlOutput = new XmlPrinter(false); + + xmlWriter.writeStartDocument(); + xmlWriter.writeStartElement("custom"); + + xmlOutput.outputNode(parseExpression("1+1"), "plusExpr", xmlWriter); + xmlOutput.outputNode(parseExpression("a(1,2)"), "callExpr", xmlWriter); + + xmlWriter.writeEndElement(); + xmlWriter.writeEndDocument(); + xmlWriter.close(); + + assertXMLEquals( + "" + // Expected + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "", + // Actual + stringWriter.toString()); + } + + @Test + void testAbsentTypeParameterList() throws SAXException, IOException, XMLStreamException { + Expression expression = parseExpression("new HashSet()"); + XmlPrinter xmlOutput = new XmlPrinter(false); + String output = xmlOutput.output(expression); + assertXMLEquals( + "" + // Expected + + "" + + "" + + "" + + "" + + "", + // Actual + output); + } + + @Test + void testEmptyTypeParameterList() throws SAXException, IOException, XMLStreamException { + Expression expression = parseExpression("new HashSet<>()"); + XmlPrinter xmlOutput = new XmlPrinter(false); + String output = xmlOutput.output(expression); + assertXMLEquals( + "" + // Expected + + "" + + "" + + "" + + "" + + "" + + "", + // Actual + output); + } + + @Test + void testNonEmptyTypeParameterList() throws SAXException, IOException, XMLStreamException { + Expression expression = parseExpression("new HashSet()"); + XmlPrinter xmlOutput = new XmlPrinter(false); + String output = xmlOutput.output(expression); + assertXMLEquals( + "" + // Expected + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "", + // Actual + output); + } +} + +interface Cleanup { + void run() throws Exception; +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/YamlPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/YamlPrinterTest.java new file mode 100644 index 0000000..28b3523 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/YamlPrinterTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static com.github.javaparser.utils.TestUtils.readTextResource; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.Expression; +import org.junit.jupiter.api.Test; + +class YamlPrinterTest { + + private String read(String filename) { + return readTextResource(YamlPrinterTest.class, filename); + } + + @Test + void testWithType() { + YamlPrinter yamlPrinter = new YamlPrinter(true); + Expression expression = parseExpression("x(1,1)"); + String output = yamlPrinter.output(expression); + assertEqualsStringIgnoringEol(read("yamlWithType.yaml"), output); + } + + @Test + void testWithoutType() { + YamlPrinter yamlPrinter = new YamlPrinter(false); + Expression expression = parseExpression("1+1"); + String output = yamlPrinter.output(expression); + assertEqualsStringIgnoringEol(read("yamlWithoutType.yaml"), output); + } + + @Test + void testWithColonFollowedBySpaceInValue() { + YamlPrinter yamlPrinter = new YamlPrinter(true); + Expression expression = parseExpression("\"a\\\\: b\""); + String output = yamlPrinter.output(expression); + assertEqualsStringIgnoringEol(read("yamlWithColonFollowedBySpaceInValue.yaml"), output); + } + + @Test + void testWithColonFollowedByLineSeparatorInValue() { + YamlPrinter yamlPrinter = new YamlPrinter(true); + Expression expression = parseExpression("\"a\\\\:\\\\nb\""); + String output = yamlPrinter.output(expression); + assertEqualsStringIgnoringEol(read("yamlWithColonFollowedByLineSeparatorInValue.yaml"), output); + } + + @Test + void testParsingJavadocWithQuoteAndNewline() { + String code = "/**\n" + " * \" this comment contains a quote and newlines\n" + " */\n" + "public class Dog {}"; + + YamlPrinter yamlPrinter = new YamlPrinter(true); + CompilationUnit computationUnit = parse(code); + String output = yamlPrinter.output(computationUnit); + assertEqualsStringIgnoringEol(read("yamlParsingJavadocWithQuoteAndNewline.yaml"), output); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/DefaultImportOrderingStrategyTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/DefaultImportOrderingStrategyTest.java new file mode 100644 index 0000000..4b749bd --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/DefaultImportOrderingStrategyTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.configuration.imports; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.NodeList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class DefaultImportOrderingStrategyTest { + + private final DefaultImportOrderingStrategy strategy = new DefaultImportOrderingStrategy(); + + @Test + void sortImports_givenNoImports_ThenNoImports_ShouldBeReturned() { + List> actual = strategy.sortImports(new NodeList<>()); + assertEquals(1, actual.size()); + assertEquals(0, actual.get(0).size()); + } + + @Test + void sortImports_givenImports_ThenImportsShouldBeInCorrectLocation() { + + NodeList imports = new NodeList<>(); + imports.add(new ImportDeclaration("org.junit.jupiter.api.Assertions.assertEquals", true, false)); + imports.add(new ImportDeclaration("java.util.List", false, false)); + imports.add(new ImportDeclaration("com.example.Test", false, false)); + + List> actual = strategy.sortImports(imports); + assertEquals(1, actual.size()); + + NodeList actualImports = actual.get(0); + + assertEquals(3, actualImports.size()); + assertEquals( + "org.junit.jupiter.api.Assertions.assertEquals", + actualImports.get(0).getNameAsString()); + assertEquals("java.util.List", actualImports.get(1).getNameAsString()); + assertEquals("com.example.Test", actualImports.get(2).getNameAsString()); + } + + @Test + void sortImports_givenUnsortedImportsAndSortingIsTrue_ThenImportsShouldBeSorted() { + NodeList imports = new NodeList<>(); + imports.add(new ImportDeclaration("com.example.B", false, false)); + imports.add(new ImportDeclaration("com.example.A", false, false)); + + strategy.setSortImportsAlphabetically(true); + + List> actual = strategy.sortImports(imports); + assertEquals(1, actual.size()); + + NodeList actualImports = actual.get(0); + + assertEquals(2, actualImports.size()); + assertEquals("com.example.A", actualImports.get(0).getNameAsString()); + assertEquals("com.example.B", actualImports.get(1).getNameAsString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/EclipseImportOrderingStrategyTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/EclipseImportOrderingStrategyTest.java new file mode 100644 index 0000000..6aa2328 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/EclipseImportOrderingStrategyTest.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.configuration.imports; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.NodeList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class EclipseImportOrderingStrategyTest { + + private final EclipseImportOrderingStrategy strategy = new EclipseImportOrderingStrategy(); + + @Test + void sortImports_givenNoImports_ThenNoImports_ShouldBeReturned() { + List> actual = strategy.sortImports(new NodeList<>()); + assertEquals(6, actual.size()); + assertEquals(0, actual.get(0).size()); + assertEquals(0, actual.get(1).size()); + assertEquals(0, actual.get(2).size()); + assertEquals(0, actual.get(3).size()); + assertEquals(0, actual.get(4).size()); + assertEquals(0, actual.get(5).size()); + } + + @Test + void sortImports_givenImports_ThenImportsShouldBeInCorrectLocation() { + + NodeList imports = new NodeList<>(); + imports.add(new ImportDeclaration("org.junit.jupiter.api.Assertions.assertEquals", true, false)); + imports.add(new ImportDeclaration("org.junit.jupiter.api.Assertions", false, false)); + imports.add(new ImportDeclaration("java.util.List", false, false)); + imports.add(new ImportDeclaration("javax.swing", false, true)); + imports.add(new ImportDeclaration("com.example.Test", false, false)); + imports.add(new ImportDeclaration("pt.example.OtherTest", false, false)); + + List> actual = strategy.sortImports(imports); + assertEquals(6, actual.size()); + + assertEquals(1, actual.get(0).size()); + assertEquals( + "org.junit.jupiter.api.Assertions.assertEquals", + actual.get(0).get(0).getNameAsString()); + + assertEquals(1, actual.get(1).size()); + assertEquals("java.util.List", actual.get(1).get(0).getNameAsString()); + + assertEquals(1, actual.get(2).size()); + assertEquals("javax.swing", actual.get(2).get(0).getNameAsString()); + + assertEquals(1, actual.get(3).size()); + assertEquals("org.junit.jupiter.api.Assertions", actual.get(3).get(0).getNameAsString()); + + assertEquals(1, actual.get(4).size()); + assertEquals("com.example.Test", actual.get(4).get(0).getNameAsString()); + + assertEquals(1, actual.get(5).size()); + assertEquals("pt.example.OtherTest", actual.get(5).get(0).getNameAsString()); + } + + @Test + void sortImports_givenUnsortedImportsAndSortingIsTrue_ThenImportsShouldBeSorted() { + NodeList imports = new NodeList<>(); + imports.add(new ImportDeclaration("com.example.B", false, false)); + imports.add(new ImportDeclaration("com.example.A", false, false)); + + strategy.setSortImportsAlphabetically(true); + + List> actual = strategy.sortImports(imports); + assertEquals(6, actual.size()); + + assertEquals(0, actual.get(0).size()); + assertEquals(0, actual.get(1).size()); + assertEquals(0, actual.get(2).size()); + assertEquals(0, actual.get(3).size()); + assertEquals(2, actual.get(4).size()); + assertEquals("com.example.A", actual.get(4).get(0).getNameAsString()); + assertEquals("com.example.B", actual.get(4).get(1).getNameAsString()); + assertEquals(0, actual.get(5).size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/IntelliJImportOrderingStrategyTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/IntelliJImportOrderingStrategyTest.java new file mode 100644 index 0000000..b42657a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/configuration/imports/IntelliJImportOrderingStrategyTest.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.configuration.imports; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.NodeList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class IntelliJImportOrderingStrategyTest { + + private final IntelliJImportOrderingStrategy strategy = new IntelliJImportOrderingStrategy(); + + @Test + void sortImports_givenNoImports_ThenNoImports_ShouldBeReturned() { + List> actual = strategy.sortImports(new NodeList<>()); + assertEquals(3, actual.size()); + assertEquals(0, actual.get(0).size()); + assertEquals(0, actual.get(1).size()); + assertEquals(0, actual.get(2).size()); + } + + @Test + void sortImports_givenImports_ThenImportsShouldBeInCorrectLocation() { + + NodeList imports = new NodeList<>(); + imports.add(new ImportDeclaration("org.junit.jupiter.api.Assertions.assertEquals", true, false)); + imports.add(new ImportDeclaration("java.util.List", false, false)); + imports.add(new ImportDeclaration("com.example.Test", false, false)); + + List> actual = strategy.sortImports(imports); + assertEquals(3, actual.size()); + + assertEquals(1, actual.get(0).size()); + assertEquals("com.example.Test", actual.get(0).get(0).getNameAsString()); + + assertEquals(1, actual.get(1).size()); + assertEquals("java.util.List", actual.get(1).get(0).getNameAsString()); + + assertEquals(1, actual.get(2).size()); + assertEquals( + "org.junit.jupiter.api.Assertions.assertEquals", + actual.get(2).get(0).getNameAsString()); + } + + @Test + void sortImports_givenUnsortedImportsAndSortingIsTrue_ThenImportsShouldBeSorted() { + NodeList imports = new NodeList<>(); + imports.add(new ImportDeclaration("com.example.B", false, false)); + imports.add(new ImportDeclaration("com.example.A", false, false)); + + strategy.setSortImportsAlphabetically(true); + + List> actual = strategy.sortImports(imports); + assertEquals(3, actual.size()); + + assertEquals(2, actual.get(0).size()); + assertEquals("com.example.A", actual.get(0).get(0).getNameAsString()); + assertEquals("com.example.B", actual.get(0).get(1).getNameAsString()); + assertEquals(0, actual.get(1).size()); + assertEquals(0, actual.get(2).size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/AbstractLexicalPreservingTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/AbstractLexicalPreservingTest.java new file mode 100644 index 0000000..c47218a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/AbstractLexicalPreservingTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsString; +import static com.github.javaparser.utils.TestUtils.readResource; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.stmt.Statement; +import java.io.IOException; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; + +public abstract class AbstractLexicalPreservingTest { + + protected CompilationUnit cu; + protected Expression expression; + protected Statement statement; + + @AfterAll + public static void tearDown() {} + + @AfterEach + public void reset() { + StaticJavaParser.setConfiguration(new ParserConfiguration()); + } + + protected void considerCode(String code) { + cu = LexicalPreservingPrinter.setup(StaticJavaParser.parse(code)); + } + + protected void considerExpression(String code) { + expression = LexicalPreservingPrinter.setup(StaticJavaParser.parseExpression(code)); + } + + protected void considerStatement(String code) { + statement = LexicalPreservingPrinter.setup(StaticJavaParser.parseStatement(code)); + } + + protected void considerVariableDeclaration(String code) { + expression = LexicalPreservingPrinter.setup(StaticJavaParser.parseVariableDeclarationExpr(code)); + } + + protected String considerExample(String resourceName) throws IOException { + String code = readExample(resourceName); + considerCode(code); + return code; + } + + protected String readExample(String resourceName) throws IOException { + return readResource("com/github/javaparser/lexical_preservation_samples/" + resourceName + ".java.txt"); + } + + protected void assertTransformed(String exampleName, Node node) throws IOException { + String expectedCode = readExample(exampleName + "_expected"); + String actualCode = LexicalPreservingPrinter.print(node); + + // Note that we explicitly care about line endings when handling lexical preservation. + assertEqualsString(expectedCode, actualCode); + } + + protected void assertUnchanged(String exampleName) throws IOException { + String expectedCode = considerExample(exampleName + "_original"); + String actualCode = LexicalPreservingPrinter.print(cu != null ? cu : expression); + + // Note that we explicitly care about line endings when handling lexical preservation. + assertEqualsString(expectedCode, actualCode); + } + + protected void assertTransformedToString(String expectedPartialCode, Node node) { + String actualCode = LexicalPreservingPrinter.print(node); + + // Note that we explicitly care about line endings when handling lexical preservation. + assertEqualsString(expectedPartialCode, actualCode); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/AnnotationSpaceTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/AnnotationSpaceTest.java new file mode 100644 index 0000000..1d2ffb0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/AnnotationSpaceTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.expr.MarkerAnnotationExpr; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class AnnotationSpaceTest extends AbstractLexicalPreservingTest { + /** Tests that inserted annotations on types are followed by a space. */ + @Test + public void test() { + considerCode("public class Foo {\n" + " void myMethod(String param);\n" + "}"); + // Insert the annotation onto the String parameter type. + Optional type = cu.findFirst(ClassOrInterfaceType.class); + type.get().addAnnotation(new MarkerAnnotationExpr("Nullable")); + String result = LexicalPreservingPrinter.print(cu); + // Verify that there's a space between the annotation and the String type. + assertTrue(result.contains("@Nullable String")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/DifferenceElementCalculatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/DifferenceElementCalculatorTest.java new file mode 100644 index 0000000..dfe1e6c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/DifferenceElementCalculatorTest.java @@ -0,0 +1,511 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.TokenTypes.eolTokenKind; +import static com.github.javaparser.TokenTypes.spaceTokenKind; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static com.github.javaparser.printer.lexicalpreservation.DifferenceElement.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.GeneratedJavaParserConstants; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.ArrayType; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.printer.ConcreteSyntaxModel; +import com.github.javaparser.printer.concretesyntaxmodel.CsmElement; +import com.github.javaparser.printer.concretesyntaxmodel.CsmIndent; +import com.github.javaparser.printer.concretesyntaxmodel.CsmToken; +import com.github.javaparser.printer.concretesyntaxmodel.CsmUnindent; +import com.github.javaparser.printer.lexicalpreservation.LexicalDifferenceCalculator.CsmChild; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.junit.jupiter.api.Test; + +class DifferenceElementCalculatorTest extends AbstractLexicalPreservingTest { + + @Test + void calculateDifferenceEmpty() { + LexicalDifferenceCalculator.CalculatedSyntaxModel a = + new LexicalDifferenceCalculator.CalculatedSyntaxModel(Collections.emptyList()); + LexicalDifferenceCalculator.CalculatedSyntaxModel b = + new LexicalDifferenceCalculator.CalculatedSyntaxModel(Collections.emptyList()); + List differenceElements = DifferenceElementCalculator.calculate(a, b); + assertEquals(0, differenceElements.size()); + } + + @Test + void calculateDifferenceAIsEmpty() { + Node n1 = new FieldDeclaration(); + Node n2 = new MethodDeclaration(); + + LexicalDifferenceCalculator.CalculatedSyntaxModel a = + new LexicalDifferenceCalculator.CalculatedSyntaxModel(Collections.emptyList()); + LexicalDifferenceCalculator.CalculatedSyntaxModel b = + new LexicalDifferenceCalculator.CalculatedSyntaxModel(Arrays.asList( + new CsmToken(GeneratedJavaParserConstants.LPAREN), + new CsmChild(n1), + new CsmToken(GeneratedJavaParserConstants.RPAREN), + new CsmChild(n2))); + List differenceElements = DifferenceElementCalculator.calculate(a, b); + assertEquals(4, differenceElements.size()); + assertEquals(added(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(0)); + assertEquals(added(new CsmChild(n1)), differenceElements.get(1)); + assertEquals(added(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(2)); + assertEquals(added(new CsmChild(n2)), differenceElements.get(3)); + } + + @Test + void calculateDifferenceBIsEmpty() { + Node n1 = new FieldDeclaration(); + Node n2 = new MethodDeclaration(); + + LexicalDifferenceCalculator.CalculatedSyntaxModel a = + new LexicalDifferenceCalculator.CalculatedSyntaxModel(Arrays.asList( + new CsmToken(GeneratedJavaParserConstants.LPAREN), + new CsmChild(n1), + new CsmToken(GeneratedJavaParserConstants.RPAREN), + new CsmChild(n2))); + LexicalDifferenceCalculator.CalculatedSyntaxModel b = + new LexicalDifferenceCalculator.CalculatedSyntaxModel(Collections.emptyList()); + List differenceElements = DifferenceElementCalculator.calculate(a, b); + assertEquals(4, differenceElements.size()); + assertEquals(removed(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(0)); + assertEquals(removed(new CsmChild(n1)), differenceElements.get(1)); + assertEquals(removed(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(2)); + assertEquals(removed(new CsmChild(n2)), differenceElements.get(3)); + } + + @Test + void compilationUnitExampleWithPackageSetDiff() { + considerCode("class A {}"); + CsmElement element = ConcreteSyntaxModel.forClass(cu.getClass()); + PackageDeclaration packageDeclaration = new PackageDeclaration(new Name(new Name("foo"), "bar")); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, cu); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, cu, ObservableProperty.PACKAGE_DECLARATION, null, packageDeclaration); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + assertEquals(3, differenceElements.size()); + assertEquals(added(new CsmChild(packageDeclaration)), differenceElements.get(0)); + assertEquals(kept(new CsmChild(cu.getType(0))), differenceElements.get(1)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(2)); + } + + @Test + void annotationDeclarationExampleWithModifierAdded() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, + annotationDeclaration, + ObservableProperty.MODIFIERS, + new NodeList<>(), + createModifierList(PUBLIC)); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + DifferenceElementCalculator.removeIndentationElements(differenceElements); + int i = 0; + assertEquals(added(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(added(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.AT)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.INTERFACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LBRACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(0))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(1))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(2))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(3))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(4))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(5))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RBRACE)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void annotationDeclarationExampleWithNameChanged() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + SimpleName newName = new SimpleName("NewName"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, + annotationDeclaration, + ObservableProperty.NAME, + annotationDeclaration.getName(), + newName); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + DifferenceElementCalculator.removeIndentationElements(differenceElements); + int i = 0; + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.AT)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.INTERFACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(removed(new CsmChild(annotationDeclaration.getName())), differenceElements.get(i++)); + assertEquals(added(new CsmChild(newName)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LBRACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(0))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(1))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(2))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(3))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(4))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(5))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RBRACE)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void annotationDeclarationExampleWithJavadocAdded() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + JavadocComment comment = new JavadocComment("Cool this annotation!"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, annotationDeclaration, ObservableProperty.COMMENT, null, comment); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + DifferenceElementCalculator.removeIndentationElements(differenceElements); + int i = 0; + assertEquals(kept(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.AT)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.INTERFACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LBRACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(0))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(1))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(2))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(3))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(4))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(5))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RBRACE)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void annotationDeclarationExampleWithJavadocRemoved() throws IOException { + considerExample("AnnotationDeclaration_Example9_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, + annotationDeclaration, + ObservableProperty.COMMENT, + annotationDeclaration.getComment().get(), + null); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + DifferenceElementCalculator.removeIndentationElements(differenceElements); + int i = 0; + assertEquals(kept(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.AT)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.INTERFACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LBRACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(0))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(1))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(2))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(3))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(4))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(5))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RBRACE)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void annotationDeclarationExampleWithModifierRemoved() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, + annotationDeclaration, + ObservableProperty.MODIFIERS, + createModifierList(PUBLIC), + new NodeList<>()); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + DifferenceElementCalculator.removeIndentationElements(differenceElements); + int i = 0; + assertEquals(removed(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(removed(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.AT)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.INTERFACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LBRACE)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(0))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(1))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(2))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(3))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(4))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(annotationDeclaration.getMember(5))), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RBRACE)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void removeDefaultValueInAnnotationMemberDeclaration() { + AnnotationMemberDeclaration md = considerAmd("int foo() default 10;"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(md); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + md, ObservableProperty.DEFAULT_VALUE, md.getDefaultValue(), null); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals(kept(new CsmChild(md.getType())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(md.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(i++)); + assertEquals(removed(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(removed(new CsmToken(GeneratedJavaParserConstants._DEFAULT)), differenceElements.get(i++)); + assertEquals(removed(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(removed(new CsmChild(md.getDefaultValue().get())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.SEMICOLON)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void addedDefaultValueInAnnotationMemberDeclaration() { + AnnotationMemberDeclaration md = considerAmd("int foo();"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(md); + Expression defaultValue = new IntegerLiteralExpr(("10")); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange(md, ObservableProperty.DEFAULT_VALUE, null, defaultValue); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals(kept(new CsmChild(md.getType())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(md.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(i++)); + assertEquals(added(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(added(new CsmToken(GeneratedJavaParserConstants._DEFAULT)), differenceElements.get(i++)); + assertEquals(added(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(added(new CsmChild(defaultValue)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.SEMICOLON)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void addedModifierToConstructorDeclaration() { + ConstructorDeclaration cd = considerCd("A(){}"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(cd); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + cd, ObservableProperty.MODIFIERS, new NodeList<>(), createModifierList(PUBLIC)); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals(added(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(added(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(cd.getName())), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(i++)); + assertEquals(kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(kept(new CsmChild(cd.getBody())), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void replacingNameForEnumConstantDeclaration() { + EnumConstantDeclaration ecd = considerEcd("A"); + SimpleName newName = new SimpleName("B"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(ecd); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange(ecd, ObservableProperty.NAME, ecd.getName(), newName); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals(DifferenceElement.removed(new CsmChild(ecd.getName())), differenceElements.get(i++)); + assertEquals(DifferenceElement.added(new CsmChild(newName)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void addingStatementToEmptyMethodBody() { + String code = "class A { void foo(char p1, int p2) {} }"; + considerCode(code); + + Statement s = new ExpressionStmt( + new BinaryExpr(new IntegerLiteralExpr("10"), new IntegerLiteralExpr("2"), BinaryExpr.Operator.PLUS)); + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = new LexicalDifferenceCalculator() + .calculatedSyntaxModelForNode(m.getBody().get()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterListAddition(m.getBody().get(), ObservableProperty.STATEMENTS, 0, s); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals( + DifferenceElement.kept(new CsmToken(GeneratedJavaParserConstants.LBRACE)), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.added(new CsmIndent()), differenceElements.get(i++)); + assertEquals(DifferenceElement.added(new CsmChild(s)), differenceElements.get(i++)); + assertEquals(DifferenceElement.added(new CsmToken(eolTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.added(new CsmUnindent()), differenceElements.get(i++)); + assertEquals( + DifferenceElement.kept(new CsmToken(GeneratedJavaParserConstants.RBRACE)), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void methodDeclarationRemovingParameter() { + MethodDeclaration md = considerMd("public void foo(float f){}"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(md); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterListRemoval(md, ObservableProperty.PARAMETERS, 0); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals(DifferenceElement.kept(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmChild(md.getType())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmChild(md.getName())), differenceElements.get(i++)); + assertEquals( + DifferenceElement.kept(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(i++)); + assertEquals(DifferenceElement.removed(new CsmChild(md.getParameter(0))), differenceElements.get(i++)); + assertEquals( + DifferenceElement.kept(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmChild(md.getBody().get())), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + @Test + void methodDeclarationAddingParameter() { + MethodDeclaration md = considerMd("public void foo(){}"); + Parameter newParameter = new Parameter(new ArrayType(PrimitiveType.intType()), new SimpleName("foo")); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(md); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterListAddition(md, ObservableProperty.PARAMETERS, 0, newParameter); + List differenceElements = DifferenceElementCalculator.calculate(csmOriginal, csmChanged); + int i = 0; + assertEquals(DifferenceElement.kept(new CsmChild(Modifier.publicModifier())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmChild(md.getType())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmChild(md.getName())), differenceElements.get(i++)); + assertEquals( + DifferenceElement.kept(new CsmToken(GeneratedJavaParserConstants.LPAREN)), differenceElements.get(i++)); + assertEquals(DifferenceElement.added(new CsmChild(newParameter)), differenceElements.get(i++)); + assertEquals( + DifferenceElement.kept(new CsmToken(GeneratedJavaParserConstants.RPAREN)), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmToken(spaceTokenKind())), differenceElements.get(i++)); + assertEquals(DifferenceElement.kept(new CsmChild(md.getBody().get())), differenceElements.get(i++)); + assertEquals(i, differenceElements.size()); + } + + private AnnotationMemberDeclaration considerAmd(String code) { + considerCode("@interface AD { " + code + " }"); + return (AnnotationMemberDeclaration) + cu.getAnnotationDeclarationByName("AD").get().getMember(0); + } + + private ConstructorDeclaration considerCd(String code) { + considerCode("class A { " + code + " }"); + return (ConstructorDeclaration) cu.getType(0).getMembers().get(0); + } + + private EnumConstantDeclaration considerEcd(String code) { + considerCode("enum A { " + code + " }"); + return ((EnumDeclaration) cu.getType(0)).getEntries().get(0); + } + + private MethodDeclaration considerMd(String code) { + considerCode("class A { " + code + " }"); + return (MethodDeclaration) cu.getType(0).getMembers().get(0); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1467Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1467Test.java new file mode 100644 index 0000000..6077c3e --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1467Test.java @@ -0,0 +1,66 @@ +package com.github.javaparser.printer.lexicalpreservation; + +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.ast.Modifier.Keyword; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.ThrowStmt; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Test; + +public class Issue1467Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + considerCode("public class Bar {\n" + " public void foo() {\n" + + " System.out.print(\"Hello\");\n" + + " }\n" + + "}"); + String expected = "public void f() {\n" + + " throw new UnsupportedOperationException(\"Not supported yet.\");\n" + " }"; + // add method declaration + MethodDeclaration decl = + cu.getChildNodesByType(ClassOrInterfaceDeclaration.class).get(0).addMethod("f", Keyword.PUBLIC); + // create body + BlockStmt body = new BlockStmt(); + NodeList statements = new NodeList<>(); + ObjectCreationExpr exception = new ObjectCreationExpr(); + exception.setType("UnsupportedOperationException"); + NodeList arguments = new NodeList<>(); + arguments.add(new StringLiteralExpr("Not supported yet.")); + exception.setArguments(arguments); + statements.add(new ThrowStmt(exception)); + body.setStatements(statements); + // set body to the method declaration + decl.setBody(body); + // print the result from LexicalPreservingPrinter + String actual = LexicalPreservingPrinter.print(decl); + TestUtils.assertEqualsStringIgnoringEol(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1634Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1634Test.java new file mode 100644 index 0000000..83fbe04 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1634Test.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.NodeList; +import org.junit.jupiter.api.Test; + +public class Issue1634Test extends AbstractLexicalPreservingTest { + + @Test + public void testWithLexicalPreservationEnabled() { + + considerCode("package com.wangym.test;\nclass A{ }"); + + String expected = "package com.wangym.test;\n" + "import lombok.Data;\n" + "\n" + "class A{ }"; + + NodeList imports = cu.getImports(); + String str = "lombok.Data"; + imports.add(new ImportDeclaration(str, false, false)); + + assertEquals(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1766Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1766Test.java new file mode 100644 index 0000000..1e7984a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1766Test.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Test; + +public class Issue1766Test extends AbstractLexicalPreservingTest { + + @Test + public void testWithLexicalPreservationEnabled() { + + considerCode("public class SimpleTestClass {\n" + " public SimpleTestClass() {\n" + + " // nothing\n" + + " }\n" + + " @Override\n" + + " void bubber() {\n" + + " // nothing\n" + + " }\n" + + "}"); + + String expected = "public class SimpleTestClass {\n" + " public SimpleTestClass() {\n" + + " // nothing\n" + + " }\n" + + " @Override\n" + + " void bubber() {\n" + + " // nothing\n" + + " }\n" + + "}"; + + TestUtils.assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + @Test + public void testWithLexicalPreservingPrinterSetup() { + + considerCode("public class SimpleTestClass {\n" + " public SimpleTestClass() {\n" + + " // nothing\n" + + " }\n" + + " @Override\n" + + " void bubber() {\n" + + " // nothing\n" + + " }\n" + + "}"); + + String expected = "public class SimpleTestClass {\n" + " public SimpleTestClass() {\n" + + " // nothing\n" + + " }\n" + + " @Override\n" + + " void bubber() {\n" + + " // nothing\n" + + " }\n" + + "}"; + + TestUtils.assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1793Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1793Test.java new file mode 100644 index 0000000..f8cd197 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue1793Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2015-2016 Federico Tomassetti + * Copyright (C) 2017-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +class Issue1793Test extends AbstractLexicalPreservingTest { + + @AfterEach + public void reset() { + StaticJavaParser.setConfiguration(new ParserConfiguration()); + } + + @Test + void importIsAddedOnTheSameLine() { + considerCode("public class Test {\n" + " public void foo(Bar x, Bar y) {\n" + + " x.barf(); // expected to be wrapped\n" + + " x.bark(); // expected to be wrapped\n" + + " y.barf(); // expected to be wrapped\n" + + " y.bark(); // expected to be wrapped\n" + + " }\n" + + "}"); + assertEquals(LexicalPreservingPrinter.print(cu), LexicalPreservingPrinter.print(cu.clone())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2137Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2137Test.java new file mode 100755 index 0000000..0ac50a0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2137Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.type.VoidType; +import org.junit.jupiter.api.Test; + +public class Issue2137Test extends AbstractLexicalPreservingTest { + + @Test + void test2137() { + considerCode("public class Foo {\n" + " void mymethod1() {}\n" + " void mymethod2() {}\n" + "}"); + String expected = "public class Foo {\n" + " void mymethod1() {}\n" + + " void mymethod3() {\n" + + " }\n" + + " \n" + + " void mymethod2() {}\n" + + "}"; + ClassOrInterfaceDeclaration cid = cu.getClassByName("Foo").get(); + MethodDeclaration methodDeclaration = new MethodDeclaration(); + methodDeclaration.setName("mymethod3"); + methodDeclaration.setType(new VoidType()); + cid.getMembers().add(1, methodDeclaration); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2290Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2290Test.java new file mode 100644 index 0000000..db875d3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2290Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.stmt.ExpressionStmt; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class Issue2290Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + + considerCode("public class Clone1 {\n" + " public static void main(String[] args) {\n" + + " System.out.println(\"I'm a clone10\");\n" + + " System.out.println(\"I'm not a clone!\");\n" + + " System.out.println(\"I'm a clone10\");\n" + + " }\n" + + "}"); + List exprs = cu.findAll(ExpressionStmt.class); + ExpressionStmt es = exprs.get(exprs.size() - 1); + es.getParentNode().get().remove(es); + exprs = cu.findAll(ExpressionStmt.class); + // verify that one statement is removed + assertTrue(exprs.size() == 2); + // verify that the first statement is not removed + assertEquals("System.out.println(\"I'm a clone10\");", exprs.get(0).toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2374Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2374Test.java new file mode 100644 index 0000000..ae8994f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2374Test.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.Statement; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class Issue2374Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + String lineComment = "Example comment"; + considerCode("public class Bar {\n" + " public void foo() {\n" + + " System.out.print(\"Hello\");\n" + + " }\n" + + "}"); + String expected = "public class Bar {\n" + + " public void foo() {\n" + + " System.out.print(\"Hello\");\n" + + " //Example comment\n" + + " System.out.println(\"World!\");\n" + + " }\n" + + "}"; + // contruct a statement with a comment + Statement stmt = StaticJavaParser.parseStatement("System.out.println(\"World!\");"); + stmt.setLineComment(lineComment); + // add the statement to the ast + Optional md = cu.findFirst(MethodDeclaration.class); + md.get().getBody().get().addStatement(stmt); + // print the result from LexicalPreservingPrinter + String result = LexicalPreservingPrinter.print(cu); + // verify that the LexicalPreservingPrinter don't forget the comment + assertEqualsStringIgnoringEol(expected, result); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2393Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2393Test.java new file mode 100644 index 0000000..ae033e7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2393Test.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.stmt.IfStmt; +import org.junit.jupiter.api.Test; + +public class Issue2393Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + considerCode("public class Test { public void foo() { int i = 0;\nif(i == 5) { System.out.println(i); } } }"); + IfStmt ifStmt = cu.findFirst(IfStmt.class).orElseThrow(() -> new IllegalStateException("Expected if")); + ifStmt.setCondition(StaticJavaParser.parseExpression("i > 0")); + assertEquals("i > 0", ifStmt.getCondition().toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2517Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2517Test.java new file mode 100755 index 0000000..9168d73 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2517Test.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import org.junit.jupiter.api.Test; + +public class Issue2517Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + + considerCode("public class A {\n" + " public A(String a , String b) {\n" + + " }\n" + + " public static A m() {\n" + + " return new A(\"a\",\"b\");\n" + + " }\n" + + "}"); + + String expected = "public class A {\n" + " public A(String a , String b) {\n" + + " }\n" + + " public static A m() {\n" + + " return new A(\"b\", \"a\");\n" + + " }\n" + + "}"; + + ObjectCreationExpr cd = cu.findFirst(ObjectCreationExpr.class).get(); + NodeList args = cd.getArguments(); + Expression a1 = args.get(0); + Expression a2 = args.get(1); + NodeList newArgs = new NodeList<>(a2, a1); + cd.setArguments(newArgs); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2592Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2592Test.java new file mode 100644 index 0000000..abaaf0b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2592Test.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.SimpleName; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class Issue2592Test extends AbstractLexicalPreservingTest { + + @Test + public void testLPP() { + + considerCode("public class A {" + " public void m(final int a_original, int b) {" + " }" + "} "); + Optional md = cu.findFirst(MethodDeclaration.class); + // all parameters have parent nodes here + assertTrue(md.get().getParameters().stream() + .allMatch(p -> p.getParentNode().isPresent())); + + // all parameters have parent nodes here + assertTrue(md.get().getParameters().stream() + .allMatch(p -> p.getParentNode().isPresent())); + + // add a third parameter + md.get().addParameter("String", "c_brand_new"); + + // seems like we can add a parameter fine (and all of the parents still assigned) + assertTrue(md.get().getParameters().stream() + .allMatch(p -> p.getParentNode().isPresent())); + + // md.get().getParameters().forEach(p -> System.out.println(p + " parent " + + // p.getParentNode().isPresent())); + Parameter p1 = md.get().getParameter(0); + Parameter p2 = new Parameter(p1.getModifiers(), p1.getType(), new SimpleName("a_renamed")); + + // here we replace a parameter + boolean isReplaced = md.get().replace(p1, p2); + assertTrue(isReplaced); // the replacement seemed to work + + // ...however when we replaced the parent nodes (for the replaced node AND the added node (after the replaced + // node) now null + // md.get().getParameters().forEach(p -> System.out.println(p + " parent " + + // p.getParentNode().isPresent())); + assertTrue(md.get().getParameters().stream() + .allMatch(p -> p.getParentNode().isPresent())); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2610Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2610Test.java new file mode 100644 index 0000000..ed0ab5d --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2610Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.MethodCallExpr; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class Issue2610Test extends AbstractLexicalPreservingTest { + + /* + * This test case must prevent an UnsupportedOperation Removed throwed by LexicalPreservation when we try to replace an expression + */ + @Test + public void test() { + + considerCode("public class Bar {\n" + " public void foo() {\n" + + " // comment\n" + + " System.out.print(\"error\");\n" + + " }\n" + + "}"); + // contruct a statement with a comment + Expression expr = StaticJavaParser.parseExpression("System.out.println(\"warning\")"); + // Replace the method expression + Optional mce = cu.findFirst(MethodCallExpr.class); + mce.get().getParentNode().get().replace(mce.get(), expr); + // TODO assert something + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2620Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2620Test.java new file mode 100644 index 0000000..760e7fa --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2620Test.java @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.utils.LineSeparator; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class Issue2620Test extends AbstractLexicalPreservingTest { + + @Test + public void testWithCr() { + doTest(LineSeparator.CR); + } + + @Test + public void testWithLf() { + doTest(LineSeparator.LF); + } + + @Test + public void testWithCrLf() { + doTest(LineSeparator.CRLF); + } + + /* + * This test case must prevent an UnsupportedOperation Removed throwed by LexicalPreservation when we try to replace an expression + */ + public void doTest(LineSeparator eol) { + + considerCode("" + " public class Foo { //comment" + + eol + " private String a;" + + eol + " private String b;" + + eol + " private String c;" + + eol + " private String d;" + + eol + " }"); + + // Note: Expect the platform's EOL character when printing + // FIXME: Indentation is bad here. + String expected = "" + " public class Foo { //comment" + + eol + " private String newField;" + + eol + " " + + eol + " private String a;" + + eol + " private String b;" + + eol + " private String c;" + + eol + " private String d;" + + eol + " }"; + + // create a new field declaration + VariableDeclarator variable = new VariableDeclarator(new ClassOrInterfaceType("String"), "newField"); + FieldDeclaration fd = new FieldDeclaration(new NodeList(Modifier.privateModifier()), variable); + Optional cd = cu.findFirst(ClassOrInterfaceDeclaration.class); + + // add the new variable + cd.get().getMembers().addFirst(fd); + + // should be printed like this + // System.out.println("\n\nOriginal:\n" + original); + // System.out.println("\n\nExpected:\n" + expected); + + // but the result is + final String actual = LexicalPreservingPrinter.print(cu); + // System.out.println("\n\nActual:\n" + actual); + + LineSeparator detectedLineSeparator = LineSeparator.detect(actual); + + assertFalse(detectedLineSeparator.equals(LineSeparator.MIXED)); + assertEquals(eol.asEscapedString(), detectedLineSeparator.asEscapedString()); + + assertEquals(normaliseNewlines(expected), normaliseNewlines(actual)); + + // Commented out until #2661 is fixed (re: EOL characters of injected code) + assertEqualsStringIgnoringEol(escapeNewlines(expected), escapeNewlines(actual)); + assertEquals(expected, actual, "Failed due to EOL differences."); + } + + private String escapeNewlines(String input) { + return input.replaceAll("\\r", "\\\\r").replaceAll("\\n", "\\\\n"); + } + + private String normaliseNewlines(String input) { + return input.replaceAll("\\r\\n|\\r|\\n", "\\\\n"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2806Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2806Test.java new file mode 100644 index 0000000..da220d8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue2806Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2015-2016 Federico Tomassetti + * Copyright (C) 2017-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.ImportDeclaration; +import org.junit.jupiter.api.Test; + +class Issue2806Test extends AbstractLexicalPreservingTest { + + private JavaParser javaParser; + + @Test + void importIsAddedOnTheSameLine() { + considerCode("import java.lang.IllegalArgumentException;\n" + "\n" + "public class A {\n" + "}"); + String junit5 = "import java.lang.IllegalArgumentException;\n" + "import java.nio.file.Paths;\n" + + "\n" + + "public class A {\n" + + "}"; + ImportDeclaration importDeclaration = new ImportDeclaration("java.nio.file.Paths", false, false); + CompilationUnit compilationUnit = cu.addImport(importDeclaration); + String out = LexicalPreservingPrinter.print(compilationUnit); + assertThat(out, equalTo(junit5)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3296Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3296Test.java new file mode 100644 index 0000000..0ddf8fc --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3296Test.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class Issue3296Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + considerCode("public class Test { String[][] allTest; }"); + String expected = "public class Test { @Nullable\n" + "String[][] allTest; }"; + Optional clazzOptional = cu.getClassByName("Test"); + assertTrue(clazzOptional.isPresent()); + ClassOrInterfaceDeclaration clazz = clazzOptional.get(); + clazz.getMembers() + .forEach(bodyDeclaration -> bodyDeclaration.ifFieldDeclaration(fieldDeclaration -> { + NodeList vars = + fieldDeclaration.asFieldDeclaration().getVariables(); + for (VariableDeclarator v : vars) { + if (v.getName().toString().equals("allTest")) { + fieldDeclaration.addMarkerAnnotation("Nullable"); + break; + } + } + })); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3358Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3358Test.java new file mode 100644 index 0000000..cd1d0ca --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3358Test.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Modifier.Keyword; +import org.junit.jupiter.api.Test; + +public class Issue3358Test extends AbstractLexicalPreservingTest { + + @Test + void testArrayTypeWithBracketAfterTypeWithoutWhitespace() { + String def = "int[] i"; + considerVariableDeclaration(def); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + assertTrue(LexicalPreservingPrinter.print(expression).equals("private int[] i")); + } + + @Test + void testArrayTypeWithWhitespaceBeforeTypeAndBracket() { + String def = "int [] i"; + considerVariableDeclaration(def); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + assertTrue(LexicalPreservingPrinter.print(expression).equals("private int [] i")); + } + + @Test + void testArrayTypeWithWhitespaceBeforeEachToken() { + String def = "int [ ] i"; + considerVariableDeclaration(def); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + assertTrue(LexicalPreservingPrinter.print(expression).equals("private int [ ] i")); + } + + @Test + void testArrayTypeWithMultipleWhitespaces() { + String def = "int [ ] i"; + considerVariableDeclaration(def); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + assertTrue(LexicalPreservingPrinter.print(expression).equals("private int [ ] i")); + } + + // TODO This syntax {@code int i[]} does not work! + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3387Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3387Test.java new file mode 100644 index 0000000..0dc46e3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3387Test.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.description.JavadocDescription; +import java.util.StringJoiner; +import org.junit.jupiter.api.Test; + +public class Issue3387Test extends AbstractLexicalPreservingTest { + + @Test + public void test3387() { + considerCode(new StringJoiner("\n") + .add("class A {") + .add("") + .add("\tpublic void setTheNumber(int number) {") + .add("\t\tnumber = number;") + .add("\t}") + .add("") + .add("}") + .toString()); + + String expected = "class A {\n" + "\n" + + "\t/**\n" + + "\t * Change Javadoc\n" + + "\t */\n" + + "\tpublic void setTheNumber(int number) {\n" + + "\t\tnumber = number;\n" + + "\t}\n" + + "\n" + + "}"; + + MethodDeclaration md = cu.findFirst(MethodDeclaration.class).get(); + // create new javadoc comment + Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); + md.setJavadocComment("\t", javadoc); + System.out.println(LexicalPreservingPrinter.print(cu)); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3440Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3440Test.java new file mode 100644 index 0000000..653b921 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3440Test.java @@ -0,0 +1,39 @@ +package com.github.javaparser.printer.lexicalpreservation; + +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.stmt.SwitchEntry; +import com.github.javaparser.utils.TestUtils; +import org.junit.jupiter.api.Test; + +public class Issue3440Test extends AbstractLexicalPreservingTest { + + @Test + void test3440() { + considerCode("public class Foo { public void bar() { switch(1) {case 1: break; } } }"); + String expected = "public class Foo { public void bar() { switch(1) {case 1: } } }"; + SwitchEntry entry = cu.findFirst(SwitchEntry.class).get(); + entry.setStatements(new NodeList<>()); + TestUtils.assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3441Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3441Test.java new file mode 100755 index 0000000..34169ec --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3441Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.Statement; +import org.junit.jupiter.api.Test; + +public class Issue3441Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + considerCode("public class Foo {\n" + " void bar() {\n" + + " stmt1(); // comment 1\n" + + " stmt2(); // comment 2\n" + + " }\n" + + "}"); + String expected = + "public class Foo {\n" + " void bar() {\n" + " stmt2(); // comment 2\n" + " }\n" + "}"; + + BlockStmt block = cu.findFirst(BlockStmt.class).get(); + Statement stmt = block.getStatements().get(0); + + block.remove(stmt); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3721Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3721Test.java new file mode 100644 index 0000000..68669da --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3721Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.body.VariableDeclarator; +import org.junit.jupiter.api.Test; + +public class Issue3721Test extends AbstractLexicalPreservingTest { + + @Test + void issue3721() { + considerCode("public class Bug {\n" + + " public static void main(String[] args) {\n" + + " Object msg;\n" + + " }\n" + + "}\n"); + + String expected = "public class Bug {\n" + + "\n" + + " public static void main(String[] args) {\n" + + " boolean msg;\n" + + " }\n" + + "}\n"; + + VariableDeclarator var = cu.findFirst(VariableDeclarator.class).get(); + var.setType("boolean"); + assertEqualsStringIgnoringEol(expected, cu.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3746Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3746Test.java new file mode 100755 index 0000000..28a0f57 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3746Test.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import org.junit.jupiter.api.Test; + +public class Issue3746Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + considerCode("public class MyClass {\n" + " String s0;\n" + " // Comment\n" + " String s1;\n" + "}"); + + considerCode( + "class A {\n" + " void foo() {\n" + " int first = 1;\n" + " int second = 2;\n" + " }\n" + "}"); + + String expected = "class A {\n" + " void foo() {\n" + " foo();\n" + " int second = 2;\n" + " }\n" + "}"; + BlockStmt block = cu.findAll(BlockStmt.class).get(0); + ExpressionStmt newStmt = new ExpressionStmt(new MethodCallExpr("foo")); + block.addStatement(1, newStmt); + block.getStatement(0).remove(); + assertEquals(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3750Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3750Test.java new file mode 100755 index 0000000..fd78687 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3750Test.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ast.body.FieldDeclaration; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class Issue3750Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + considerCode("public class MyClass {\n" + " String s0;\n" + " // Comment\n" + " String s1;\n" + "}"); + + List fields = cu.findAll(FieldDeclaration.class); + FieldDeclaration field = fields.get(0); + + String expected = "public class MyClass {\n" + " // Comment\n" + " String s1;\n" + "}"; + + field.remove(); + + assertEquals(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3761Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3761Test.java new file mode 100755 index 0000000..d8cb7d7 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3761Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.body.FieldDeclaration; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public class Issue3761Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + considerCode("class C { \n" + " static String S = \"s\";\n" + "}"); + + FieldDeclaration field = cu.findAll(FieldDeclaration.class).get(0); + + List kws = + field.getModifiers().stream().map(Modifier::getKeyword).collect(Collectors.toList()); + kws.add(0, Modifier.Keyword.PROTECTED); + field.setModifiers(kws.toArray(new Modifier.Keyword[] {})); + + String expected = "class C { \r\n" + " protected static String S = \"s\";\r\n" + "}"; + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3773Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3773Test.java new file mode 100755 index 0000000..22d91a0 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3773Test.java @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2015-2016 Federico Tomassetti + * Copyright (C) 2017-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.expr.BinaryExpr.Operator; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.IfStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import java.util.List; +import org.junit.jupiter.api.Test; + +class Issue3773Test extends AbstractLexicalPreservingTest { + + @Test + void test3773() { + considerCode("class A {\r\n" + + " public String output = \"Contents of \";\r\n" + + " \r\n" + + " public String debug(String output) {\r\n" + + "\r\n" + + " Log.d(\"Debug\", output1); \r\n" + + " Log.d(\"Debug\", output2); \r\n" + + " Log.d(\"Debug\", output3); \r\n" + + " Log.d(\"Debug\", output4); \r\n" + + " \r\n" + + " output = \"1\";\r\n" + + " Log.d(\"Debug\", output1);\r\n" + + " \r\n" + + " output = \"2\";\r\n" + + " Log.d(\"Debug\", output2);\r\n" + + " \r\n" + + " output = \"3\";\r\n" + + " Log.d(\"Debug\", output3);\r\n" + + " \r\n" + + " Log.d(\"Debug\", \"\"); \r\n" + + " Log.d(\"Debug\", \"\"); \r\n" + + " Log.d(\"Debug\", \"3\"); \r\n" + + " Log.d(\"Debug\", \"4\"); \r\n" + + " \r\n" + + " return \"\";\r\n" + + " }\r\n" + + "}"); + String expected = "class A {\r\n" + + " public String output = \"Contents of \";\r\n" + + " \r\n" + + " public String debug(String output) {\r\n" + + "\r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output1); \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output2); \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output3); \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output4); \r\n" + + " \r\n" + + " output = \"1\";\r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output1);\r\n" + + " \r\n" + + " output = \"2\";\r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output2);\r\n" + + " \r\n" + + " output = \"3\";\r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", output3);\r\n" + + " \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", \"\"); \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", \"\"); \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", \"3\"); \r\n" + + " if (Log.Level >= 3)\r\n" + + " Log.d(\"Debug\", \"4\"); \r\n" + + " \r\n" + + " return \"\";\r\n" + + " }\r\n" + + "}"; + + // here the logic + FunctionVisitor funVisitor = new FunctionVisitor(); + funVisitor.visit(cu, null); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + public class FunctionVisitor extends ModifierVisitor { + + @Override + public Visitable visit(ExpressionStmt node, Object arg) { + List mces = node.getChildNodesByType(MethodCallExpr.class); + if (mces.isEmpty()) return node; + MethodCallExpr mce = mces.get(0); + if (mce.getScope().isPresent() && mce.getName() != null) { + String nodeScope = mce.getScope().get().toString(); + String nodeName = mce.getName().toString(); + if (nodeScope.equals("Log")) { + if (nodeName.equals("d")) { + IfStmt ifStmt = makeIfStmt(node); + return ifStmt; + } + } + } + return node; + } + } + + private IfStmt makeIfStmt(Statement thenStmt) { + Expression left = new FieldAccessExpr(new NameExpr("Log"), "Level"); + Expression right = new IntegerLiteralExpr("3"); + BinaryExpr condition = new BinaryExpr(left, right, Operator.GREATER_EQUALS); + IfStmt ifStmt = new IfStmt(condition, thenStmt, null); + return ifStmt; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3796Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3796Test.java new file mode 100755 index 0000000..d06f711 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3796Test.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.body.FieldDeclaration; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class Issue3796Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + considerCode("public class MyClass {\n" + " /** Comment */ \n" + " @Rule String s0; \n" + "}"); + String expected = "public class MyClass {\n" + "\n" + "}"; + + List fields = cu.findAll(FieldDeclaration.class); + FieldDeclaration field = fields.get(0); + + field.remove(); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3818Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3818Test.java new file mode 100755 index 0000000..7c22516 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3818Test.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.SimpleName; +import org.junit.jupiter.api.Test; + +public class Issue3818Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + String src = "public class Foo {\n" + "\n" + " public Long[][] m(int[] a){}\n" + "}"; + + String expected = "public class Foo {\n" + "\n" + " public Long[][] m(int[] b){}\n" + "}"; + + BodyDeclaration cu = StaticJavaParser.parseBodyDeclaration(src); + MethodDeclaration md = cu.findAll(MethodDeclaration.class).get(0); + LexicalPreservingPrinter.setup(md); + Parameter p = md.getParameter(0); + Parameter paramExpr = new Parameter( + p.getModifiers(), + p.getAnnotations(), + p.getType(), + p.isVarArgs(), + p.getVarArgsAnnotations(), + new SimpleName("b")); + md.replace(p, paramExpr); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3924Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3924Test.java new file mode 100755 index 0000000..4d63144 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3924Test.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import org.junit.jupiter.api.Test; + +public class Issue3924Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + considerCode("/*\n" + " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" + + " * you may not use this file except in compliance with the License.\n" + + " * You may obtain a copy of the License at\n" + + " */\n" + + "\n" + + "@XmlSchema(\n" + + " xmlns = {\n" + + " @XmlNs(prefix = \"order\", namespaceURI = \"http://www.camel.apache.org/jaxb/example/order/1\"),\n" + + " @XmlNs(prefix = \"address\", namespaceURI = \"http://www.camel.apache.org/jaxb/example/address/1\")\n" + + " }\n" + + ")\n" + + "package net.revelc.code.imp;\n" + + "\n" + + "import net.revelc.code.imp.Something;\n" + + "\n" + + "@Component\n" + + "public class UnusedImports {\n" + + "}\n" + + ""); + + LexicalPreservingPrinter.setup(cu); + cu.getImport(0).remove(); + String actual = LexicalPreservingPrinter.print(cu); + String expected = "/*\r\n" + + " * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n" + + " * you may not use this file except in compliance with the License.\r\n" + + " * You may obtain a copy of the License at\r\n" + + " */\r\n" + + "\r\n" + + "@XmlSchema(\r\n" + + " xmlns = {\r\n" + + " @XmlNs(prefix = \"order\", namespaceURI = \"http://www.camel.apache.org/jaxb/example/order/1\"),\r\n" + + " @XmlNs(prefix = \"address\", namespaceURI = \"http://www.camel.apache.org/jaxb/example/address/1\")\r\n" + + " }\r\n" + + ")\r\n" + + "package net.revelc.code.imp;\r\n" + + "\r\n" + + "@Component\r\n" + + "public class UnusedImports {\r\n" + + "}\n"; + assertEqualsStringIgnoringEol(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3936Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3936Test.java new file mode 100755 index 0000000..d80b8ae --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3936Test.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.expr.TextBlockLiteralExpr; +import org.junit.jupiter.api.Test; + +public class Issue3936Test extends AbstractLexicalPreservingTest { + static final String given = "package some.project;\n" + + "\n" + + "import java.util.Optional;\n" + + "\n" + + "public class SomeClass {\n" + + "\n" + + " String html = \"\" + \"\\n\"\n" + + " + \"\\t\\n\"\n" + + " + \"\\t\\t\\n\"\n" + + " + \"\\t\\n\"\n" + + " + \"\\t\\n\"\n" + + " + \"\\t\\t

Hello, world

\\n\"\n" + + " + \"\\t\\n\"\n" + + " + \"\\n\";\n" + + "}"; + + @Test + void test() { + considerCode(given); + + String newText = "\tfirstRow\n\tsecondRow\n\tthirdRow"; + + LexicalPreservingPrinter.setup(cu); + + VariableDeclarator expr = cu.findFirst(VariableDeclarator.class).get(); + expr.setInitializer(new TextBlockLiteralExpr(newText)); + + String actual = LexicalPreservingPrinter.print(cu); + String expected = "package some.project;\n" + + "\n" + + "import java.util.Optional;\n" + + "\n" + + "public class SomeClass {\n" + + "\n" + + " String html = \"\"\"\n" + + "\tfirstRow\n" + + "\tsecondRow\n" + + "\tthirdRow\"\"\";\n" + + "}"; + assertEqualsStringIgnoringEol(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3937Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3937Test.java new file mode 100644 index 0000000..b027461 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3937Test.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.expr.LambdaExpr; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import org.junit.jupiter.api.Test; + +public class Issue3937Test extends AbstractLexicalPreservingTest { + static final String given = "package custom.project;\n" + "\n" + + "import java.util.stream.Stream;\n" + + "\n" + + "class TestFileSystemCodeProvider {\n" + + " void testInMemoryFileSystem() {\n" + + "\n" + + " Stream.of(\"\").listFilesForContent(file -> {\n" + + " System.out.println(s);\n" + + " });\n" + + " }\n" + + "}\n" + + ""; + + @Test + void test() { + considerCode(given); + + LexicalPreservingPrinter.setup(cu); + + LambdaExpr lambdaExpr = cu.findFirst(LambdaExpr.class).get(); + lambdaExpr.setBody(new ExpressionStmt(new MethodCallExpr(new NameExpr("SomeClass"), "someMethod"))); + + String actual = LexicalPreservingPrinter.print(cu); + String expected = "package custom.project;\n" + + "\n" + + "import java.util.stream.Stream;\n" + + "\n" + + "class TestFileSystemCodeProvider {\n" + + " void testInMemoryFileSystem() {\n" + + "\n" + + " Stream.of(\"\").listFilesForContent(file -> SomeClass.someMethod());\n" + + " }\n" + + "}\n" + + ""; + assertEqualsStringIgnoringEol(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3949Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3949Test.java new file mode 100644 index 0000000..d49100f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3949Test.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.expr.LambdaExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.BreakStmt; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import org.junit.jupiter.api.Test; + +class Issue3949Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + considerCode("class A {\n" + + "\n" + + " void foo() {\n" + + " Consumer lambda = a -> System.out.println(a);\n" + + " }\n" + + "}"); + + ExpressionStmt estmt = cu.findAll(ExpressionStmt.class).get(1).clone(); + LambdaExpr lexpr = cu.findAll(LambdaExpr.class).get(0); + LexicalPreservingPrinter.setup(cu); + + BlockStmt block = new BlockStmt(); + BreakStmt bstmt = new BreakStmt(); + block.addStatement(new ExpressionStmt(estmt.getExpression())); + block.addStatement(bstmt); + lexpr.setBody(block); + + String expected = "class A {\n" + + "\n" + + " void foo() {\n" + + " Consumer lambda = a -> {\n" + + " System.out.println(a);\n" + + " break;\n" + + " };\n" + + " }\n" + + "}"; + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4104Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4104Test.java new file mode 100755 index 0000000..0e765fc --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4104Test.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.stmt.BreakStmt; +import com.github.javaparser.ast.stmt.SwitchEntry; +import com.github.javaparser.ast.stmt.SwitchStmt; +import org.junit.jupiter.api.Test; + +public class Issue4104Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + considerCode("class Foo {\n" + + " void foo() {\n" + + " switch(bar) {\n" + + " default:\n" + + " break;\n" + + " }\n" + + " }\n" + + "}"); + // should be this + // String expected = + // "class Foo {\n" + // + " void foo() {\n" + // + " switch(bar) {\n" + // + " default:\n" + // + " break;\n" + // + " case 0:\n" + // + " break;\n" + // + " }\n" + // + " }\n" + // + "}"; + + String expected = "class Foo {\n" + + " void foo() {\n" + + " switch(bar) {\n" + + " default:\n" + + " break;\n" + + " case 0:\n" + + " break;\n" + + " }\n" + + " }\n" + + "}"; + + SwitchStmt switchStmt = + cu.findAll(SwitchStmt.class).stream().findFirst().get(); + + SwitchEntry newEntry = new SwitchEntry(); + newEntry.setLabels(NodeList.nodeList(new IntegerLiteralExpr(0))); + newEntry.setStatements(NodeList.nodeList(new BreakStmt())); + switchStmt.getEntries().addLast(newEntry); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4163Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4163Test.java new file mode 100755 index 0000000..889096f --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4163Test.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import com.github.javaparser.printer.DefaultPrettyPrinter; +import com.github.javaparser.printer.Printer; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import com.github.javaparser.printer.configuration.PrinterConfiguration; +import org.junit.jupiter.api.Test; + +public class Issue4163Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + VoidVisitorAdapter visitor = new VoidVisitorAdapter() { + @Override + public void visit(MethodDeclaration n, Object arg) { + System.out.println(n.getDeclarationAsString(true, true, true)); + System.out.println(n.getComment()); + } + }; + String code = "class Foo {\n" + " /*\n" + " * comment\n" + " */\n" + " void m() {}\n" + " }"; + + // setup pretty printer to print comments + PrinterConfiguration config = new DefaultPrinterConfiguration() + .addOption(new DefaultConfigurationOption(ConfigOption.PRINT_COMMENTS)); + Printer printer = new DefaultPrettyPrinter(config); + CompilationUnit cu = StaticJavaParser.parse(code); + MethodDeclaration md = cu.findFirst(MethodDeclaration.class).get(); + + // expected result is + String expected = md.getComment().get().asString() + "\n"; + + // set the new pretty printer in the compilation unit + cu.printer(printer); + // visit the MethodDeclaration node + visitor.visit(cu, null); + // checks that the comment is printed after executing the getDeclarationAsString method + assertEqualsStringIgnoringEol(expected, md.getComment().get().toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4245Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4245Test.java new file mode 100644 index 0000000..5f47a40 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4245Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ParserConfiguration.LanguageLevel; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import org.junit.jupiter.api.Test; + +class Issue4245Test extends AbstractLexicalPreservingTest { + + @Test + public void test() { + + ParserConfiguration parserConfiguration = new ParserConfiguration(); + parserConfiguration.setLanguageLevel(LanguageLevel.JAVA_17); + StaticJavaParser.setConfiguration(parserConfiguration); + considerCode("public sealed interface IUpdatePortCommand permits UpdateScheduleCommand, UpdateStateCommand {}"); + + ClassOrInterfaceDeclaration classOrInterface = + cu.findFirst(ClassOrInterfaceDeclaration.class).get(); + classOrInterface.setModifiers(); + + String expected = "interface IUpdatePortCommand permits UpdateScheduleCommand, UpdateStateCommand {}"; + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4488Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4488Test.java new file mode 100644 index 0000000..f2cb056 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4488Test.java @@ -0,0 +1,49 @@ +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import org.junit.jupiter.api.Test; + +public class Issue4488Test { + @Test + void cannotChangeMethodNameInLambda() { + ParserConfiguration parserConfiguration = new ParserConfiguration(); + parserConfiguration.setLexicalPreservationEnabled(true); + StaticJavaParser.setConfiguration(parserConfiguration); + + CompilationUnit cu = + StaticJavaParser.parse("class Test {\n" + " private Map dummyMap = new HashMap<>();\n" + + " public String dummyFunction(String name) {\n" + + " return dummyMap.computeIfAbsent(name,\n" + + " (Function) s -> SomeFunction.withAMethodHere(\"test\").build());\n" + + " }\n" + + "}"); + + cu.accept( + new ModifierVisitor() { + @Override + public Visitable visit(MethodCallExpr mc, Object arg) { + if (mc.getNameAsString().equals("withAMethodHere")) { + return mc.setName("replacedMethodHere"); + } + return super.visit(mc, arg); + } + }, + null); + + assertEquals( + "class Test {\n" + " private Map dummyMap = new HashMap<>();\n" + + " public String dummyFunction(String name) {\n" + + " return dummyMap.computeIfAbsent(name,\n" + + " (Function) s -> SomeFunction.replacedMethodHere(\"test\").build());\n" + + " }\n" + + "}", + LexicalPreservingPrinter.print(cu)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4670Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4670Test.java new file mode 100755 index 0000000..ed56bb4 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4670Test.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import org.junit.jupiter.api.Test; + +public class Issue4670Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + // A parameter with an annotation and a final modifier + final String code = "public interface Foo {\n" + " void bar(final @PathVariable(\"id\") String id);\n" + "}"; + considerCode(code); + LexicalPreservingPrinter.setup(cu); + + // Remove the final modifier from parameters. + cu.accept( + new VoidVisitorAdapter() { + @Override + public void visit(Parameter p, Void arg) { + p.setFinal(false); + } + }, + null); + + String actual = LexicalPreservingPrinter.print(cu); + String expected = "public interface Foo {\n" + " void bar(@PathVariable(\"id\") String id);\n" + "}"; + + assertEqualsStringIgnoringEol(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4747Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4747Test.java new file mode 100755 index 0000000..86097b8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue4747Test.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.expr.MarkerAnnotationExpr; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import org.junit.jupiter.api.Test; + +public class Issue4747Test extends AbstractLexicalPreservingTest { + + @Test + void test() { + final String code = "public class TestClass {\n" + + " @com.abc.def.TestMarkerAnnotation\n" + + " public void method1() {}\n" + + "}"; + considerCode(code); + cu.accept( + new ModifierVisitor() { + public Visitable visit(final MarkerAnnotationExpr expr, final Void arg) { + if (expr.getNameAsString().equals("com.abc.def.TestMarkerAnnotation")) { + expr.setName("TestMarkerAnnotation"); + } + + return super.visit(expr, arg); + } + }, + null); + + String actual = LexicalPreservingPrinter.print(cu); + String expected = + "public class TestClass {\n" + " @TestMarkerAnnotation\n" + " public void method1() {}\n" + "}"; + + assertEqualsStringIgnoringEol(expected, actual); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalDifferenceCalculatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalDifferenceCalculatorTest.java new file mode 100644 index 0000000..db1baf8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalDifferenceCalculatorTest.java @@ -0,0 +1,344 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.TokenTypes.eolTokenKind; +import static com.github.javaparser.TokenTypes.spaceTokenKind; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.GeneratedJavaParserConstants; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.body.AnnotationDeclaration; +import com.github.javaparser.ast.body.EnumConstantDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.comments.JavadocComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.printer.ConcreteSyntaxModel; +import com.github.javaparser.printer.concretesyntaxmodel.CsmElement; +import com.github.javaparser.printer.concretesyntaxmodel.CsmToken; +import com.github.javaparser.printer.lexicalpreservation.LexicalDifferenceCalculator.CsmChild; +import java.io.IOException; +import java.util.List; +import org.junit.jupiter.api.Test; + +class LexicalDifferenceCalculatorTest extends AbstractLexicalPreservingTest { + + @Test + void compilationUnitExampleOriginal() { + considerCode("class A {}"); + CsmElement element = ConcreteSyntaxModel.forClass(cu.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmOriginal = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, cu); + assertEquals(2, csmOriginal.elements.size()); + assertEquals(new CsmChild(cu.getType(0)), csmOriginal.elements.get(0)); + assertEquals(new CsmToken(eolTokenKind()), csmOriginal.elements.get(1)); + } + + @Test + void compilationUnitExampleWithPackageSet() { + considerCode("class A {}"); + CsmElement element = ConcreteSyntaxModel.forClass(cu.getClass()); + PackageDeclaration packageDeclaration = new PackageDeclaration(new Name(new Name("foo"), "bar")); + LexicalDifferenceCalculator.CalculatedSyntaxModel csmChanged = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, cu, ObservableProperty.PACKAGE_DECLARATION, null, packageDeclaration); + assertEquals(3, csmChanged.elements.size()); + assertEquals(new CsmChild(packageDeclaration), csmChanged.elements.get(0)); + assertEquals(new CsmChild(cu.getType(0)), csmChanged.elements.get(1)); + assertEquals(new CsmToken(eolTokenKind()), csmChanged.elements.get(2)); + } + + @Test + void annotationDeclarationModifiersExampleOriginal() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csm = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + csm.removeIndentationElements(); + int i = 0; + assertEquals(new CsmToken(GeneratedJavaParserConstants.AT), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.INTERFACE), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getName()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.LBRACE), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(0)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(1)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(2)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(3)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(4)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(5)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.RBRACE), csm.elements.get(i++)); + assertEquals(i, csm.elements.size()); + } + + @Test + void annotationDeclarationModifiersExampleModified() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csm = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, + annotationDeclaration, + ObservableProperty.MODIFIERS, + new NodeList<>(), + createModifierList(PUBLIC)); + csm.removeIndentationElements(); + int i = 0; + assertEquals(new CsmChild(Modifier.publicModifier()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.AT), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.INTERFACE), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getName()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.LBRACE), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(0)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(1)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(2)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(3)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(4)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(5)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.RBRACE), csm.elements.get(i++)); + assertEquals(i, csm.elements.size()); + } + + @Test + void annotationDeclarationNameExampleModified() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + SimpleName newName = new SimpleName("NewName"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csm = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, + annotationDeclaration, + ObservableProperty.NAME, + annotationDeclaration.getName(), + newName); + csm.removeIndentationElements(); + int i = 0; + assertEquals(new CsmToken(GeneratedJavaParserConstants.AT), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.INTERFACE), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(newName), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.LBRACE), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(0)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(1)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(2)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(3)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(4)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(5)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.RBRACE), csm.elements.get(i++)); + assertEquals(i, csm.elements.size()); + } + + @Test + void annotationDeclarationJavadocExampleOriginal() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + LexicalDifferenceCalculator.CalculatedSyntaxModel csm = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(element, annotationDeclaration); + csm.removeIndentationElements(); + int i = 0; + assertEquals(new CsmChild(Modifier.publicModifier()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.AT), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.INTERFACE), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getName()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.LBRACE), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(0)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(1)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(2)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(3)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(4)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(5)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.RBRACE), csm.elements.get(i++)); + assertEquals(i, csm.elements.size()); + } + + @Test + void annotationDeclarationJavadocExampleAddingJavadoc() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + AnnotationDeclaration annotationDeclaration = (AnnotationDeclaration) cu.getType(0); + CsmElement element = ConcreteSyntaxModel.forClass(annotationDeclaration.getClass()); + JavadocComment comment = new JavadocComment("Cool this annotation!"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csm = new LexicalDifferenceCalculator() + .calculatedSyntaxModelAfterPropertyChange( + element, annotationDeclaration, ObservableProperty.COMMENT, null, comment); + csm.removeIndentationElements(); + int i = 0; + assertEquals(new CsmChild(Modifier.publicModifier()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.AT), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.INTERFACE), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getName()), csm.elements.get(i++)); + assertEquals(new CsmToken(spaceTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.LBRACE), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(0)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(1)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(2)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(3)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(4)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmChild(annotationDeclaration.getMember(5)), csm.elements.get(i++)); + assertEquals(new CsmToken(eolTokenKind()), csm.elements.get(i++)); + assertEquals(new CsmToken(GeneratedJavaParserConstants.RBRACE), csm.elements.get(i++)); + assertEquals(i, csm.elements.size()); + } + + @Test + void simpleEnumConstantDeclaration() { + EnumConstantDeclaration ecd = considerEcd("A"); + LexicalDifferenceCalculator.CalculatedSyntaxModel csm = + new LexicalDifferenceCalculator().calculatedSyntaxModelForNode(ecd); + + int i = 0; + assertEquals(new CsmChild(ecd.getName()), csm.elements.get(i++)); + assertEquals(i, csm.elements.size()); + } + + @Test + void csmModelAfterAddingStatementToEmptyBlock() throws IOException { + LexicalDifferenceCalculator ldc = new LexicalDifferenceCalculator(); + considerExample("ASimpleClassWithMoreFormatting_step3"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + Statement assignStatement = new ExpressionStmt(new AssignExpr( + new FieldAccessExpr(new ThisExpr(), "aField"), new NameExpr("aField"), AssignExpr.Operator.ASSIGN)); + LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel = + ldc.calculatedSyntaxModelAfterListAddition( + ConcreteSyntaxModel.forClass(BlockStmt.class), + ObservableProperty.STATEMENTS, + setter.getBody().get().getStatements(), + 0, + assignStatement); + int index = 0; + assertEquals( + CsmElement.token(GeneratedJavaParserConstants.LBRACE), calculatedSyntaxModel.elements.get(index++)); + assertEquals(CsmElement.newline(), calculatedSyntaxModel.elements.get(index++)); + assertEquals(CsmElement.indent(), calculatedSyntaxModel.elements.get(index++)); + assertTrue(isChild(calculatedSyntaxModel.elements.get(index++), ExpressionStmt.class)); + assertEquals(CsmElement.newline(), calculatedSyntaxModel.elements.get(index++)); + assertEquals(CsmElement.unindent(), calculatedSyntaxModel.elements.get(index++)); + assertEquals( + CsmElement.token(GeneratedJavaParserConstants.RBRACE), calculatedSyntaxModel.elements.get(index++)); + assertEquals(index, calculatedSyntaxModel.elements.size()); + } + + @Test + void differenceAfterddingStatementToEmptyBlock() throws IOException { + LexicalDifferenceCalculator ldc = new LexicalDifferenceCalculator(); + considerExample("ASimpleClassWithMoreFormatting_step3"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + Statement assignStatement = new ExpressionStmt(new AssignExpr( + new FieldAccessExpr(new ThisExpr(), "aField"), new NameExpr("aField"), AssignExpr.Operator.ASSIGN)); + List differenceElements = ldc.calculateListAdditionDifference( + ObservableProperty.STATEMENTS, setter.getBody().get().getStatements(), 0, assignStatement); + int index = 0; + assertEquals( + DifferenceElement.kept(CsmElement.token(GeneratedJavaParserConstants.LBRACE)), + differenceElements.get(index++)); + assertEquals(DifferenceElement.kept(CsmElement.newline()), differenceElements.get(index++)); + assertEquals(DifferenceElement.added(CsmElement.indent()), differenceElements.get(index++)); + assertTrue(isAddedChild(differenceElements.get(index++), ExpressionStmt.class)); + CsmElement cmsElement = differenceElements.get(index++).getElement(); + // all end of line tokens are not equal so it's safer to check if it's a token and then a end of line token + assertTrue(CsmToken.class.isAssignableFrom(cmsElement.getClass()) && ((CsmToken) cmsElement).isNewLine()); + assertEquals(DifferenceElement.added(CsmElement.unindent()), differenceElements.get(index++)); + assertEquals( + DifferenceElement.kept(CsmElement.token(GeneratedJavaParserConstants.RBRACE)), + differenceElements.get(index++)); + assertEquals(index, differenceElements.size()); + } + + private boolean isAddedChild(DifferenceElement element, Class childClass) { + return element.isAdded() && isChild(element.getElement(), childClass); + } + + private boolean isChild(CsmElement element, Class childClass) { + return element instanceof CsmChild && childClass.isInstance(((CsmChild) element).getChild()); + } + + protected EnumConstantDeclaration considerEcd(String code) { + considerCode("enum A { " + code + " }"); + return ((EnumDeclaration) cu.getType(0)).getEntries().get(0); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalPreservingPrinterTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalPreservingPrinterTest.java new file mode 100644 index 0000000..bb17987 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalPreservingPrinterTest.java @@ -0,0 +1,1888 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter.NODE_TEXT_DATA; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.GeneratedJavaParserConstants; +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; +import com.github.javaparser.ast.comments.LineComment; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.ast.type.UnionType; +import com.github.javaparser.ast.type.VoidType; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import com.github.javaparser.utils.LineSeparator; +import com.github.javaparser.utils.TestUtils; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +class LexicalPreservingPrinterTest extends AbstractLexicalPreservingTest { + private NodeText getTextForNode(Node node) { + return node.getData(NODE_TEXT_DATA); + } + + // + // Tests on TextNode definition + // + + @Test + void checkNodeTextCreatedForSimplestClass() { + considerCode("class A {}"); + + // CU + assertEquals(1, getTextForNode(cu).numberOfElements()); + assertTrue(getTextForNode(cu).getTextElement(0) instanceof ChildTextElement); + assertEquals( + cu.getClassByName("A").get(), + ((ChildTextElement) getTextForNode(cu).getTextElement(0)).getChild()); + + // Class + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + assertEquals(7, getTextForNode(classA).numberOfElements()); + assertEquals("class", getTextForNode(classA).getTextElement(0).expand()); + assertEquals(" ", getTextForNode(classA).getTextElement(1).expand()); + assertEquals("A", getTextForNode(classA).getTextElement(2).expand()); + assertEquals(" ", getTextForNode(classA).getTextElement(3).expand()); + assertEquals("{", getTextForNode(classA).getTextElement(4).expand()); + assertEquals("}", getTextForNode(classA).getTextElement(5).expand()); + assertEquals("", getTextForNode(classA).getTextElement(6).expand()); + assertTrue(getTextForNode(classA).getTextElement(6) instanceof TokenTextElement); + assertEquals( + GeneratedJavaParserConstants.EOF, + ((TokenTextElement) getTextForNode(classA).getTextElement(6)).getTokenKind()); + } + + @Test + void checkNodeTextCreatedForField() { + String code = "class A {int i;}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + FieldDeclaration fd = classA.getFieldByName("i").get(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(fd); + assertEquals( + Arrays.asList("int", " ", "i", ";"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForVariableDeclarator() { + String code = "class A {int i;}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + FieldDeclaration fd = classA.getFieldByName("i").get(); + VariableDeclarator vd = fd.getVariables().get(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(vd); + assertEquals( + Arrays.asList("i"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForMethod() { + String code = "class A {void foo(int p1, float p2) { }}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + MethodDeclaration md = classA.getMethodsByName("foo").get(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(md); + assertEquals( + Arrays.asList("void", " ", "foo", "(", "int p1", ",", " ", "float p2", ")", " ", "{ }"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForMethodParameter() { + String code = "class A {void foo(int p1, float p2) { }}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + MethodDeclaration md = classA.getMethodsByName("foo").get(0); + Parameter p1 = md.getParameterByName("p1").get(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(p1); + assertEquals( + Arrays.asList("int", " ", "p1"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForMethodParameterWithAnnotation() { + String code = "class A {void foo(@Nullable String p1, float p2) { }}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + MethodDeclaration md = classA.getMethodsByName("foo").get(0); + Parameter p1 = md.getParameterByName("p1").get(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(p1); + assertEquals( + Arrays.asList("@Nullable", " ", "String", " ", "p1"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForMethodWithTypeArgument() { + String code = "class A {Set foo(String p1, float p2) { return null;}}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + MethodDeclaration md = classA.getMethodsByName("foo").get(0); + Type p1 = md.getType().asClassOrInterfaceType().getTypeArguments().get().get(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(p1); + assertEquals( + Arrays.asList("String"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForMethodWithAnnotatedTypeArgument() { + String code = "class A {Set<@Nullable String> foo() { return null;}}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + MethodDeclaration md = classA.getMethodsByName("foo").get(0); + Type p1 = md.getType(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(p1); + assertEquals( + Arrays.asList("Set", "<", "@", "Nullable", " ", "String", ">"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForPrimitiveType() { + String code = "class A {void foo(int p1, float p2) { }}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + MethodDeclaration md = classA.getMethodsByName("foo").get(0); + Parameter p1 = md.getParameterByName("p1").get(); + Type t = p1.getType(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(t); + assertEquals( + Arrays.asList("int"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedForSimpleImport() { + String code = "import a.b.c.D;"; + considerCode(code); + + ImportDeclaration imp = (ImportDeclaration) cu.getChildNodes().get(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(imp); + assertEquals( + Arrays.asList("import", " ", "a.b.c.D", ";", ""), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void addedImportShouldBePrependedWithEOL() { + considerCode("import a.A;" + LineSeparator.SYSTEM + "class X{}"); + + cu.addImport("a.B"); + + assertEqualsStringIgnoringEol("import a.A;\nimport a.B;\nclass X{}", LexicalPreservingPrinter.print(cu)); + } + + @Test + void checkNodeTextCreatedGenericType() { + String code = "class A {ParseResult result;}"; + considerCode(code); + + FieldDeclaration field = + cu.getClassByName("A").get().getFieldByName("result").get(); + Node t = field.getCommonType(); + Node t2 = field.getVariable(0).getType(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(field); + assertEquals( + Arrays.asList("ParseResult", "<", "T", ">", " ", "result", ";"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedAnnotationDeclaration() { + String code = "public @interface ClassPreamble { String author(); }"; + considerCode(code); + + AnnotationDeclaration ad = + cu.getAnnotationDeclarationByName("ClassPreamble").get(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(ad); + assertEquals( + Arrays.asList( + "public", + " ", + "@", + "interface", + " ", + "ClassPreamble", + " ", + "{", + " ", + "String author();", + " ", + "}", + ""), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedAnnotationMemberDeclaration() { + String code = "public @interface ClassPreamble { String author(); }"; + considerCode(code); + + AnnotationDeclaration ad = + cu.getAnnotationDeclarationByName("ClassPreamble").get(); + AnnotationMemberDeclaration md = (AnnotationMemberDeclaration) ad.getMember(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(md); + assertEquals( + Arrays.asList("String", " ", "author", "(", ")", ";"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedAnnotationMemberDeclarationWithArrayType() { + String code = "public @interface ClassPreamble { String[] author(); }"; + considerCode(code); + + AnnotationDeclaration ad = + cu.getAnnotationDeclarationByName("ClassPreamble").get(); + AnnotationMemberDeclaration md = (AnnotationMemberDeclaration) ad.getMember(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(md); + assertEquals( + Arrays.asList("String[]", " ", "author", "(", ")", ";"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedAnnotationMemberDeclarationArrayType() { + String code = "public @interface ClassPreamble { String[] author(); }"; + considerCode(code); + + AnnotationDeclaration ad = + cu.getAnnotationDeclarationByName("ClassPreamble").get(); + AnnotationMemberDeclaration md = ad.getMember(0).asAnnotationMemberDeclaration(); + Type type = md.getType(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(type); + assertEquals( + Arrays.asList("String", "[", "]"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedAnnotationMemberDeclarationWithComment() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + + AnnotationMemberDeclaration md = cu.getAnnotationDeclarationByName("ClassPreamble") + .get() + .getMember(5) + .asAnnotationMemberDeclaration(); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(md); + assertEquals( + Arrays.asList("String[]", " ", "reviewers", "(", ")", ";"), + nodeText.getElements().stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedArrayCreationLevelWithoutExpression() { + considerExpression("new int[]"); + + ArrayCreationExpr arrayCreationExpr = expression.asArrayCreationExpr(); + ArrayCreationLevel arrayCreationLevel = arrayCreationExpr.getLevels().get(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(arrayCreationLevel); + assertEquals( + Arrays.asList("[", "]"), + nodeText.getElements().stream() + .map(TextElement::expand) + .filter(e -> !e.isEmpty()) + .collect(Collectors.toList())); + } + + @Test + void checkNodeTextCreatedArrayCreationLevelWith() { + considerExpression("new int[123]"); + + ArrayCreationExpr arrayCreationExpr = expression.asArrayCreationExpr(); + ArrayCreationLevel arrayCreationLevel = arrayCreationExpr.getLevels().get(0); + NodeText nodeText = LexicalPreservingPrinter.getOrCreateNodeText(arrayCreationLevel); + assertEquals( + Arrays.asList("[", "123", "]"), + nodeText.getElements().stream() + .map(TextElement::expand) + .filter(e -> !e.isEmpty()) + .collect(Collectors.toList())); + } + + // + // Tests on findIndentation + // + + @Test + void findIndentationForAnnotationMemberDeclarationWithoutComment() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + Node node = cu.getAnnotationDeclarationByName("ClassPreamble").get().getMember(4); + List indentation = LexicalPreservingPrinter.findIndentation(node); + assertEquals( + Arrays.asList(" ", " ", " "), + indentation.stream().map(TextElement::expand).collect(Collectors.toList())); + } + + @Test + void findIndentationForAnnotationMemberDeclarationWithComment() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + Node node = cu.getAnnotationDeclarationByName("ClassPreamble").get().getMember(5); + List indentation = LexicalPreservingPrinter.findIndentation(node); + assertEquals( + Arrays.asList(" ", " ", " "), + indentation.stream().map(TextElement::expand).collect(Collectors.toList())); + } + + // + // Tests on printing + // + + @Test + void printASuperSimpleCUWithoutChanges() { + String code = "class A {}"; + considerCode(code); + + assertEquals(code, LexicalPreservingPrinter.print(cu)); + } + + @Test + void printASuperSimpleClassWithAFieldAdded() { + String code = "class A {}"; + considerCode(code); + + ClassOrInterfaceDeclaration classA = cu.getClassByName("A").get(); + classA.addField("int", "myField"); + assertEquals( + "class A {" + LineSeparator.SYSTEM + " int myField;" + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(classA)); + } + + @Test + void printASuperSimpleClassWithoutChanges() { + String code = "class A {}"; + considerCode(code); + + assertEquals(code, LexicalPreservingPrinter.print(cu.getClassByName("A").get())); + } + + @Test + void printASimpleCUWithoutChanges() { + String code = "class /*a comment*/ A {\t\t" + LineSeparator.SYSTEM + " int f;" + LineSeparator.SYSTEM + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + " void foo(int p ) { return 'z' \t; }}"; + considerCode(code); + + assertEquals(code, LexicalPreservingPrinter.print(cu)); + assertEquals(code, LexicalPreservingPrinter.print(cu.getClassByName("A").get())); + assertEquals( + "void foo(int p ) { return 'z' \t; }", + LexicalPreservingPrinter.print( + cu.getClassByName("A").get().getMethodsByName("foo").get(0))); + } + + @Test + void printASimpleClassRemovingAField() { + String code = "class /*a comment*/ A {\t\t" + LineSeparator.SYSTEM + " int f;" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " void foo(int p ) { return 'z' \t; }}"; + considerCode(code); + + ClassOrInterfaceDeclaration c = cu.getClassByName("A").get(); + c.getMembers().remove(0); + // This rendering is probably caused by the concret syntax model + assertEquals( + "class /*a comment*/ A {\t\t" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " void foo(int p ) { return 'z' \t; }}", + LexicalPreservingPrinter.print(c)); + } + + @Test + void printASimpleClassRemovingAMethod() { + String code = "class /*a comment*/ A {\t\t" + LineSeparator.SYSTEM + " int f;" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " void foo(int p ) { return 'z' \t; }" + + LineSeparator.SYSTEM + " int g;}"; + considerCode(code); + + ClassOrInterfaceDeclaration c = cu.getClassByName("A").get(); + c.getMembers().remove(1); + assertEquals( + "class /*a comment*/ A {\t\t" + LineSeparator.SYSTEM + " int f;" + LineSeparator.SYSTEM + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + " int g;}", + LexicalPreservingPrinter.print(c)); + } + + @Test + void printASimpleMethodAddingAParameterToAMethodWithZeroParameters() { + String code = "class A { void foo() {} }"; + considerCode(code); + + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + m.addParameter("float", "p1"); + assertEquals("void foo(float p1) {}", LexicalPreservingPrinter.print(m)); + } + + @Test + void printASimpleMethodAddingAParameterToAMethodWithOneParameter() { + String code = "class A { void foo(char p1) {} }"; + considerCode(code); + + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + m.addParameter("float", "p2"); + assertEquals("void foo(char p1, float p2) {}", LexicalPreservingPrinter.print(m)); + } + + @Test + void printASimpleMethodRemovingAParameterToAMethodWithOneParameter() { + String code = "class A { void foo(float p1) {} }"; + considerCode(code); + + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + m.getParameters().remove(0); + assertEquals("void foo() {}", LexicalPreservingPrinter.print(m)); + } + + @Test + void printASimpleMethodRemovingParameterOneFromMethodWithTwoParameters() { + String code = "class A { void foo(char p1, int p2) {} }"; + considerCode(code); + + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + m.getParameters().remove(0); + assertEquals("void foo(int p2) {}", LexicalPreservingPrinter.print(m)); + } + + @Test + void printASimpleMethodRemovingParameterTwoFromMethodWithTwoParameters() { + String code = "class A { void foo(char p1, int p2) {} }"; + considerCode(code); + + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + m.getParameters().remove(1); + assertEquals("void foo(char p1) {}", LexicalPreservingPrinter.print(m)); + } + + @Test + void printASimpleMethodAddingAStatement() { + String code = "class A { void foo(char p1, int p2) {} }"; + considerCode(code); + + Statement s = new ExpressionStmt( + new BinaryExpr(new IntegerLiteralExpr("10"), new IntegerLiteralExpr("2"), BinaryExpr.Operator.PLUS)); + NodeList stmts = cu.getClassByName("A") + .get() + .getMethodsByName("foo") + .get(0) + .getBody() + .get() + .getStatements(); + stmts.add(s); + MethodDeclaration m = + cu.getClassByName("A").get().getMethodsByName("foo").get(0); + assertEquals( + "void foo(char p1, int p2) {" + LineSeparator.SYSTEM + " 10 + 2;" + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(m)); + } + + @Test + void printASimpleMethodRemovingAStatementCRLF() { + printASimpleMethodRemovingAStatement("\r\n"); + } + + @Test + void printASimpleMethodRemovingAStatementLF() { + printASimpleMethodRemovingAStatement("\n"); + } + + @Test + void printASimpleMethodRemovingAStatementCR() { + printASimpleMethodRemovingAStatement("\r"); + } + + private void printASimpleMethodRemovingAStatement(String eol) { + considerCode("class A {" + eol + + "\t" + "foo(int a, int b) {" + eol + + "\t\t" + "int result = a * b;" + eol + + "\t\t" + "return a * b;" + eol + + "\t" + "}" + eol + + "}"); + + ExpressionStmt stmt = cu.findAll(ExpressionStmt.class).get(0); + stmt.remove(); + + assertEquals( + "class A {" + eol + + "\t" + "foo(int a, int b) {" + eol + + "\t\t" + "return a * b;" + eol + + "\t" + "}" + eol + + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void printASimpleImport() { + String code = "import a.b.c.D;"; + considerCode(code); + + ImportDeclaration imp = (ImportDeclaration) cu.getChildNodes().get(0); + assertEquals("import a.b.c.D;", LexicalPreservingPrinter.print(imp)); + } + + @Test + void printAnotherImport() { + String code = "import com.github.javaparser.ast.CompilationUnit;"; + considerCode(code); + + ImportDeclaration imp = (ImportDeclaration) cu.getChildNodes().get(0); + assertEquals("import com.github.javaparser.ast.CompilationUnit;", LexicalPreservingPrinter.print(imp)); + } + + @Test + void printAStaticImport() { + String code = "import static com.github.javaparser.ParseStart.*;"; + considerCode(code); + + ImportDeclaration imp = (ImportDeclaration) cu.getChildNodes().get(0); + assertEquals("import static com.github.javaparser.ParseStart.*;", LexicalPreservingPrinter.print(imp)); + } + + @Test + void checkAnnidatedTypeParametersPrinting() { + String code = "class A { private final Stack> its = new Stack>(); }"; + considerCode(code); + assertEquals( + "class A { private final Stack> its = new Stack>(); }", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void printASingleCatch() { + String code = "class A {{try { doit(); } catch (Exception e) {}}}"; + considerCode(code); + + assertEquals("class A {{try { doit(); } catch (Exception e) {}}}", LexicalPreservingPrinter.print(cu)); + } + + @Test + void printAMultiCatch() { + String code = "class A {{try { doit(); } catch (Exception | AssertionError e) {}}}"; + considerCode(code); + + assertEquals( + "class A {{try { doit(); } catch (Exception | AssertionError e) {}}}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void printASingleCatchType() { + String code = "class A {{try { doit(); } catch (Exception e) {}}}"; + considerCode(code); + InitializerDeclaration initializerDeclaration = + (InitializerDeclaration) cu.getType(0).getMembers().get(0); + TryStmt tryStmt = + (TryStmt) initializerDeclaration.getBody().getStatements().get(0); + CatchClause catchClause = tryStmt.getCatchClauses().get(0); + Type catchType = catchClause.getParameter().getType(); + + assertEquals("Exception", LexicalPreservingPrinter.print(catchType)); + } + + @Test + void printUnionType() { + String code = "class A {{try { doit(); } catch (Exception | AssertionError e) {}}}"; + considerCode(code); + InitializerDeclaration initializerDeclaration = + (InitializerDeclaration) cu.getType(0).getMembers().get(0); + TryStmt tryStmt = + (TryStmt) initializerDeclaration.getBody().getStatements().get(0); + CatchClause catchClause = tryStmt.getCatchClauses().get(0); + UnionType unionType = (UnionType) catchClause.getParameter().getType(); + + assertEquals("Exception | AssertionError", LexicalPreservingPrinter.print(unionType)); + } + + @Test + void printParameterHavingUnionType() { + String code = "class A {{try { doit(); } catch (Exception | AssertionError e) {}}}"; + considerCode(code); + InitializerDeclaration initializerDeclaration = + (InitializerDeclaration) cu.getType(0).getMembers().get(0); + TryStmt tryStmt = + (TryStmt) initializerDeclaration.getBody().getStatements().get(0); + CatchClause catchClause = tryStmt.getCatchClauses().get(0); + Parameter parameter = catchClause.getParameter(); + + assertEquals("Exception | AssertionError e", LexicalPreservingPrinter.print(parameter)); + } + + @Test + void printLambaWithUntypedParams() { + String code = "class A {Function f = a -> a;}"; + considerCode(code); + + assertEquals("class A {Function f = a -> a;}", LexicalPreservingPrinter.print(cu)); + } + + @Test + void printAModuleInfoSpecificKeywordUsedAsIdentifier1() { + considerCode("class module { }"); + + cu.getClassByName("module").get().setName("xyz"); + + assertEquals("class xyz { }", LexicalPreservingPrinter.print(cu)); + } + + @Test + void printAModuleInfoSpecificKeywordUsedAsIdentifier2() { + considerCode("class xyz { }"); + + cu.getClassByName("xyz").get().setName("module"); + + assertEquals("class module { }", LexicalPreservingPrinter.print(cu)); + } + + // Issue 823: setPackageDeclaration on CU starting with a comment + @Test + void reactToSetPackageDeclarationOnCuStartingWithComment() { + considerCode("// Hey, this is a comment\n" + "\n" + "\n" + "// Another one\n" + "\n" + "class A {}"); + cu.setPackageDeclaration("org.javaparser.lexicalpreservation.examples"); + } + + @Test + void printLambdaIntersectionTypeAssignment() { + String code = "class A {" + LineSeparator.SYSTEM + " void f() {" + + LineSeparator.SYSTEM + " Runnable r = (Runnable & Serializable) (() -> {});" + + LineSeparator.SYSTEM + " r = (Runnable & Serializable)() -> {};" + + LineSeparator.SYSTEM + " r = (Runnable & I)() -> {};" + + LineSeparator.SYSTEM + " }}"; + considerCode(code); + + assertEquals(code, LexicalPreservingPrinter.print(cu)); + } + + @Test + void printLambdaIntersectionTypeReturn() { + String code = "class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"; + considerCode(code); + + assertEquals(code, LexicalPreservingPrinter.print(cu)); + } + + // See issue #855 + @Test + void handleOverrideAnnotation() { + considerCode("public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}"); + + cu.getTypes().forEach(type -> type.getMembers().forEach(member -> { + if (member instanceof MethodDeclaration) { + MethodDeclaration methodDeclaration = (MethodDeclaration) member; + if (!methodDeclaration.getAnnotationByName("Override").isPresent()) { + methodDeclaration.addAnnotation("Override"); + } + } + })); + assertEquals( + "public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void preserveSpaceAsIsForASimpleClassWithMoreFormatting() throws IOException { + considerExample("ASimpleClassWithMoreFormatting"); + assertEquals(readExample("ASimpleClassWithMoreFormatting"), LexicalPreservingPrinter.print(cu)); + } + + @Test + void renameASimpleClassWithMoreFormatting() throws IOException { + considerExample("ASimpleClassWithMoreFormatting"); + + cu.getClassByName("ASimpleClass").get().setName("MyRenamedClass"); + assertEquals(readExample("ASimpleClassWithMoreFormatting_step1"), LexicalPreservingPrinter.print(cu)); + } + + @Test + void theLexicalPreservationStringForAnAddedMethodShouldBeIndented() throws IOException { + considerExample("ASimpleClassWithMoreFormatting"); + + cu.getClassByName("ASimpleClass").get().setName("MyRenamedClass"); + MethodDeclaration setter = cu.getClassByName("MyRenamedClass").get().addMethod("setAField", PUBLIC); + assertEquals( + "public void setAField() {" + LineSeparator.SYSTEM + " }", LexicalPreservingPrinter.print(setter)); + } + + @Test + void addMethodToASimpleClassWithMoreFormatting() throws IOException { + considerExample("ASimpleClassWithMoreFormatting"); + + cu.getClassByName("ASimpleClass").get().setName("MyRenamedClass"); + MethodDeclaration setter = cu.getClassByName("MyRenamedClass").get().addMethod("setAField", PUBLIC); + TestUtils.assertEqualsStringIgnoringEol( + readExample("ASimpleClassWithMoreFormatting_step2"), LexicalPreservingPrinter.print(cu)); + } + + @Test + void addingParameterToAnAddedMethodInASimpleClassWithMoreFormatting() throws IOException { + considerExample("ASimpleClassWithMoreFormatting"); + + cu.getClassByName("ASimpleClass").get().setName("MyRenamedClass"); + MethodDeclaration setter = cu.getClassByName("MyRenamedClass").get().addMethod("setAField", PUBLIC); + setter.addParameter("boolean", "aField"); + TestUtils.assertEqualsStringIgnoringEol( + readExample("ASimpleClassWithMoreFormatting_step3"), LexicalPreservingPrinter.print(cu)); + } + + @Test + void findIndentationOfEmptyMethod() throws IOException { + considerExample("ASimpleClassWithMoreFormatting_step3"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + assertEquals(4, LexicalPreservingPrinter.findIndentation(setter).size()); + assertEquals( + 4, + LexicalPreservingPrinter.findIndentation(setter.getBody().get()).size()); + } + + @Test + void findIndentationOfMethodWithStatements() throws IOException { + considerExample("ASimpleClassWithMoreFormatting_step4"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + assertEquals(4, LexicalPreservingPrinter.findIndentation(setter).size()); + assertEquals( + 4, + LexicalPreservingPrinter.findIndentation(setter.getBody().get()).size()); + assertEquals( + 8, + LexicalPreservingPrinter.findIndentation(setter.getBody().get().getStatement(0)) + .size()); + } + + @Test + void addingStatementToAnAddedMethodInASimpleClassWithMoreFormatting() throws IOException { + considerExample("ASimpleClassWithMoreFormatting"); + + cu.getClassByName("ASimpleClass").get().setName("MyRenamedClass"); + MethodDeclaration setter = cu.getClassByName("MyRenamedClass").get().addMethod("setAField", PUBLIC); + setter.addParameter("boolean", "aField"); + setter.getBody() + .get() + .getStatements() + .add(new ExpressionStmt(new AssignExpr( + new FieldAccessExpr(new ThisExpr(), "aField"), + new NameExpr("aField"), + AssignExpr.Operator.ASSIGN))); + TestUtils.assertEqualsStringIgnoringEol( + readExample("ASimpleClassWithMoreFormatting_step4"), LexicalPreservingPrinter.print(cu)); + } + + @Test + void addingStatementToAnAddedMethodInASimpleClassWithMoreFormattingFromStep3() throws IOException { + considerExample("ASimpleClassWithMoreFormatting_step3"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + setter.getBody() + .get() + .getStatements() + .add(new ExpressionStmt(new AssignExpr( + new FieldAccessExpr(new ThisExpr(), "aField"), + new NameExpr("aField"), + AssignExpr.Operator.ASSIGN))); + assertEquals(readExample("ASimpleClassWithMoreFormatting_step4"), LexicalPreservingPrinter.print(cu)); + } + + @Test + void nodeTextForMethod() throws IOException { + considerExample("ASimpleClassWithMoreFormatting_step4"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + NodeText nodeText; + + nodeText = getTextForNode(setter); + int index = 0; + assertTrue(nodeText.getElements().get(index++).isChildOfClass(Modifier.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(VoidType.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(SimpleName.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.LPAREN)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(Parameter.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.RPAREN)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(BlockStmt.class)); + assertEquals(index, nodeText.getElements().size()); + + nodeText = getTextForNode(setter.getBody().get()); + index = 0; + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.LBRACE)); + assertTrue(nodeText.getElements().get(index++).isNewline()); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(ExpressionStmt.class)); + assertTrue(nodeText.getElements().get(index++).isNewline()); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.RBRACE)); + assertEquals(index, nodeText.getElements().size()); + + nodeText = getTextForNode(setter.getBody().get().getStatement(0)); + index = 0; + assertTrue(nodeText.getElements().get(index++).isChildOfClass(AssignExpr.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SEMICOLON)); + assertEquals(index, nodeText.getElements().size()); + } + + @Test + void nodeTextForModifiedMethod() throws IOException { + considerExample("ASimpleClassWithMoreFormatting_step3"); + + MethodDeclaration setter = cu.getClassByName("MyRenamedClass") + .get() + .getMethodsByName("setAField") + .get(0); + setter.getBody() + .get() + .getStatements() + .add(new ExpressionStmt(new AssignExpr( + new FieldAccessExpr(new ThisExpr(), "aField"), + new NameExpr("aField"), + AssignExpr.Operator.ASSIGN))); + NodeText nodeText; + + nodeText = getTextForNode(setter); + int index = 0; + assertTrue(nodeText.getElements().get(index++).isChildOfClass(Modifier.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(VoidType.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(SimpleName.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.LPAREN)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(Parameter.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.RPAREN)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(BlockStmt.class)); + assertEquals(index, nodeText.getElements().size()); + + nodeText = getTextForNode(setter.getBody().get()); + index = 0; + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.LBRACE)); + assertTrue(nodeText.getElements().get(index++).isNewline()); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isChildOfClass(ExpressionStmt.class)); + assertTrue(nodeText.getElements().get(index++).isNewline()); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SPACE)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.RBRACE)); + assertEquals(index, nodeText.getElements().size()); + + nodeText = LexicalPreservingPrinter.getOrCreateNodeText( + setter.getBody().get().getStatement(0)); + index = 0; + assertTrue(nodeText.getElements().get(index++).isChildOfClass(AssignExpr.class)); + assertTrue(nodeText.getElements().get(index++).isToken(GeneratedJavaParserConstants.SEMICOLON)); + assertEquals(index, nodeText.getElements().size()); + } + + // See issue #926 + @Test + void addASecondStatementToExistingMethod() throws IOException { + considerExample("MethodWithOneStatement"); + + MethodDeclaration methodDeclaration = + cu.getType(0).getMethodsByName("someMethod").get(0); + methodDeclaration + .getBody() + .get() + .getStatements() + .add(new ExpressionStmt(new VariableDeclarationExpr(new VariableDeclarator( + parseClassOrInterfaceType("String"), "test2", new StringLiteralExpr(""))))); + TestUtils.assertEqualsStringIgnoringEol( + "public void someMethod() {" + LineSeparator.SYSTEM + + " String test = \"\";" + LineSeparator.SYSTEM + + " String test2 = \"\";" + LineSeparator.SYSTEM + // HACK: The right closing brace should not have indentation + // because the original method did not introduce indentation, + // however due to necessity this test was left with indentation, + // in a later version it should be revised. + + " }", + LexicalPreservingPrinter.print(methodDeclaration)); + } + + // See issue #866 + @Test + void moveOverrideAnnotations() { + considerCode("public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected @Override void initializePage() {}" + + LineSeparator.SYSTEM + "}"); + + cu.getTypes().forEach(type -> type.getMembers() + .forEach(member -> member.ifMethodDeclaration(methodDeclaration -> { + if (methodDeclaration.getAnnotationByName("Override").isPresent()) { + + while (methodDeclaration.getAnnotations().isNonEmpty()) { + AnnotationExpr annotationExpr = + methodDeclaration.getAnnotations().get(0); + annotationExpr.remove(); + } + + methodDeclaration.addMarkerAnnotation("Override"); + } + }))); + assertEquals( + "public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + // See issue #866 + @Test + void moveOrAddOverrideAnnotations() { + considerCode("public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected @Override void initializePage() {}" + + LineSeparator.SYSTEM + "}"); + + cu.getTypes().forEach(type -> type.getMembers().forEach(member -> { + if (member instanceof MethodDeclaration) { + MethodDeclaration methodDeclaration = (MethodDeclaration) member; + if (methodDeclaration.getAnnotationByName("Override").isPresent()) { + + while (methodDeclaration.getAnnotations().isNonEmpty()) { + AnnotationExpr annotationExpr = + methodDeclaration.getAnnotations().get(0); + annotationExpr.remove(); + } + } + methodDeclaration.addMarkerAnnotation("Override"); + } + })); + assertEquals( + "public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + // See issue #865 + @Test + void handleAddingMarkerAnnotation() { + considerCode("public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}"); + + cu.getTypes().forEach(type -> type.getMembers().forEach(member -> { + if (member instanceof MethodDeclaration) { + MethodDeclaration methodDeclaration = (MethodDeclaration) member; + if (!methodDeclaration.getAnnotationByName("Override").isPresent()) { + methodDeclaration.addMarkerAnnotation("Override"); + } + } + })); + assertEquals( + "public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + // See issue #865 + @Test + void handleOverrideMarkerAnnotation() { + considerCode("public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}"); + + cu.getTypes().forEach(type -> type.getMembers() + .forEach(member -> member.ifMethodDeclaration( + methodDeclaration -> methodDeclaration.addMarkerAnnotation("Override")))); + assertEquals( + "public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + // See issue #865 + @Test + void handleOverrideAnnotationAlternative() { + considerCode("public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}"); + + cu.getTypes().forEach(type -> type.getMembers() + .forEach(member -> + member.ifMethodDeclaration(methodDeclaration -> methodDeclaration.addAnnotation("Override")))); + assertEquals( + "public class TestPage extends Page {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void test() {}" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " @Override" + + LineSeparator.SYSTEM + " protected void initializePage() {}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void invokeModifierVisitor() { + considerCode("class A {" + LineSeparator.SYSTEM + + " Object f() {" + LineSeparator.SYSTEM + + " return (Comparator> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey()); " + + LineSeparator.SYSTEM + + "}}"); + cu.accept(new ModifierVisitor<>(), null); + } + + @Test + void handleDeprecatedAnnotationFinalClass() { + considerCode("public final class A {}"); + + cu.getTypes().forEach(type -> type.addAndGetAnnotation(Deprecated.class)); + + assertEquals( + "@Deprecated" + LineSeparator.SYSTEM + "public final class A {}", LexicalPreservingPrinter.print(cu)); + } + + @Test + void handleDeprecatedAnnotationAbstractClass() { + considerCode("public abstract class A {}"); + + cu.getTypes().forEach(type -> type.addAndGetAnnotation(Deprecated.class)); + + assertEquals( + "@Deprecated" + LineSeparator.SYSTEM + "public abstract class A {}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void issue1244() { + considerCode("public class Foo {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + "// Some comment" + LineSeparator.SYSTEM + LineSeparator.SYSTEM // does work with only one \n + + "public void writeExternal() {}" + LineSeparator.SYSTEM + "}"); + + cu.findAll(ClassOrInterfaceDeclaration.class).forEach(c -> { + List methods = c.getMethodsByName("writeExternal"); + for (MethodDeclaration method : methods) { + c.remove(method); + } + }); + assertEqualsStringIgnoringEol( + "public class Foo {\n" + "// Some comment\n\n" + "}", LexicalPreservingPrinter.print(cu)); + } + + static class AddFooCallModifierVisitor extends ModifierVisitor { + @Override + public Visitable visit(MethodCallExpr n, Void arg) { + // Add a call to foo() on every found method call + return new MethodCallExpr(n, "foo"); + } + } + + // See issue 1277 + @Test + void testInvokeModifierVisitor() { + considerCode("class A {" + LineSeparator.SYSTEM + " public String message = \"hello\";" + + LineSeparator.SYSTEM + " void bar() {" + + LineSeparator.SYSTEM + " System.out.println(\"hello\");" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}"); + + cu.accept(new AddFooCallModifierVisitor(), null); + } + + static class CallModifierVisitor extends ModifierVisitor { + @Override + public Visitable visit(MethodCallExpr n, Void arg) { + // Add a call to foo() on every found method call + return new MethodCallExpr(n.clone(), "foo"); + } + } + + @Test + void invokeModifierVisitorIssue1297() { + considerCode("class A {" + LineSeparator.SYSTEM + " public void bar() {" + + LineSeparator.SYSTEM + " System.out.println(\"hello\");" + + LineSeparator.SYSTEM + " System.out.println(\"hello\");" + + LineSeparator.SYSTEM + " // comment" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}"); + + cu.accept(new CallModifierVisitor(), null); + } + + @Test + void addedBlockCommentsPrinted() { + considerCode("public class Foo { }"); + + cu.getClassByName("Foo").get().addMethod("mymethod").setBlockComment("block"); + assertEqualsStringIgnoringEol( + "public class Foo {" + LineSeparator.SYSTEM + " /*block*/" + + LineSeparator.SYSTEM + " void mymethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void addedLineCommentsPrinted() { + considerCode("public class Foo { }"); + + cu.getClassByName("Foo").get().addMethod("mymethod").setLineComment("line"); + assertEqualsStringIgnoringEol( + "public class Foo {" + LineSeparator.SYSTEM + " //line" + + LineSeparator.SYSTEM + " void mymethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void removedLineCommentsPrinted() { + considerCode("public class Foo {" + LineSeparator.SYSTEM + "//line" + + LineSeparator.SYSTEM + "void mymethod() {" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM + "}"); + cu.getAllContainedComments().get(0).remove(); + + assertEqualsStringIgnoringEol( + "public class Foo {" + LineSeparator.SYSTEM + "void mymethod() {" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + // Checks if comments get removed properly with Unix style line endings + @Test + void removedLineCommentsPrintedUnix() { + considerCode("public class Foo {" + "\n" + "//line" + "\n" + "void mymethod() {" + "\n" + "}" + "\n" + "}"); + cu.getAllContainedComments().get(0).remove(); + + assertEquals( + "public class Foo {" + "\n" + "void mymethod() {" + "\n" + "}" + "\n" + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void removedBlockCommentsPrinted() { + considerCode("public class Foo {" + LineSeparator.SYSTEM + "/*" + + LineSeparator.SYSTEM + "Block comment coming through" + + LineSeparator.SYSTEM + "*/" + + LineSeparator.SYSTEM + "void mymethod() {" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM + "}"); + cu.getAllContainedComments().get(0).remove(); + + assertEqualsStringIgnoringEol( + "public class Foo {" + LineSeparator.SYSTEM + "void mymethod() {" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM + "}", + LexicalPreservingPrinter.print(cu)); + } + + @Test + void testFixIndentOfMovedNode() { + try { + considerExample("FixIndentOfMovedNode"); + + cu.getClassByName("ThisIsASampleClass") + .get() + .getMethodsByName("longerMethod") + .get(0) + .setBlockComment("Lorem ipsum dolor sit amet, consetetur sadipscing elitr."); + + cu.getClassByName("Foo") + .get() + .getFieldByName("myFoo") + .get() + .setLineComment("sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat"); + + String expectedCode = readExample("FixIndentOfMovedNodeExpected"); + assertEquals(expectedCode, LexicalPreservingPrinter.print(cu)); + } catch (IOException ex) { + fail("Could not read test code", ex); + } + } + + @Test + void issue1321() { + considerCode("class X { X() {} private void testme() {} }"); + + ClassOrInterfaceDeclaration type = cu.getClassByName("X").get(); + type.getConstructors().get(0).setBody(new BlockStmt().addStatement("testme();")); + + assertEqualsStringIgnoringEol( + "class X { X() {\n testme();\n} private void testme() {} }", LexicalPreservingPrinter.print(cu)); + } + + @Test + void issue2001() { + considerCode("class X {void blubb(){X.p(\"blaubb04\");}}"); + + cu.findAll(MethodCallExpr.class).forEach(Node::removeForced); + + assertEqualsStringIgnoringEol("class X {void blubb(){}}", LexicalPreservingPrinter.print(cu)); + } + + @Test + void testIndentOfCodeBlocks() throws IOException { + considerExample("IndentOfInsertedCodeBlocks"); + + IfStmt ifStmt = new IfStmt(); + ifStmt.setCondition(StaticJavaParser.parseExpression("name.equals(\"foo\")")); + BlockStmt blockStmt = new BlockStmt(); + blockStmt.addStatement(StaticJavaParser.parseStatement("int i = 0;")); + blockStmt.addStatement(StaticJavaParser.parseStatement("System.out.println(i);")); + blockStmt.addStatement(new IfStmt() + .setCondition(StaticJavaParser.parseExpression("i < 0")) + .setThenStmt(new BlockStmt().addStatement(StaticJavaParser.parseStatement("i = 0;")))); + blockStmt.addStatement(StaticJavaParser.parseStatement("new Object(){};")); + ifStmt.setThenStmt(blockStmt); + ifStmt.setElseStmt(new BlockStmt()); + + cu.findFirst(BlockStmt.class).get().addStatement(ifStmt); + String expected = considerExample("IndentOfInsertedCodeBlocksExpected"); + TestUtils.assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + @Test + void commentAddedAtTopLevel() { + considerCode("package x;class X{}"); + + cu.setComment(new LineComment("Bla")); + assertEqualsStringIgnoringEol("//Bla\npackage x;class X{}", LexicalPreservingPrinter.print(cu)); + + cu.setComment(new LineComment("BlaBla")); + assertEqualsStringIgnoringEol("//BlaBla\npackage x;class X{}", LexicalPreservingPrinter.print(cu)); + + cu.removeComment(); + assertEqualsStringIgnoringEol("package x;class X{}", LexicalPreservingPrinter.print(cu)); + } + + @Test + public void testReplaceStringLiteral() { + considerExpression("\"asd\""); + final String expected = "\"REPLACEMENT\""; + + assertTrue(expression.isStringLiteralExpr()); + StringLiteralExpr sle = (StringLiteralExpr) expression; + sle.setValue("REPLACEMENT"); + + final String actual = LexicalPreservingPrinter.print(expression); + assertEquals(expected, actual); + } + + @Test + public void testReplaceStringLiteralWithinStatement() { + considerStatement("String str = \"aaa\";"); + String expected = "String str = \"REPLACEMENT\";"; + + statement.findAll(StringLiteralExpr.class).forEach(stringLiteralExpr -> { + stringLiteralExpr.setValue("REPLACEMENT"); + }); + + assertEquals(expected, LexicalPreservingPrinter.print(statement)); + assertEquals(expected, statement.toString()); + } + + @Test + public void testReplaceClassName() { + considerCode("class A {}"); + + assertEquals(1, cu.findAll(ClassOrInterfaceDeclaration.class).size()); + cu.findAll(ClassOrInterfaceDeclaration.class).forEach(coid -> coid.setName("B")); + + final String expected = "class B {}"; + + final String actual = LexicalPreservingPrinter.print(cu); + assertEquals(expected, actual); + } + + @Test + public void testReplaceIntLiteral() { + considerExpression("5"); + final String expected = "10"; + + assertTrue(expression.isIntegerLiteralExpr()); + ((IntegerLiteralExpr) expression).setValue("10"); + + final String actual = LexicalPreservingPrinter.print(expression); + assertEquals(expected, actual); + } + + @Test + public void testReplaceLongLiteral() { + considerStatement("long x = 5L;"); + String expected = "long x = 10L;"; + + statement.findAll(LongLiteralExpr.class).forEach(longLiteralExpr -> { + longLiteralExpr.setValue("10L"); + }); + + final String actual = LexicalPreservingPrinter.print(statement); + assertEquals(expected, actual); + } + + @Test + public void testReplaceBooleanLiteral() { + considerStatement("boolean x = true;"); + String expected = "boolean x = false;"; + + statement.findAll(BooleanLiteralExpr.class).forEach(booleanLiteralExpr -> { + booleanLiteralExpr.setValue(false); + }); + + final String actual = LexicalPreservingPrinter.print(statement); + assertEquals(expected, actual); + } + + @Test + public void testReplaceDoubleLiteral() { + considerStatement("double x = 5.0D;"); + String expected = "double x = 10.0D;"; + + statement.findAll(DoubleLiteralExpr.class).forEach(doubleLiteralExpr -> { + doubleLiteralExpr.setValue("10.0D"); + }); + + final String actual = LexicalPreservingPrinter.print(statement); + assertEquals(expected, actual); + } + + @Test + public void testReplaceCharLiteral() { + considerStatement("char x = 'a';"); + String expected = "char x = 'b';"; + + statement.findAll(CharLiteralExpr.class).forEach(charLiteralExpr -> { + charLiteralExpr.setValue("b"); + }); + + final String actual = LexicalPreservingPrinter.print(statement); + assertEquals(expected, actual); + } + + @Test + public void testReplaceCharLiteralUnicode() { + considerStatement("char x = 'a';"); + String expected = "char x = '\\u0000';"; + + statement.findAll(CharLiteralExpr.class).forEach(charLiteralExpr -> { + charLiteralExpr.setValue("\\u0000"); + }); + + final String actual = LexicalPreservingPrinter.print(statement); + assertEquals(expected, actual); + } + + @Test + public void testReplaceTextBlockLiteral() { + final JavaParser javaParser = new JavaParser(new ParserConfiguration() + .setLexicalPreservationEnabled(true) + .setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_14)); + + String code = "String x = \"\"\"a\"\"\";"; + String expected = "String x = \"\"\"\n" + " REPLACEMENT\n" + " \"\"\";"; + + final Statement b = javaParser.parseStatement(code).getResult().orElseThrow(AssertionError::new); + b.findAll(TextBlockLiteralExpr.class).forEach(textblockLiteralExpr -> { + textblockLiteralExpr.setValue("\n REPLACEMENT\n "); + }); + + final String actual = LexicalPreservingPrinter.print(b); + assertEquals(expected, actual); + } + + @Test + void testTextBlockSupport() { + String code = "String html = \"\"\"\n" + " \n" + + " \n" + + "

Hello, world

\n" + + " \n" + + " \n" + + "\"\"\";"; + String expected = "String html = \"\"\"\r\n" + + " \r\n" + + " \r\n" + + "

Hello, world

\r\n" + + " \r\n" + + " \r\n" + + "\"\"\";"; + final JavaParser javaParser = new JavaParser(new ParserConfiguration() + .setLexicalPreservationEnabled(true) + .setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_15)); + Statement stmt = javaParser.parseStatement(code).getResult().orElseThrow(AssertionError::new); + LexicalPreservingPrinter.setup(stmt); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(stmt)); + } + + @Test + void testArrayPreservation_WithSingleLanguageStyle() { + + // Given + considerCode("class Test {\n" + " int[] foo;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " int[] foo;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testArrayPreservation_WithMultipleLanguageStyle() { + + // Given + considerCode("class Test {\n" + " int[][] foo;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " int[][] foo;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testArrayPreservation_WithSingleCLanguageStyle() { + + // Given + considerCode("class Test {\n" + " int foo[];\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " int foo[];\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + /** + * Given a field that have arrays declared in C style and + * When a marker annotation is added to the code + * Assert that the result matches the expected. + * + * Issue: 3419 + */ + @Test + void testArrayPreservation_WithMultipleCLanguageStyle() { + + // Given + considerCode("class Test {\n" + " int foo[][];\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " int foo[][];\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testArrayPreservation_WithSingleBracketWithoutSpace() { + + // Given + considerCode("class Test {\n" + " int[]foo;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " int[]foo;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testArrayPreservation_WithMultipleBracketWithoutSpace() { + + // Given + considerCode("class Test {\n" + " int[][]foo;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " int[][]foo;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testClassOrInterfacePreservationWithFullyQualifiedName_SingleType() { + // Given + considerCode("class Test {\n" + " java.lang.Object foo;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + // modification of the AST + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " java.lang.Object foo;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testClassOrInterfacePreservationWithFullyQualifiedName_ArrayType() { + // Given + considerCode("class Test {\n" + " java.lang.Object[] foo;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + // modification of the AST + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " java.lang.Object[] foo;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testClassOrInterfacePreservationWithFullyQualifiedName_MultipleVariablesDeclarationWithSameType() { + // Given + considerCode("class Test {\n" + " java.lang.Object[] foo, bar;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + // modification of the AST + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " java.lang.Object[] foo, bar;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + @Test + void testClassOrInterfacePreservationWithFullyQualifiedName_MultipleVariablesDeclarationwithDifferentType() { + // Given + considerCode("class Test {\n" + " java.lang.Object foo[], bar;\n" + "}"); + + // When + FieldDeclaration fooField = cu.findFirst(FieldDeclaration.class).orElseThrow(AssertionError::new); + // modification of the AST + fooField.addMarkerAnnotation("Nullable"); + + // Assert + String expectedCode = "class Test {\n" + " @Nullable\n" + " java.lang.Object foo[], bar;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + // issue 3588 Modifier is removed when removing an annotation. + @Test + void testRemovingInlinedAnnotation() { + // Given + considerCode("public class Foo{\n" + " protected @Nullable Object bar;\n" + "}"); + + // When + FieldDeclaration fd = cu.findFirst(FieldDeclaration.class).get(); + // modification of the AST + AnnotationExpr ae = fd.getAnnotations().get(0); + ae.remove(); + + // Assert + String expectedCode = "public class Foo{\n" + " protected Object bar;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + // issue 3588 Modifier is removed when removing an annotation. + @Test + void testRemovingInlinedAnnotation_alternate_case() { + // Given + considerCode("public class Foo{\n" + " @Nullable protected Object bar;\n" + "}"); + + // When + FieldDeclaration fd = cu.findFirst(FieldDeclaration.class).get(); + // modification of the AST + AnnotationExpr ae = fd.getAnnotations().get(0); + ae.remove(); + + // Assert + String expectedCode = "public class Foo{\n" + " protected Object bar;\n" + "}"; + assertTransformedToString(expectedCode, cu); + } + + // issue 3216 LexicalPreservingPrinter add Wrong indentation when removing comments + @Test + void removedIndentationLineCommentsPrinted() { + considerCode("public class Foo {\n" + " //line \n" + " void mymethod() {\n" + " }\n" + "}"); + String expected = "public class Foo {\n" + " void mymethod() {\n" + " }\n" + "}"; + cu.getAllContainedComments().get(0).remove(); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + // issue 4311 IllegalStateException when removing all comments with LexicalPreservingPrinter + @Test + void removedLineCommentsWithSameContent() { + considerCode( + "public class Foo {\n" + " //line 1 \n" + " //line 1 \n" + " void mymethod() {\n" + " }\n" + "}"); + String expected = "public class Foo {\n" + " void mymethod() {\n" + " }\n" + "}"; + cu.getAllContainedComments().stream().forEach(c -> c.remove()); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + // issue 3216 LexicalPreservingPrinter add Wrong indentation when removing comments + @Test + void removedIndentationBlockCommentsPrinted() { + considerCode("public class Foo {\n" + " /*\n" + + " *Block comment coming through\n" + + " */\n" + + " void mymethod() {\n" + + " }\n" + + "}"); + String expected = "public class Foo {\n" + " void mymethod() {\n" + " }\n" + "}"; + cu.getAllContainedComments().get(0).remove(); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + // issue 3216 LexicalPreservingPrinter add Wrong indentation when removing comments + @Test + void removedIndentationJavaDocCommentsPrinted() { + considerCode("public class Foo {\n" + " /**\n" + + " *JavaDoc comment coming through\n" + + " */\n" + + " void mymethod() {\n" + + " }\n" + + "}"); + String expected = "public class Foo {\n" + " void mymethod() {\n" + " }\n" + "}"; + cu.getAllContainedComments().get(0).remove(); + + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + @Test + void addingOrphanCommentToType() { + String actual = "public class Foo {\n" + "}"; + + String expected = "//added comment\n" + "public class Foo {\n" + "}"; + + considerCode(actual); + cu.getTypes().get(0).addOrphanComment(new LineComment("added comment")); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + @Test + void addingOrphanCommentToBlock() { + String actual = "public class Foo {\n" + "}"; + + String expected = "//added comment\n" + "public class Foo {\n" + "}"; + + considerCode(actual); + cu.getTypes().get(0).getChildNodes().get(0).addOrphanComment(new LineComment("added comment")); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + @Test + void addingOrphanCommentToBlockInMethodDeclaration() { + String actual = "public class Foo {\n" + " boolean m() {\n" + " return true;\n" + " }\n" + "}"; + + // that's probably not what we want, + // but this is what is implemented in LexicalPreservingPrinter.Observer.concretePropertyChange(..) + String expected = "public class Foo {\n" + + " boolean m() //added comment\n" + + "{\n" + + " return true;\n" + + " }\n" + + "}"; + + considerCode(actual); + cu.findAll(BlockStmt.class).get(0).addOrphanComment(new LineComment("added comment")); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + @Test + void addingOrphanCommentToBlockInMethodDeclaration2() { + String actual = "public class Foo {\n" + " boolean m() \n" + " {\n" + " return true;\n" + " }\n" + "}"; + + String expected = "public class Foo {\n" + + " boolean m() \n" + + " //added comment\n" + + " {\n" + + " return true;\n" + + " }\n" + + "}"; + + considerCode(actual); + cu.findAll(BlockStmt.class).get(0).addOrphanComment(new LineComment("added comment")); + assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); + } + + // issue 3800 determine whether active + @Test + void checkLPPIsAvailableOnNode() { + String code = "class A {void foo(int p1, float p2) { }}"; + CompilationUnit cu = StaticJavaParser.parse(code); + MethodDeclaration md = cu.findFirst(MethodDeclaration.class).get(); + LexicalPreservingPrinter.setup(md); + + assertTrue(LexicalPreservingPrinter.isAvailableOn(md)); + assertFalse(LexicalPreservingPrinter.isAvailableOn(cu)); + } + + // issue 4442 + @Test + void handleUnexpectedToken() { + String code = "public class Foo {\n" + ";\n" + + // <-- this is the unexpected token + " public void func(){};\n" + + "\n" + + "}"; + + String expected = "import com.github.javaparser.ast.Generated;\n" + + "\n" + + "@Generated\n" + + "public class Foo {\n" + + ";\n" + + " public void func(){};\n" + + "\n" + + "}"; + + considerCode(code); + + ClassOrInterfaceDeclaration md = + cu.findFirst(ClassOrInterfaceDeclaration.class).get(); + md.addAnnotation(Generated.class); + String modifiedContent = LexicalPreservingPrinter.print(cu); + System.out.println(modifiedContent); + assertEquals(expected, LexicalPreservingPrinter.print(cu)); + } + + // issue 1821 Switch toString to LexicalPreservingPrinter when configured + @Test + void checkLPPIsDefaultPrinter() { + String code = "class A {void foo(int p1, float p2) { }}"; + StaticJavaParser.getParserConfiguration().setLexicalPreservationEnabled(true); + CompilationUnit cu = StaticJavaParser.parse(code); + assertEquals(code, cu.toString()); + } + + @Test + void checkLegacyLPPExecution() { + String code = "class A {void foo(int p1, float p2) { }}"; + StaticJavaParser.getParserConfiguration().setLexicalPreservationEnabled(true); + CompilationUnit cu = StaticJavaParser.parse(code); + LexicalPreservingPrinter.setup(cu); + assertEquals(cu.toString(), LexicalPreservingPrinter.print(cu)); + } + + @Test + void checkLPPIsNotDefaultPrinter() { + String code = "class A {void foo(int p1, float p2) { }}"; + CompilationUnit cu = StaticJavaParser.parse(code); + assertNotEquals(code, cu.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PeekingIteratorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PeekingIteratorTest.java new file mode 100644 index 0000000..a5dabf3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PeekingIteratorTest.java @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.*; + +class PeekingIteratorTest { + + private static final List EMPTY_LIST = new ArrayList(); + + private static List NON_EMPTY_LIST; + + private PeekingIterator peekingIterator; + + @BeforeAll + static void setUpBeforeClass() throws Exception {} + + @AfterAll + static void tearDownAfterClass() throws Exception {} + + @BeforeEach + void setUp() throws Exception { + NON_EMPTY_LIST = Arrays.asList("A", "B", "C"); + } + + @AfterEach + void tearDown() throws Exception {} + + @Test + void testHasNext() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertFalse(peekingIterator.hasNext()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertTrue(peekingIterator.hasNext()); + } + + @Test + void testPeek() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertEquals(null, peekingIterator.peek()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertEquals("A", peekingIterator.peek()); + assertEquals("A", peekingIterator.next()); + } + + @Test + void testElement() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertEquals(null, peekingIterator.peek()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertEquals("A", peekingIterator.peek()); + assertEquals(1, peekingIterator.nextIndex()); + } + + @Test + void testNext() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertThrows(NoSuchElementException.class, () -> peekingIterator.next()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertEquals("A", peekingIterator.next()); + } + + @Test + void testRemove() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertThrows(IllegalStateException.class, () -> peekingIterator.remove()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertThrows(IllegalStateException.class, () -> peekingIterator.remove()); + String result = peekingIterator.next(); + assertThrows(UnsupportedOperationException.class, () -> peekingIterator.remove()); + } + + @Test + void testHasPrevious() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertFalse(peekingIterator.hasPrevious()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertFalse(peekingIterator.hasPrevious()); + String result = peekingIterator.next(); + assertTrue(peekingIterator.hasPrevious()); + } + + @Test + void testPrevious() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertThrows(NoSuchElementException.class, () -> peekingIterator.previous()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertThrows(NoSuchElementException.class, () -> peekingIterator.previous()); + } + + @Test + void testNextIndex() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertEquals(0, peekingIterator.nextIndex()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertEquals(0, peekingIterator.nextIndex()); + } + + @Test + void testPreviousIndex() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertEquals(-1, peekingIterator.previousIndex()); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertEquals(-1, peekingIterator.previousIndex()); + } + + @Test + void testSet() { + peekingIterator = new PeekingIterator(EMPTY_LIST.listIterator()); + assertThrows(IllegalStateException.class, () -> peekingIterator.set("D")); + peekingIterator = new PeekingIterator(NON_EMPTY_LIST.listIterator()); + assertThrows(IllegalStateException.class, () -> peekingIterator.set("D")); + peekingIterator.next(); + peekingIterator.set("D"); + assertEquals(3, NON_EMPTY_LIST.size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PrettyPrinterIssue2340Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PrettyPrinterIssue2340Test.java new file mode 100644 index 0000000..ca78ef3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PrettyPrinterIssue2340Test.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Modifier.Keyword; +import org.junit.jupiter.api.Test; + +class PrettyPrinterIssue2340Test extends AbstractLexicalPreservingTest { + + @Test + void printingVariableDeclarationWithAddedModifier() { + String def2 = "List i"; + considerVariableDeclaration(def2); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + } + + @Test + void printingGenericVariableDeclarationWithAddedModifier() { + String def2 = "List i"; + considerVariableDeclaration(def2); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + } + + @Test + void printingGenericVariableDeclarationWithAddedModifierWithAnotherSyntaxe() { + String def2 = "List i"; + considerVariableDeclaration(def2); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + } + + @Test + void printingGeneric2VariableDeclarationWithAddedModifier() { + String def2 = "List> i"; + considerVariableDeclaration(def2); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + } + + @Test + void printingGeneric2VariableDeclarationWithAddedModifierWithAnotherSyntaxe() { + String def2 = "List < List < String > > i"; + considerVariableDeclaration(def2); + expression.asVariableDeclarationExpr().getModifiers().addFirst(Modifier.privateModifier()); + assertTrue(LexicalPreservingPrinter.getOrCreateNodeText(expression).getElements().stream() + .anyMatch(elem -> elem.expand().equals(Keyword.PRIVATE.asString()))); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PrettyPrinterIssue2351Test.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PrettyPrinterIssue2351Test.java new file mode 100644 index 0000000..2e74979 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/PrettyPrinterIssue2351Test.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.body.EnumDeclaration; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +// manage java.lang.UnsupportedOperationException: Csm token token(}) NodeText TOKEN ";" <102> (line 1,col 39)-(line +// 1,col 39) +class PrettyPrinterIssue2351Test extends AbstractLexicalPreservingTest { + + @Test + void printingEnum2() { + String def2 = "public enum RandomEnum {" + " TYPE_1;" + "}"; + considerCode(def2); + Optional decl = cu.findFirst(EnumDeclaration.class); + if (decl.isPresent()) decl.get().addEnumConstant("SOMETHING"); + assertTrue(decl.get().getEntries().size() == 2); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/TransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/TransformationsTest.java new file mode 100644 index 0000000..518a871 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/TransformationsTest.java @@ -0,0 +1,323 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation; + +import static com.github.javaparser.ast.Modifier.Keyword.STATIC; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.NullLiteralExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.type.ArrayType; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.utils.LineSeparator; +import java.io.IOException; +import org.junit.jupiter.api.Test; + +/** + * These tests are more "high level" than the ones in LexicalPreservingPrinterTest. + * The idea is to perform some transformations on the code, print it back and see if the generated code + * is the expected one. We do not care about the internal state of LexicalPreservingPrinter, just the visible result. + */ +class TransformationsTest extends AbstractLexicalPreservingTest { + + @Test + void unchangedSimpleClasses() throws IOException { + assertUnchanged("Example1"); + assertUnchanged("Example2"); + } + + @Test + void unchangedComplexFile() throws IOException { + assertUnchanged("Example4"); + } + + @Test + void example1() throws IOException { + considerExample("Example1_original"); + cu.getClassByName("A").get().getFieldByName("a").get().setModifiers(STATIC); + assertTransformed("Example1", cu); + } + + @Test + void example2() throws IOException { + considerExample("Example2_original"); + cu.getClassByName("A").get().getFieldByName("a").get().getVariable(0).setInitializer("10"); + assertTransformed("Example2", cu); + } + + @Test + void example3() throws IOException { + considerExample("Example3_original"); + cu.getClassByName("A").get().getFieldByName("a").get().getVariable(0).setInitializer((Expression) null); + assertTransformed("Example3", cu); + } + + @Test + void example5() throws IOException { + considerExample("Example5_original"); + cu.getClassByName("A").get().getFieldByName("a").get().getVariable(0).setInitializer(new NullLiteralExpr()); + assertTransformed("Example5", cu); + } + + @Test + void example6() throws IOException { + considerExample("Example6_original"); + cu.getClassByName("A").get().getFieldByName("a").get().getVariable(0).setName("someOtherName"); + assertTransformed("Example6", cu); + } + + @Test + void example7() throws IOException { + considerExample("Example7_original"); + cu.getClassByName("A") + .get() + .getFieldByName("a") + .get() + .getVariable(0) + .setType(new ArrayType(PrimitiveType.intType())); + assertTransformed("Example7", cu); + } + + @Test + void example8() throws IOException { + considerExample("Example8_original"); + FieldDeclaration fd = cu.getClassByName("A").get().getMember(0).asFieldDeclaration(); + fd.addVariable(new VariableDeclarator(PrimitiveType.intType(), "b")); + assertTransformed("Example8", cu); + } + + @Test + void example9() throws IOException { + considerExample("Example9_original"); + FieldDeclaration fd = cu.getClassByName("A").get().getMember(0).asFieldDeclaration(); + fd.addVariable(new VariableDeclarator(new ArrayType(PrimitiveType.intType()), "b")); + assertTransformed("Example9", cu); + } + + @Test + void example10() throws IOException { + considerExample("Example10_original"); + cu.getClassByName("A").get().getMembers().remove(0); + assertTransformed("Example10", cu); + } + + @Test + void exampleParam1() throws IOException { + considerExample("Example_param1_original"); + MethodDeclaration md = cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + md.addParameter("int", "p1"); + assertTransformed("Example_param1", cu); + } + + @Test + void exampleParam2() throws IOException { + considerExample("Example_param1_original"); + MethodDeclaration md = cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + md.addParameter(new ArrayType(PrimitiveType.intType()), "p1"); + md.addParameter("char", "p2"); + assertTransformed("Example_param2", cu); + } + + @Test + void exampleParam3() throws IOException { + considerExample("Example_param3_original"); + MethodDeclaration md = cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + md.getParameters().remove(0); + assertTransformed("Example_param3", cu); + } + + @Test + void exampleParam4() throws IOException { + considerExample("Example_param3_original"); + MethodDeclaration md = cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + md.getParameters().remove(1); + assertTransformed("Example_param4", cu); + } + + @Test + void exampleParam5() throws IOException { + considerExample("Example_param3_original"); + MethodDeclaration md = cu.getClassByName("A").get().getMember(0).asMethodDeclaration(); + md.setType(PrimitiveType.intType()); + assertTransformed("Example_param5b", cu); + md.getBody().get().getStatements().add(new ReturnStmt(new NameExpr("p1"))); + String expected = readExample("Example_param5" + "_expected"); + String s = LexicalPreservingPrinter.print(cu); + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void issue2099AddingStatementAfterTraillingComment1() { + considerStatement(" if(value != null) {" + LineSeparator.SYSTEM + " value.value();" + + LineSeparator.SYSTEM + " }"); + + BlockStmt blockStmt = LexicalPreservingPrinter.setup( + StaticJavaParser.parseBlock("{" + LineSeparator.SYSTEM + " value1();" + + LineSeparator.SYSTEM + " value2(); // Test" + + LineSeparator.SYSTEM + "}")); + + blockStmt.addStatement(statement); + String s = LexicalPreservingPrinter.print(blockStmt); + String expected = "{\n" + " value1();\n" + + " value2(); // Test\n" + + " if(value != null) {\n" + + " value.value();\n" + + " }\n" + + "}"; + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void issue2099AddingStatementAfterTraillingComment2() { + considerStatement(" if(value != null) {" + LineSeparator.SYSTEM + " value.value();" + + LineSeparator.SYSTEM + " }"); + + BlockStmt blockStmt = LexicalPreservingPrinter.setup( + StaticJavaParser.parseBlock("{" + LineSeparator.SYSTEM + " value1();" + + LineSeparator.SYSTEM + " value2(); /* test */" + + LineSeparator.SYSTEM + "}")); + + blockStmt.addStatement(statement); + String s = LexicalPreservingPrinter.print(blockStmt); + String expected = "{\n" + " value1();\n" + + " value2(); /* test */\n" + + " if(value != null) {\n" + + " value.value();\n" + + " }\n" + + "}"; + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void addingStatement1() { + considerStatement(" if(value != null) {" + LineSeparator.SYSTEM + " value.value();" + + LineSeparator.SYSTEM + " }"); + + CompilationUnit compilationUnit = LexicalPreservingPrinter.setup( + StaticJavaParser.parse("public class Test {" + LineSeparator.SYSTEM + " public void method() {" + + LineSeparator.SYSTEM + " value1();" + + LineSeparator.SYSTEM + " value2(); // Test" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}")); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = + (ClassOrInterfaceDeclaration) compilationUnit.getChildNodes().get(0); + MethodDeclaration methodDeclaration = + (MethodDeclaration) classOrInterfaceDeclaration.getChildNodes().get(2); + methodDeclaration.getBody().get().addStatement(statement); + + String s = LexicalPreservingPrinter.print(compilationUnit); + String expected = "public class Test {\n" + " public void method() {\n" + + " value1();\n" + + " value2(); // Test\n" + + " if(value != null) {\n" + + " value.value();\n" + + " }\n" + + " }\n" + + "}"; + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void addingStatement2() { + considerStatement(" if(value != null) {" + LineSeparator.SYSTEM + " value.value();" + + LineSeparator.SYSTEM + " }"); + + CompilationUnit compilationUnit = LexicalPreservingPrinter.setup( + StaticJavaParser.parse("public class Test {" + LineSeparator.SYSTEM + " public void method() {" + + LineSeparator.SYSTEM + " value1();" + + LineSeparator.SYSTEM + " value2();" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}")); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = + (ClassOrInterfaceDeclaration) compilationUnit.getChildNodes().get(0); + MethodDeclaration methodDeclaration = + (MethodDeclaration) classOrInterfaceDeclaration.getChildNodes().get(2); + methodDeclaration.getBody().get().addStatement(statement); + + String s = LexicalPreservingPrinter.print(compilationUnit); + String expected = "public class Test {\n" + " public void method() {\n" + + " value1();\n" + + " value2();\n" + + " if(value != null) {\n" + + " value.value();\n" + + " }\n" + + " }\n" + + "}"; + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void addingStatement3() { + considerStatement(" if(value != null) {" + LineSeparator.SYSTEM + " value.value();" + + LineSeparator.SYSTEM + " }"); + + CompilationUnit compilationUnit = LexicalPreservingPrinter.setup( + StaticJavaParser.parse("public class Test {" + LineSeparator.SYSTEM + " public void method() {" + + LineSeparator.SYSTEM + " value1();" + + LineSeparator.SYSTEM + " value2();" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}")); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = + (ClassOrInterfaceDeclaration) compilationUnit.getChildNodes().get(0); + MethodDeclaration methodDeclaration = + (MethodDeclaration) classOrInterfaceDeclaration.getChildNodes().get(2); + methodDeclaration.getBody().get().addStatement(statement); + + String s = LexicalPreservingPrinter.print(compilationUnit); + String expected = "public class Test {\n" + " public void method() {\n" + + " value1();\n" + + " value2();\n" + + " if(value != null) {\n" + + " value.value();\n" + + " }\n\n" + + " }\n" + + "}"; + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void removingInSingleMemberList() { + considerCode("class A {\n" + " int a;\n" + "}"); + cu.getClassByName("A").get().getMembers().remove(0); + String expected = "class A {\n" + "}"; + String s = LexicalPreservingPrinter.print(cu); + assertEqualsStringIgnoringEol(expected, s); + } + + @Test + void removingInMultiMembersList() { + considerCode("class A {\n" + " int a;\n" + " int b;\n" + "}"); + cu.getClassByName("A").get().getMembers().removeLast(); + String expected = "class A {\n" + " int a;\n" + "}"; + String s = LexicalPreservingPrinter.print(cu); + assertEqualsStringIgnoringEol(expected, s); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/changes/NoChangeTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/changes/NoChangeTest.java new file mode 100644 index 0000000..a53ba07 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/changes/NoChangeTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.changes; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import org.junit.jupiter.api.*; + +class NoChangeTest { + + @BeforeAll + static void setUpBeforeClass() throws Exception {} + + @AfterAll + static void tearDownAfterClass() throws Exception {} + + @BeforeEach + void setUp() throws Exception {} + + @AfterEach + void tearDown() throws Exception {} + + @Test + void getValue_WithMethodFound() { + Object o = new NoChange().getValue(ObservableProperty.ANNOTATIONS, new ClassOrInterfaceType()); + assertNotNull(o); + } + + @Test + void getValue_WithNoMethodFound() { + assertThrows( + RuntimeException.class, + () -> { + new NoChange().getValue(ObservableProperty.IMPORTS, new ClassOrInterfaceType()); + }, + "RuntimeException was expected"); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/ArrayCreationLevelTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/ArrayCreationLevelTransformationsTest.java new file mode 100644 index 0000000..7db3b25 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/ArrayCreationLevelTransformationsTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast; + +import com.github.javaparser.ast.ArrayCreationLevel; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.ArrayCreationExpr; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.NormalAnnotationExpr; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +/** + * Transforming ArrayCreationLevel and verifying the LexicalPreservation works as expected. + */ +class ArrayCreationLevelTransformationsTest extends AbstractLexicalPreservingTest { + + protected ArrayCreationLevel consider(String code) { + considerExpression("new int" + code); + ArrayCreationExpr arrayCreationExpr = expression.asArrayCreationExpr(); + return arrayCreationExpr.getLevels().get(0); + } + + // Dimension + + @Test + void addingDimension() { + ArrayCreationLevel it = consider("[]"); + it.setDimension(new IntegerLiteralExpr("10")); + assertTransformedToString("[10]", it); + } + + @Test + void removingDimension() { + ArrayCreationLevel it = consider("[10]"); + it.removeDimension(); + assertTransformedToString("[]", it); + } + + @Test + void replacingDimension() { + ArrayCreationLevel it = consider("[10]"); + it.setDimension(new IntegerLiteralExpr("12")); + assertTransformedToString("[12]", it); + } + + // Annotations + + @Test + void addingAnnotation() { + ArrayCreationLevel it = consider("[]"); + it.addAnnotation("myAnno"); + assertTransformedToString("@myAnno" + LineSeparator.SYSTEM + "[]", it); + } + + @Test + void removingAnnotation() { + ArrayCreationLevel it = consider("@myAnno []"); + it.getAnnotations().remove(0); + assertTransformedToString("[]", it); + } + + @Test + void replacingAnnotation() { + ArrayCreationLevel it = consider("@myAnno []"); + it.getAnnotations().set(0, new NormalAnnotationExpr(new Name("myOtherAnno"), new NodeList<>())); + assertTransformedToString("@myOtherAnno []", it); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/CompilationUnitTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/CompilationUnitTransformationsTest.java new file mode 100644 index 0000000..9dbdb2a --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/CompilationUnitTransformationsTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast; + +import com.github.javaparser.ast.PackageDeclaration; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +/** + * Transforming CompilationUnit and verifying the LexicalPreservation works as expected. + */ +class CompilationUnitTransformationsTest extends AbstractLexicalPreservingTest { + + // packageDeclaration + + @Test + void addingPackageDeclaration() { + considerCode("class A {}"); + cu.setPackageDeclaration(new PackageDeclaration(new Name(new Name("foo"), "bar"))); + assertTransformedToString("package foo.bar;" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + "class A {}", cu); + } + + @Test + void removingPackageDeclaration() { + considerCode("package foo.bar; class A {}"); + cu.removePackageDeclaration(); + assertTransformedToString("class A {}", cu); + } + + @Test + void replacingPackageDeclaration() { + considerCode("package foo.bar; class A {}"); + cu.setPackageDeclaration(new PackageDeclaration(new Name(new Name("foo2"), "baz"))); + assertTransformedToString( + "package foo2.baz;" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + " class A {}", cu); + } + + // imports + + // types +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/AnnotationDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/AnnotationDeclarationTransformationsTest.java new file mode 100644 index 0000000..1f278ce --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/AnnotationDeclarationTransformationsTest.java @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.AnnotationMemberDeclaration; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import java.io.IOException; +import org.junit.jupiter.api.Test; + +/** + * Transforming AnnotationDeclaration and verifying the LexicalPreservation works as expected. + */ +class AnnotationDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + @Test + void unchangedExamples() throws IOException { + assertUnchanged("AnnotationDeclaration_Example1"); + assertUnchanged("AnnotationDeclaration_Example3"); + assertUnchanged("AnnotationDeclaration_Example9"); + } + + // name + + @Test + void changingName() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + cu.getAnnotationDeclarationByName("ClassPreamble").get().setName("NewName"); + assertTransformed("AnnotationDeclaration_Example1", cu); + } + + // modifiers + + @Test + void addingModifiers() throws IOException { + considerExample("AnnotationDeclaration_Example1_original"); + cu.getAnnotationDeclarationByName("ClassPreamble").get().setModifiers(createModifierList(PUBLIC)); + assertTransformed("AnnotationDeclaration_Example2", cu); + } + + @Test + void removingModifiers() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + cu.getAnnotationDeclarationByName("ClassPreamble").get().setModifiers(new NodeList<>()); + assertTransformed("AnnotationDeclaration_Example3", cu); + } + + @Test + void replacingModifiers() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + cu.getAnnotationDeclarationByName("ClassPreamble").get().setModifiers(createModifierList(PROTECTED)); + assertTransformed("AnnotationDeclaration_Example4", cu); + } + + // members + + @Test + void addingMember() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + cu.getAnnotationDeclarationByName("ClassPreamble") + .get() + .addMember(new AnnotationMemberDeclaration(new NodeList<>(), PrimitiveType.intType(), "foo", null)); + assertTransformed("AnnotationDeclaration_Example5", cu); + } + + @Test + void removingMember() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + cu.getAnnotationDeclarationByName("ClassPreamble").get().getMember(2).remove(); + assertTransformed("AnnotationDeclaration_Example6", cu); + } + + @Test + void replacingMember() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + cu.getAnnotationDeclarationByName("ClassPreamble") + .get() + .setMember(2, new AnnotationMemberDeclaration(new NodeList<>(), PrimitiveType.intType(), "foo", null)); + assertTransformed("AnnotationDeclaration_Example7", cu); + } + + // javadoc + + @Test + void addingJavadoc() throws IOException { + considerExample("AnnotationDeclaration_Example3_original"); + cu.getAnnotationDeclarationByName("ClassPreamble").get().setJavadocComment("Cool this annotation!"); + assertTransformed("AnnotationDeclaration_Example8", cu); + } + + @Test + void removingJavadoc() throws IOException { + considerExample("AnnotationDeclaration_Example9_original"); + boolean removed = cu.getAnnotationDeclarationByName("ClassPreamble") + .get() + .getJavadocComment() + .get() + .remove(); + assertTrue(removed); + assertTransformed("AnnotationDeclaration_Example9", cu); + } + + @Test + void replacingJavadoc() throws IOException { + considerExample("AnnotationDeclaration_Example9_original"); + cu.getAnnotationDeclarationByName("ClassPreamble") + .get() + .setJavadocComment("Super extra cool this annotation!!!"); + assertTransformed("AnnotationDeclaration_Example10", cu); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/AnnotationMemberDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/AnnotationMemberDeclarationTransformationsTest.java new file mode 100644 index 0000000..a5ee73c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/AnnotationMemberDeclarationTransformationsTest.java @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.AnnotationMemberDeclaration; +import com.github.javaparser.ast.body.RecordDeclaration; +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.NormalAnnotationExpr; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Transforming AnnotationMemberDeclaration and verifying the LexicalPreservation works as expected. + */ +class AnnotationMemberDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + private static final ParserConfiguration.LanguageLevel storedLanguageLevel = + StaticJavaParser.getParserConfiguration().getLanguageLevel(); + + @BeforeEach + public void setLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + } + + @AfterEach + public void resetLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(storedLanguageLevel); + } + + protected AnnotationMemberDeclaration consider(String code) { + considerCode("@interface AD { " + code + " }"); + return cu.getAnnotationDeclarationByName("AD").get().getMember(0).asAnnotationMemberDeclaration(); + } + + // Name + + @Test + void changingName() { + AnnotationMemberDeclaration md = consider("int foo();"); + md.setName("bar"); + assertTransformedToString("int bar();", md); + } + + // Type + + @Test + void changingType() { + AnnotationMemberDeclaration md = consider("int foo();"); + md.setType("String"); + assertTransformedToString("String foo();", md); + } + + // Modifiers + + @Test + void addingModifiers() { + AnnotationMemberDeclaration md = consider("int foo();"); + md.setModifiers(createModifierList(PUBLIC)); + assertTransformedToString("public int foo();", md); + } + + @Test + void removingModifiers() { + AnnotationMemberDeclaration md = consider("public int foo();"); + md.setModifiers(new NodeList<>()); + assertTransformedToString("int foo();", md); + } + + @Test + void replacingModifiers() { + AnnotationMemberDeclaration md = consider("public int foo();"); + md.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("protected int foo();", md); + } + + // Default value + + @Test + void addingDefaultValue() { + AnnotationMemberDeclaration md = consider("int foo();"); + md.setDefaultValue(new IntegerLiteralExpr("10")); + assertTransformedToString("int foo() default 10;", md); + } + + @Test + void removingDefaultValue() { + AnnotationMemberDeclaration md = consider("int foo() default 10;"); + assertTrue(md.getDefaultValue().get().remove()); + assertTransformedToString("int foo();", md); + } + + @Test + void replacingDefaultValue() { + AnnotationMemberDeclaration md = consider("int foo() default 10;"); + md.setDefaultValue(new IntegerLiteralExpr("11")); + assertTransformedToString("int foo() default 11;", md); + } + + // Annotations + + @Test + void addingAnnotation() { + AnnotationMemberDeclaration it = consider("int foo();"); + it.addAnnotation("myAnno"); + assertTransformedToString("@myAnno" + LineSeparator.SYSTEM + "int foo();", it); + } + + @Test + void addingTwoAnnotations() { + AnnotationMemberDeclaration it = consider("int foo();"); + it.addAnnotation("myAnno"); + it.addAnnotation("myAnno2"); + assertTransformedToString( + "@myAnno" + LineSeparator.SYSTEM + "@myAnno2" + LineSeparator.SYSTEM + "int foo();", it); + } + + @Test + void removingAnnotationOnSomeLine() { + AnnotationMemberDeclaration it = consider("@myAnno int foo();"); + it.getAnnotations().remove(0); + assertTransformedToString("int foo();", it); + } + + @Test + void removingAnnotationOnPrevLine() { + AnnotationMemberDeclaration it = consider("@myAnno" + LineSeparator.SYSTEM + "int foo();"); + it.getAnnotations().remove(0); + assertTransformedToString("int foo();", it); + } + + @Test + void replacingAnnotation() { + AnnotationMemberDeclaration it = consider("@myAnno int foo();"); + it.getAnnotations().set(0, new NormalAnnotationExpr(new Name("myOtherAnno"), new NodeList<>())); + assertTransformedToString("@myOtherAnno int foo();", it); + } + + // Javadoc + + @Test + void addingJavadoc() { + AnnotationMemberDeclaration it = consider("int foo();"); + it.setJavadocComment("Cool this annotation!"); + assertTransformedToString( + "@interface AD { /**Cool this annotation!*/" + LineSeparator.SYSTEM + "int foo(); }", + it.getParentNode().get()); + } + + @Test + void removingJavadoc() { + AnnotationMemberDeclaration it = consider("/**Cool this annotation!*/ int foo();"); + assertTrue(it.getJavadocComment().get().remove()); + assertTransformedToString( + "@interface AD { int foo(); }", it.getParentNode().get()); + } + + @Test + void replacingJavadoc() { + AnnotationMemberDeclaration it = consider("/**Cool this annotation!*/ int foo();"); + it.setJavadocComment("Super extra cool this annotation!!!"); + assertTransformedToString( + "@interface AD { /**Super extra cool this annotation!!!*/ int foo(); }", + it.getParentNode().get()); + } + + @Test + void modifyingRecord() { + considerCode("@interface AD { record Bar(String s) {} }"); + RecordDeclaration recordDecl = + cu.getAnnotationDeclarationByName("AD").get().getMember(0).asRecordDeclaration(); + recordDecl.setName("Baz"); + assertTransformedToString( + "@interface AD { record Baz(String s) {} }", + recordDecl.getParentNode().get()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/ClassOrInterfaceDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/ClassOrInterfaceDeclarationTransformationsTest.java new file mode 100644 index 0000000..c824ba2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/ClassOrInterfaceDeclarationTransformationsTest.java @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType; +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.ast.type.TypeParameter; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +/** + * Transforming ClassOrInterfaceDeclaration and verifying the LexicalPreservation works as expected. + */ +class ClassOrInterfaceDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected ClassOrInterfaceDeclaration consider(String code) { + considerCode(code); + return cu.getType(0).asClassOrInterfaceDeclaration(); + } + + // Name + + @Test + void settingName() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.setName("B"); + assertTransformedToString("class B {}", cid); + } + + // isInterface + + @Test + void classToInterface() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.setInterface(true); + assertTransformedToString("interface A {}", cid); + } + + @Test + void interfaceToClass() { + ClassOrInterfaceDeclaration cid = consider("interface A {}"); + cid.setInterface(false); + assertTransformedToString("class A {}", cid); + } + + // typeParameters + + @Test + void addingTypeParameterWhenThereAreNone() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.addTypeParameter("T"); + assertTransformedToString("class A {}", cid); + } + + @Test + void addingTypeParameterAsFirstWhenThereAreSome() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.getTypeParameters().addFirst(new TypeParameter("T", new NodeList<>())); + assertTransformedToString("class A {}", cid); + } + + @Test + void addingTypeParameterAsLastWhenThereAreSome() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.addTypeParameter("T"); + assertTransformedToString("class A {}", cid); + } + + // extendedTypes + + @Test + void addingExtendedTypes() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.addExtendedType("Foo"); + assertTransformedToString("class A extends Foo {}", cid); + } + + @Test + void removingExtendedTypes() { + ClassOrInterfaceDeclaration cid = consider("public class A extends Foo {}"); + cid.getExtendedTypes().remove(0); + assertTransformedToString("public class A {}", cid); + } + + @Test + void replacingExtendedTypes() { + ClassOrInterfaceDeclaration cid = consider("public class A extends Foo {}"); + cid.getExtendedTypes().set(0, parseClassOrInterfaceType("Bar")); + assertTransformedToString("public class A extends Bar {}", cid); + } + + // implementedTypes + + @Test + void addingImplementedTypes() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.addImplementedType("Foo"); + assertTransformedToString("class A implements Foo {}", cid); + } + + @Test + void removingImplementedTypes() { + ClassOrInterfaceDeclaration cid = consider("public class A implements Foo {}"); + cid.getImplementedTypes().remove(0); + assertTransformedToString("public class A {}", cid); + } + + @Test + void replacingImplementedTypes() { + ClassOrInterfaceDeclaration cid = consider("public class A implements Foo {}"); + cid.getImplementedTypes().set(0, parseClassOrInterfaceType("Bar")); + assertTransformedToString("public class A implements Bar {}", cid); + } + + // Modifiers + + @Test + void addingModifiers() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.setModifiers(createModifierList(PUBLIC)); + assertTransformedToString("public class A {}", cid); + } + + @Test + void removingModifiers() { + ClassOrInterfaceDeclaration cid = consider("public class A {}"); + cid.setModifiers(new NodeList<>()); + assertTransformedToString("class A {}", cid); + } + + @Test + void replacingModifiers() { + ClassOrInterfaceDeclaration cid = consider("public class A {}"); + cid.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("protected class A {}", cid); + } + + // members + + @Test + void addingField() { + ClassOrInterfaceDeclaration cid = consider("class A {}"); + cid.addField("int", "foo"); + assertTransformedToString( + "class A {" + LineSeparator.SYSTEM + " int foo;" + LineSeparator.SYSTEM + "}", cid); + } + + @Test + void removingField() { + ClassOrInterfaceDeclaration cid = consider("public class A { int foo; }"); + cid.getMembers().remove(0); + assertTransformedToString("public class A { }", cid); + } + + @Test + void replacingFieldWithAnotherField() { + ClassOrInterfaceDeclaration cid = consider("public class A {float f;}"); + cid.getMembers() + .set(0, new FieldDeclaration(new NodeList<>(), new VariableDeclarator(PrimitiveType.intType(), "bar"))); + assertTransformedToString("public class A {int bar;}", cid); + } + + // Annotations + @Test + void removingAnnotations() { + ClassOrInterfaceDeclaration cid = consider("@Value" + LineSeparator.SYSTEM + "public class A {}"); + cid.getAnnotationByName("Value").get().remove(); + assertTransformedToString("public class A {}", cid); + } + + @Test + void removingAnnotationsWithSpaces() { + ClassOrInterfaceDeclaration cid = consider(" @Value " + LineSeparator.SYSTEM + "public class A {}"); + cid.getAnnotationByName("Value").get().remove(); + assertTransformedToString("public class A {}", cid); + } + + // Javadoc + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/ConstructorDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/ConstructorDeclarationTransformationsTest.java new file mode 100644 index 0000000..5b35259 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/ConstructorDeclarationTransformationsTest.java @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.ast.type.ArrayType; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import org.junit.jupiter.api.Test; + +/** + * Transforming ConstructorDeclaration and verifying the LexicalPreservation works as expected. + */ +class ConstructorDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected ConstructorDeclaration consider(String code) { + considerCode("class A { " + code + " }"); + return cu.getType(0).getMembers().get(0).asConstructorDeclaration(); + } + + // Name + + @Test + void settingName() { + ConstructorDeclaration cd = consider("A(){}"); + cd.setName("B"); + assertTransformedToString("B(){}", cd); + } + + // JavaDoc + + // Modifiers + + @Test + void addingModifiers() { + ConstructorDeclaration cd = consider("A(){}"); + cd.setModifiers(createModifierList(PUBLIC)); + assertTransformedToString("public A(){}", cd); + } + + @Test + void removingModifiers() { + ConstructorDeclaration cd = consider("public A(){}"); + cd.setModifiers(new NodeList<>()); + assertTransformedToString("A(){}", cd); + } + + @Test + void replacingModifiers() { + ConstructorDeclaration cd = consider("public A(){}"); + cd.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("protected A(){}", cd); + } + + // Parameters + + @Test + void addingParameters() { + ConstructorDeclaration cd = consider("A(){}"); + cd.addParameter(PrimitiveType.doubleType(), "d"); + assertTransformedToString("A(double d){}", cd); + } + + @Test + void removingOnlyParameter() { + ConstructorDeclaration cd = consider("public A(double d){}"); + cd.getParameters().remove(0); + assertTransformedToString("public A(){}", cd); + } + + @Test + void removingFirstParameterOfMany() { + ConstructorDeclaration cd = consider("public A(double d, float f){}"); + cd.getParameters().remove(0); + assertTransformedToString("public A(float f){}", cd); + } + + @Test + void removingLastParameterOfMany() { + ConstructorDeclaration cd = consider("public A(double d, float f){}"); + cd.getParameters().remove(1); + assertTransformedToString("public A(double d){}", cd); + } + + @Test + void replacingOnlyParameter() { + ConstructorDeclaration cd = consider("public A(float f){}"); + cd.getParameters().set(0, new Parameter(new ArrayType(PrimitiveType.intType()), new SimpleName("foo"))); + assertTransformedToString("public A(int[] foo){}", cd); + } + + // ThrownExceptions + + // Body + + // Annotations +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/EnumConstantDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/EnumConstantDeclarationTransformationsTest.java new file mode 100644 index 0000000..bfadec8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/EnumConstantDeclarationTransformationsTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import com.github.javaparser.ast.body.EnumConstantDeclaration; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import org.junit.jupiter.api.Test; + +/** + * Transforming EnumConstantDeclaration and verifying the LexicalPreservation works as expected. + */ +class EnumConstantDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected EnumConstantDeclaration consider(String code) { + considerCode("enum A { " + code + " }"); + return cu.getType(0).asEnumDeclaration().getEntries().get(0); + } + + // Name + + @Test + void settingName() { + EnumConstantDeclaration ecd = consider("A"); + ecd.setName("B"); + assertTransformedToString("B", ecd); + } + + // Annotations + + // Javadoc + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/EnumDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/EnumDeclarationTransformationsTest.java new file mode 100644 index 0000000..07f5820 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/EnumDeclarationTransformationsTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.EnumConstantDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +/** + * Transforming EnumDeclaration and verifying the LexicalPreservation works as expected. + */ +class EnumDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected EnumDeclaration consider(String code) { + considerCode(code); + return cu.getType(0).asEnumDeclaration(); + } + + // Name + + @Test + void settingName() { + EnumDeclaration cid = consider("enum A { E1, E2 }"); + cid.setName("B"); + assertTransformedToString("enum B { E1, E2 }", cid); + } + + // implementedTypes + + // Modifiers + + @Test + void addingModifiers() { + EnumDeclaration ed = consider("enum A { E1, E2 }"); + ed.setModifiers(createModifierList(PUBLIC)); + assertTransformedToString("public enum A { E1, E2 }", ed); + } + + @Test + void removingModifiers() { + EnumDeclaration ed = consider("public enum A { E1, E2 }"); + ed.setModifiers(new NodeList<>()); + assertTransformedToString("enum A { E1, E2 }", ed); + } + + @Test + void replacingModifiers() { + EnumDeclaration ed = consider("public enum A { E1, E2 }"); + ed.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("protected enum A { E1, E2 }", ed); + } + + @Test + void addingConstants() { + EnumDeclaration ed = consider("enum A {" + LineSeparator.SYSTEM + " E1" + LineSeparator.SYSTEM + "}"); + ed.getEntries().addLast(new EnumConstantDeclaration("E2")); + assertTransformedToString( + "enum A {" + LineSeparator.SYSTEM + " E1," + LineSeparator.SYSTEM + " E2" + LineSeparator.SYSTEM + "}", + ed); + } + + // members + + // Annotations + + // Javadoc + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/FieldDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/FieldDeclarationTransformationsTest.java new file mode 100644 index 0000000..2785c98 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/FieldDeclarationTransformationsTest.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Test; + +/** + * Transforming FieldDeclaration and verifying the LexicalPreservation works as expected. + */ +class FieldDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected FieldDeclaration consider(String code) { + considerCode("class A { " + code + " }"); + return cu.getType(0).getMembers().get(0).asFieldDeclaration(); + } + + // JavaDoc + + // Modifiers + + @Test + void addingModifiers() { + FieldDeclaration it = consider("int A;"); + it.setModifiers(createModifierList(PUBLIC)); + assertTransformedToString("public int A;", it); + } + + @Test + void removingModifiers() { + FieldDeclaration it = consider("public int A;"); + it.setModifiers(new NodeList<>()); + assertTransformedToString("int A;", it); + } + + @Test + void removingModifiersFromNonPrimitiveType() { + FieldDeclaration it = consider("public String A;"); + it.setModifiers(new NodeList<>()); + assertTransformedToString("String A;", it); + } + + @Test + void replacingModifiers() { + FieldDeclaration it = consider("int A;"); + it.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("protected int A;", it); + } + + @Test + void changingTypes() { + FieldDeclaration it = consider("int a, b;"); + assertTransformedToString("int a, b;", it); + it.getVariable(0).setType("Xyz"); + assertTransformedToString(" a, b;", it); + it.getVariable(1).setType("Xyz"); + assertTransformedToString("Xyz a, b;", it); + } + + @Test + public void changingNonePrimitiveTypes() { + FieldDeclaration it = consider("String a;"); + it.getVariable(0).setType("Xyz"); + assertTransformedToString("Xyz a;", it); + } + + // Annotations + @Test + void removingAnnotations() { + FieldDeclaration it = consider(LineSeparator.SYSTEM + "@Annotation" + LineSeparator.SYSTEM + "public int A;"); + it.getAnnotationByName("Annotation").get().remove(); + assertTransformedToString("public int A;", it); + } + + @Test + void removingAnnotationsWithSpaces() { + FieldDeclaration it = + consider(LineSeparator.SYSTEM + " @Annotation " + LineSeparator.SYSTEM + "public int A;"); + it.getAnnotationByName("Annotation").get().remove(); + assertTransformedToString("public int A;", it); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/InitializerDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/InitializerDeclarationTransformationsTest.java new file mode 100644 index 0000000..5d2d5cf --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/InitializerDeclarationTransformationsTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import com.github.javaparser.ast.body.InitializerDeclaration; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import org.junit.jupiter.api.Test; + +/** + * Transforming InitializerDeclaration and verifying the LexicalPreservation works as expected. + */ +class InitializerDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected InitializerDeclaration consider(String code) { + considerCode("class A { " + code + " }"); + return cu.getType(0).getMembers().get(0).asInitializerDeclaration(); + } + + // JavaDoc + + // Body + + // IsStatic + + @Test + void instanceToStatic() { + InitializerDeclaration it = consider("{ /*some comment*/ }"); + it.setStatic(true); + assertTransformedToString("static { /*some comment*/ }", it); + } + + @Test + void staticToInstance() { + InitializerDeclaration it = consider("static { /*some comment*/ }"); + it.setStatic(false); + assertTransformedToString("{ /*some comment*/ }", it); + } + + // Annotations +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/MethodDeclarationTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/MethodDeclarationTransformationsTest.java new file mode 100644 index 0000000..896665c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/MethodDeclarationTransformationsTest.java @@ -0,0 +1,478 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.StaticJavaParser.parseExpression; +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static com.github.javaparser.ast.Modifier.Keyword.PROTECTED; +import static com.github.javaparser.ast.Modifier.Keyword.PUBLIC; +import static com.github.javaparser.ast.Modifier.createModifierList; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; + +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.MarkerAnnotationExpr; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.ArrayType; +import com.github.javaparser.ast.type.PrimitiveType; +import com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.description.JavadocDescription; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import com.github.javaparser.utils.LineSeparator; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Transforming MethodDeclaration and verifying the LexicalPreservation works as expected. + */ +class MethodDeclarationTransformationsTest extends AbstractLexicalPreservingTest { + + protected MethodDeclaration consider(String code) { + considerCode("class A { " + code + " }"); + return cu.getType(0).getMembers().get(0).asMethodDeclaration(); + } + + // Name + + @Test + void settingName() { + MethodDeclaration it = consider("void A(){}"); + it.setName("B"); + assertTransformedToString("void B(){}", it); + } + + // JavaDoc + + @Disabled + @Test + void removingDuplicateJavaDocComment() { + // Arrange + considerCode("public class MyClass {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void oneMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void anotherMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + MethodDeclaration methodDeclaration = + cu.findAll(MethodDeclaration.class).get(1); + + // Act + methodDeclaration.removeComment(); + + // Assert + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "public class MyClass {\n" + "\n" + + " /**\n" + + " * Comment A\n" + + " */\n" + + " public void oneMethod() {\n" + + " }\n" + + "\n" + + " public void anotherMethod() {\n" + + " }\n" + + "}\n", + result); + } + + @Disabled + @Test + void replacingDuplicateJavaDocComment() { + // Arrange + considerCode("public class MyClass {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void oneMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /**" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void anotherMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + MethodDeclaration methodDeclaration = + cu.findAll(MethodDeclaration.class).get(1); + + // Act + Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); + methodDeclaration.setJavadocComment("", javadoc); + + // Assert + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "public class MyClass {\n" + "\n" + + " /**\n" + + " * Comment A\n" + + " */\n" + + " public void oneMethod() {\n" + + " }\n" + + "\n" + + " /**\n" + + " * Change Javadoc\n" + + " */\n" + + " public void anotherMethod() {\n" + + " }\n" + + "}\n", + result); + } + + // Comments + + @Disabled + @Test + void removingDuplicateComment() { + // Arrange + considerCode("public class MyClass {" + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /*" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void oneMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + LineSeparator.SYSTEM + + " /*" + + LineSeparator.SYSTEM + " * Comment A" + + LineSeparator.SYSTEM + " */" + + LineSeparator.SYSTEM + " public void anotherMethod() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + MethodDeclaration methodDeclaration = + cu.findAll(MethodDeclaration.class).get(1); + + // Act + methodDeclaration.removeComment(); + + // Assert + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "public class MyClass {\n" + "\n" + + " /*\n" + + " * Comment A\n" + + " */\n" + + " public void oneMethod() {\n" + + " }\n" + + "\n" + + " public void anotherMethod() {\n" + + " }\n" + + "}\n", + result); + } + + // Modifiers + + @Test + void addingModifiers() { + MethodDeclaration it = consider("void A(){}"); + it.setModifiers(createModifierList(PUBLIC)); + assertTransformedToString("public void A(){}", it); + } + + @Test + void removingModifiers() { + MethodDeclaration it = consider("public void A(){}"); + it.setModifiers(new NodeList<>()); + assertTransformedToString("void A(){}", it); + } + + @Test + void removingModifiersWithExistingAnnotationsShort() { + MethodDeclaration it = consider("@Override public void A(){}"); + it.setModifiers(new NodeList<>()); + assertTransformedToString("@Override void A(){}", it); + } + + @Test + void removingPublicModifierFromPublicStaticMethod() { + MethodDeclaration it = consider("public static void a(){}"); + it.removeModifier(Modifier.Keyword.PUBLIC); + assertTransformedToString("static void a(){}", it); + } + + @Test + void removingModifiersWithExistingAnnotations() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Test" + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).setModifiers(new NodeList<>()); + + String result = LexicalPreservingPrinter.print(cu); + assertEqualsStringIgnoringEol("class X {\n" + " @Test\n" + " void testCase() {\n" + " }\n" + "}\n", result); + } + + @Test + void removingModifiersWithExistingAnnotations_withVariableNumberOfSeparator() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Test" + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).setModifiers(new NodeList<>()); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol("class X {\n" + " @Test\n" + " void testCase() {\n" + " }\n" + "}\n", result); + } + + @Test + void replacingModifiers() { + MethodDeclaration it = consider("public void A(){}"); + it.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("protected void A(){}", it); + } + + @Test + void replacingModifiersWithExistingAnnotationsShort() { + MethodDeclaration it = consider("@Override public void A(){}"); + it.setModifiers(createModifierList(PROTECTED)); + assertTransformedToString("@Override protected void A(){}", it); + } + + @Test + void replacingModifiersWithExistingAnnotations() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Test" + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).setModifiers(createModifierList(PROTECTED)); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "class X {\n" + " @Test\n" + " protected void testCase() {\n" + " }\n" + "}\n", result); + } + + // Parameters + + @Test + void addingParameters() { + MethodDeclaration it = consider("void foo(){}"); + it.addParameter(PrimitiveType.doubleType(), "d"); + assertTransformedToString("void foo(double d){}", it); + } + + @Test + void removingOnlyParameter() { + MethodDeclaration it = consider("public void foo(double d){}"); + it.getParameters().remove(0); + assertTransformedToString("public void foo(){}", it); + } + + @Test + void removingFirstParameterOfMany() { + MethodDeclaration it = consider("public void foo(double d, float f){}"); + it.getParameters().remove(0); + assertTransformedToString("public void foo(float f){}", it); + } + + @Test + void removingLastParameterOfMany() { + MethodDeclaration it = consider("public void foo(double d, float f){}"); + it.getParameters().remove(1); + assertTransformedToString("public void foo(double d){}", it); + } + + @Test + void replacingOnlyParameter() { + MethodDeclaration it = consider("public void foo(float f){}"); + it.getParameters().set(0, new Parameter(new ArrayType(PrimitiveType.intType()), new SimpleName("foo"))); + assertTransformedToString("public void foo(int[] foo){}", it); + } + + // ThrownExceptions + + // Body + + // Annotations + @Test + void addingToExistingAnnotations() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Test" + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0) + .getMethods() + .get(0) + .addSingleMemberAnnotation("org.junit.Ignore", new StringLiteralExpr("flaky test")); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "class X {\n" + " @Test\n" + + " @org.junit.Ignore(\"flaky test\")\n" + + " public void testCase() {\n" + + " }\n" + + "}\n", + result); + } + + @Test + void addingAnnotationsNoModifiers() { + considerCode("class X {" + LineSeparator.SYSTEM + " void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).addMarkerAnnotation("Test"); + cu.getType(0).getMethods().get(0).addMarkerAnnotation("Override"); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "class X {\n" + " @Test\n" + " @Override\n" + " void testCase() {\n" + " }\n" + "}\n", result); + } + + @Test + void replacingAnnotations() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Override" + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).setAnnotations(new NodeList<>(new MarkerAnnotationExpr("Test"))); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "class X {\n" + " @Test\n" + " public void testCase() {\n" + " }\n" + "}\n", result); + } + + @Test + void addingAnnotationsShort() { + MethodDeclaration it = consider("void testMethod(){}"); + it.addMarkerAnnotation("Override"); + assertTransformedToString("@Override" + LineSeparator.SYSTEM + "void testMethod(){}", it); + } + + // This test case was disabled because we cannot resolve this case for now + // because indentation before the removed annotation is not part + // of difference elements (see removingAnnotationsWithSpaces too) + @Disabled + @Test + void removingAnnotations() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Override" + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).getAnnotationByName("Override").get().remove(); + + String result = LexicalPreservingPrinter.print(cu); + assertEqualsStringIgnoringEol("class X {\n" + " public void testCase() {\n" + " }\n" + "}\n", result); + } + + @Disabled + @Test + void removingAnnotationsWithSpaces() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Override " + + LineSeparator.SYSTEM + " public void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0).getMethods().get(0).getAnnotationByName("Override").get().remove(); + + String result = LexicalPreservingPrinter.print(cu); + assertEqualsStringIgnoringEol("class X {\n" + " public void testCase() {\n" + " }\n" + "}\n", result); + } + + @Test + public void addingModifiersWithExistingAnnotationsShort() { + MethodDeclaration it = consider("@Override void A(){}"); + it.setModifiers(NodeList.nodeList(Modifier.publicModifier(), Modifier.finalModifier())); + assertTransformedToString("@Override public final void A(){}", it); + } + + @Test + public void addingModifiersWithExistingAnnotations() { + considerCode("class X {" + LineSeparator.SYSTEM + " @Test" + + LineSeparator.SYSTEM + " void testCase() {" + + LineSeparator.SYSTEM + " }" + + LineSeparator.SYSTEM + "}" + + LineSeparator.SYSTEM); + + cu.getType(0) + .getMethods() + .get(0) + .addModifier( + Modifier.finalModifier().getKeyword(), + Modifier.publicModifier().getKeyword()); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol( + "class X {\n" + " @Test\n" + " final public void testCase() {\n" + " }\n" + "}\n", result); + } + + @Test + public void parseAndPrintAnonymousClassExpression() { + Expression expression = parseExpression("new Object() {" + LineSeparator.SYSTEM + "}"); + String expected = "new Object() {" + LineSeparator.SYSTEM + "}"; + assertTransformedToString(expected, expression); + } + + @Test + public void parseAndPrintAnonymousClassStatement() { + Statement statement = parseStatement("Object anonymous = new Object() {" + LineSeparator.SYSTEM + "};"); + String expected = "Object anonymous = new Object() {" + LineSeparator.SYSTEM + "};"; + assertTransformedToString(expected, statement); + } + + @Test + public void replaceBodyShouldNotBreakAnonymousClasses() { + MethodDeclaration it = consider("public void method() { }"); + it.getBody().ifPresent(body -> { + Statement statement = parseStatement("Object anonymous = new Object() {" + LineSeparator.SYSTEM + "};"); + NodeList statements = new NodeList<>(); + statements.add(statement); + body.setStatements(statements); + }); + + String expected = "public void method() {" + LineSeparator.SYSTEM + " Object anonymous = new Object() {" + + LineSeparator.SYSTEM + " };" + + LineSeparator.SYSTEM + "}"; + assertTransformedToString(expected, it); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/OperatorTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/OperatorTransformationsTest.java new file mode 100644 index 0000000..7c3929c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/OperatorTransformationsTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import com.github.javaparser.ast.expr.IntegerLiteralExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import org.junit.jupiter.api.Test; + +/** + * Transforming BinaryExpr and verifying the LexicalPreservation works as expected. + */ +class OperatorTransformationsTest extends AbstractLexicalPreservingTest { + + @Test + void binaryExpressionOperator() { + considerExpression("a && b"); + expression.asBinaryExpr().setRight(new NameExpr("c")); + assertTransformedToString("a && c", expression); + } + + @Test + void unaryExpressionOperator() { + considerExpression("!a"); + expression.asUnaryExpr().setExpression(new NameExpr("b")); + assertTransformedToString("!b", expression); + } + + @Test + void assignExpressionOperator() { + considerExpression("a <<= 1"); + expression.asAssignExpr().setValue(new IntegerLiteralExpr(2)); + assertTransformedToString("a <<= 2", expression); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/StatementTransformationsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/StatementTransformationsTest.java new file mode 100644 index 0000000..cd3ea9c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/transformations/ast/body/StatementTransformationsTest.java @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.printer.lexicalpreservation.transformations.ast.body; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.Range; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.SwitchEntry; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import org.junit.jupiter.api.*; + +/** + * Transforming Statement and verifying the LexicalPreservation works as expected. + */ +class StatementTransformationsTest extends AbstractLexicalPreservingTest { + + private static final ParserConfiguration.LanguageLevel storedLanguageLevel = + StaticJavaParser.getParserConfiguration().getLanguageLevel(); + + @BeforeEach + public void setLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + } + + @AfterEach + public void resetLanguageLevel() { + StaticJavaParser.getParserConfiguration().setLanguageLevel(storedLanguageLevel); + } + + Statement consider(String code) { + Statement statement = parseStatement(code); + LexicalPreservingPrinter.setup(statement); + return statement; + } + + @Test + void ifStmtTransformation() { + Statement stmt = consider("if (a) {} else {}"); + stmt.asIfStmt().setCondition(new NameExpr("b")); + assertTransformedToString("if (b) {} else {}", stmt); + } + + @Test + void switchEntryCsmHasTrailingUnindent() { + Statement stmt = consider("switch (a) { case 1: a; a; }"); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(1, statements.get(1).clone()); // clone() to force replacement + assertTransformedToString("switch (a) { case 1: a; a; }", stmt); + } + + @Test + void newSwitchEntryPreserved() { + String code = "switch (a) { case 2 -> System.out.println(-1); }"; + Statement stmt = consider(code); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(0, statements.get(0).clone()); + assertTransformedToString(code, stmt); + } + + @Test + void newDefaultSwitchEntryPreserved() { + String code = "switch (a) { default -> System.out.println(-1); }"; + Statement stmt = consider(code); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(0, statements.get(0).clone()); + assertTransformedToString(code, stmt); + } + + @Test + void nullDefaultSwitchEntryPreserved() { + String code = "switch (a) { case null, default -> System.out.println(-1); }"; + Statement stmt = consider(code); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(0, statements.get(0).clone()); + assertTransformedToString(code, stmt); + } + + @Test + void switchPatternPreserved() { + String code = "switch (a) { case String s -> System.out.println(s); }"; + Statement stmt = consider(code); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(0, statements.get(0).clone()); + assertTransformedToString(code, stmt); + } + + @Test + void switchPatternWithGuardPreserved() { + String code = "switch (a) { case String s when s.length() > 5 -> System.out.println(s); }"; + Statement stmt = consider(code); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(0, statements.get(0).clone()); + assertTransformedToString(code, stmt); + } + + @Test + void switchWithRecordPatternPreserved() { + String code = "switch (a) { case OldBox (TwoBox(String s, Box (Integer i))) -> System.out.println(i); }"; + Statement stmt = consider(code); + NodeList entries = stmt.asSwitchStmt().getEntries(); + entries.get(0).getLabels().get(0).asRecordPatternExpr().setType("NewBox"); + NodeList statements = stmt.asSwitchStmt().getEntry(0).getStatements(); + statements.set(0, statements.get(0).clone()); + assertTransformedToString(code.replaceAll("OldBox", "NewBox"), stmt); + } + + @Test + void issue4646() { + String originalCode = "class A {\n" + + " void m(int year) { \n" + + " return switch (year) {\n" + + " case 2023 -> new Object();\n" + + " default -> throw new IllegalStateException(\"Cant create for year\");\n" + + " };\n" + + " }\n" + + " }"; + String expectedCode = "switch (year) {\n" + + " case 2023 -> new Object();\n" + + " case 2024 -> new java.lang.Object();\n" + + " default -> throw new IllegalStateException(\"Cant create for year\");\n" + + " }"; + ParserConfiguration config = new ParserConfiguration(); + config.setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + StaticJavaParser.setConfiguration(config); + CompilationUnit cu = LexicalPreservingPrinter.setup(StaticJavaParser.parse(originalCode)); + SwitchExpr switchExpr = cu.findFirst(SwitchExpr.class).get(); + NodeList entries = switchExpr.getEntries(); + NodeList labels = NodeList.nodeList(new IntegerLiteralExpr("2024")); + + Range entryRange = entries.get(0).getRange().get(); + assertEquals(4, entryRange.begin.line); + assertEquals(4, entryRange.end.line); + assertEquals(5, entryRange.begin.column); + assertEquals(30, entryRange.end.column); + + Statement stmt = new ExpressionStmt(new ObjectCreationExpr( + null, + new ClassOrInterfaceType("java.lang.Object"), + entries.get(entries.size() - 2) + .getStatements() + .get(0) + .asExpressionStmt() + .getExpression() + .asObjectCreationExpr() + .getArguments())); + + NodeList expressions = NodeList.nodeList(stmt); + + SwitchEntry newEntry = new SwitchEntry(labels, SwitchEntry.Type.EXPRESSION, expressions); + + entries.add(entries.size() - 1, newEntry); + + String output = LexicalPreservingPrinter.print(switchExpr); + + assertEqualsStringIgnoringEol(expectedCode, output); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/quality/PreconditionsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/quality/PreconditionsTest.java new file mode 100644 index 0000000..704b1da --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/quality/PreconditionsTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.quality; + +import static com.github.javaparser.quality.Preconditions.checkArgument; +import static com.github.javaparser.quality.Preconditions.checkNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class PreconditionsTest { + + @Test + void checkArgument_withTrueExpression() { + checkArgument(true); + } + + @Test + void checkArgument_withFalseExpression() { + assertThrows(IllegalArgumentException.class, () -> checkArgument(false)); + } + + @Test + void checkNotNull_withNonNull() { + checkNotNull(new Object()); + } + + @Test + void checkNotNull_withNull() { + assertThrows(IllegalArgumentException.class, () -> checkNotNull(null)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/remove/NodeRemovalTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/remove/NodeRemovalTest.java new file mode 100644 index 0000000..768d627 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/remove/NodeRemovalTest.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.remove; + +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.printer.lexicalpreservation.AbstractLexicalPreservingTest; +import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter; +import java.util.List; +import org.junit.jupiter.api.Test; + +class NodeRemovalTest extends AbstractLexicalPreservingTest { + + private final CompilationUnit compilationUnit = new CompilationUnit(); + + @Test + void testRemoveClassFromCompilationUnit() { + ClassOrInterfaceDeclaration testClass = compilationUnit.addClass("test"); + assertEquals(1, compilationUnit.getTypes().size()); + boolean remove = testClass.remove(); + assertTrue(remove); + assertEquals(0, compilationUnit.getTypes().size()); + } + + @Test + void testRemoveFieldFromClass() { + ClassOrInterfaceDeclaration testClass = compilationUnit.addClass("test"); + + FieldDeclaration addField = testClass.addField(String.class, "test"); + assertEquals(1, testClass.getMembers().size()); + boolean remove = addField.remove(); + assertTrue(remove); + assertEquals(0, testClass.getMembers().size()); + } + + @Test + void testRemoveStatementFromMethodBody() { + ClassOrInterfaceDeclaration testClass = compilationUnit.addClass("testC"); + + MethodDeclaration addMethod = testClass.addMethod("testM"); + BlockStmt methodBody = addMethod.createBody(); + Statement addStatement = methodBody.addAndGetStatement("test"); + assertEquals(1, methodBody.getStatements().size()); + boolean remove = addStatement.remove(); + assertTrue(remove); + assertEquals(0, methodBody.getStatements().size()); + } + + @Test + void testRemoveStatementFromMethodBodyWithLexicalPreservingPrinter() { + considerStatement("{\r\n" + " log.error(\"context\", e);\r\n" + + " log.error(\"context\", e);\r\n" + + " throw new ApplicationException(e);\r\n" + + "}\r\n"); + BlockStmt bstmt = statement.asBlockStmt(); + List children = bstmt.getChildNodes(); + remove(children.get(0)); + assertTrue(children.size() == 2); + remove(children.get(0)); + assertTrue(children.size() == 1); + assertTrue(children.stream().allMatch(n -> n.getParentNode() != null)); + } + + @Test + // issue 1638 + public void removingAnnotationsFormattedWithAdditionalSpaces() { + considerCode("class X {\n" + " @Override\n" + " public void testCase() {\n" + " }\n" + "}"); + + cu.getType(0).getMethods().get(0).getAnnotationByName("Override").get().remove(); + + String result = LexicalPreservingPrinter.print(cu.findCompilationUnit().get()); + assertEqualsStringIgnoringEol("class X {\n" + " public void testCase() {\n" + " }\n" + "}", result); + } + + // remove the node and parent's node until response is true + boolean remove(Node node) { + boolean result = node.remove(); + if (!result && node.getParentNode().isPresent()) + result = remove(node.getParentNode().get()); + return result; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/CodeGenerationUtilsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/CodeGenerationUtilsTest.java new file mode 100644 index 0000000..445fd83 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/CodeGenerationUtilsTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.utils.CodeGenerationUtils.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class CodeGenerationUtilsTest { + @Test + void setters() { + assertEquals("setValue", setterName("value")); + assertEquals("setBlue", setterName("isBlue")); + } + + @Test + void getters() { + assertEquals("getValue", getterName(Object.class, "value")); + assertEquals("isBlue", getterName(boolean.class, "isBlue")); + assertEquals("isBlue", getterName(boolean.class, "blue")); + assertEquals("getBlue", getterName(Boolean.class, "blue")); + assertEquals("getIsBlue", getterName(Boolean.class, "isBlue")); + } + + @Test + void testGetterToPropertyName() { + assertEquals("value", getterToPropertyName("getValue")); + assertEquals("blue", getterToPropertyName("isBlue")); + assertEquals("value", getterToPropertyName("hasValue")); + + IllegalArgumentException thrown = + assertThrows(IllegalArgumentException.class, () -> getterToPropertyName("value")); + assertEquals("Unexpected getterName 'value'", thrown.getMessage()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/ExtractingVisitors.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/ExtractingVisitors.java new file mode 100644 index 0000000..feb534c --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/ExtractingVisitors.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.utils; + +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.expr.CharLiteralExpr; +import com.github.javaparser.ast.visitor.GenericVisitor; +import com.github.javaparser.ast.visitor.GenericVisitorAdapter; +import java.util.ArrayList; +import java.util.List; + +public final class ExtractingVisitors { + + private static List extract(Node node, GenericVisitor> extractCharLiteralExprs) { + List list = new ArrayList<>(); + node.accept(extractCharLiteralExprs, list); + return list; + } + + public static List extractCharLiteralExprs(Node node) { + return extract(node, new GenericVisitorAdapter>() { + @Override + public Void visit(CharLiteralExpr n, List accumulator) { + accumulator.add(n); + return super.visit(n, accumulator); + } + }); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/LineSeparatorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/LineSeparatorTest.java new file mode 100644 index 0000000..7cbfc3b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/LineSeparatorTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.Test; + +/** + * @author Roger Howell + */ +class LineSeparatorTest { + + @Test + void escaped() { + assertEquals("\\r", LineSeparator.CR.asEscapedString()); + assertEquals("\\n", LineSeparator.LF.asEscapedString()); + assertEquals("\\r\\n", LineSeparator.CRLF.asEscapedString()); + } + + @Test + void lookup() { + assertEquals(LineSeparator.CR, LineSeparator.lookup("\r").get()); + assertEquals(LineSeparator.LF, LineSeparator.lookup("\n").get()); + assertEquals(LineSeparator.CRLF, LineSeparator.lookup("\r\n").get()); + + assertFalse(LineSeparator.lookup("").isPresent()); + assertFalse(LineSeparator.lookup(" ").isPresent()); + assertFalse(LineSeparator.lookup("\\r").isPresent()); + assertFalse(LineSeparator.lookup("\\n").isPresent()); + assertFalse(LineSeparator.lookup(" \\r").isPresent()); + assertFalse(LineSeparator.lookup(" \\n").isPresent()); + assertFalse(LineSeparator.lookup("\\r ").isPresent()); + assertFalse(LineSeparator.lookup("\\n ").isPresent()); + assertFalse(LineSeparator.lookup("test 123 123").isPresent()); + assertFalse(LineSeparator.lookup("\r \n").isPresent()); + assertFalse(LineSeparator.lookup("\\r \\n").isPresent()); + } + + @Test + void lookupEscaped() { + assertEquals(LineSeparator.CR, LineSeparator.lookupEscaped("\\r").get()); + assertEquals(LineSeparator.LF, LineSeparator.lookupEscaped("\\n").get()); + assertEquals(LineSeparator.CRLF, LineSeparator.lookupEscaped("\\r\\n").get()); + + assertFalse(LineSeparator.lookupEscaped("").isPresent()); + assertFalse(LineSeparator.lookupEscaped(" ").isPresent()); + assertFalse(LineSeparator.lookupEscaped("\r").isPresent()); + assertFalse(LineSeparator.lookupEscaped("\n").isPresent()); + assertFalse(LineSeparator.lookupEscaped(" \r").isPresent()); + assertFalse(LineSeparator.lookupEscaped(" \n").isPresent()); + assertFalse(LineSeparator.lookupEscaped("\r ").isPresent()); + assertFalse(LineSeparator.lookupEscaped("\n ").isPresent()); + assertFalse(LineSeparator.lookupEscaped("test 123 123").isPresent()); + assertFalse(LineSeparator.lookupEscaped("\r \n").isPresent()); + assertFalse(LineSeparator.lookupEscaped("\\r \\n").isPresent()); + } + + @Test + void detect() { + assertEquals(LineSeparator.CR, LineSeparator.detect("\r")); + assertEquals(LineSeparator.LF, LineSeparator.detect("\n")); + assertEquals(LineSeparator.CRLF, LineSeparator.detect("\r\n")); + + assertEquals(LineSeparator.NONE, LineSeparator.detect("")); + assertEquals(LineSeparator.NONE, LineSeparator.detect("test 123 123")); + + assertEquals(LineSeparator.MIXED, LineSeparator.detect("\r \n")); + } + + @Test + void testToString() { + assertEquals("\r", LineSeparator.CR.asRawString()); + assertEquals("\n", LineSeparator.LF.asRawString()); + assertEquals("\r\n", LineSeparator.CRLF.asRawString()); + + // Note that this represents an "arbitrary" line ending -- this test is to highlight any time that it changes. + assertEquals("\n", LineSeparator.ARBITRARY.asRawString()); + } + + @Test + void values() { + assertEquals(8, LineSeparator.values().length); + } + + @Test + void valueOf() { + assertEquals(LineSeparator.CR, LineSeparator.valueOf("CR")); + assertEquals(LineSeparator.LF, LineSeparator.valueOf("LF")); + assertEquals(LineSeparator.CRLF, LineSeparator.valueOf("CRLF")); + assertEquals(LineSeparator.NONE, LineSeparator.valueOf("NONE")); + assertEquals(LineSeparator.MIXED, LineSeparator.valueOf("MIXED")); + assertEquals(LineSeparator.SYSTEM, LineSeparator.valueOf("SYSTEM")); + assertEquals(LineSeparator.UNKNOWN, LineSeparator.valueOf("UNKNOWN")); + assertEquals(LineSeparator.ARBITRARY, LineSeparator.valueOf("ARBITRARY")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/LogTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/LogTest.java new file mode 100644 index 0000000..7ef9630 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/LogTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.function.Supplier; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class LogTest { + private static class TestAdapter implements Log.Adapter { + String output = ""; + + @Override + public void info(Supplier messageSupplier) { + output += "I" + messageSupplier.get(); + } + + @Override + public void trace(Supplier messageSupplier) { + output += "T" + messageSupplier.get(); + } + + @Override + public void error(Supplier throwableSupplier, Supplier messageSupplier) { + Throwable throwable = throwableSupplier.get(); + String s = messageSupplier.get(); + output += "E" + s + "M" + (throwable == null ? "null" : throwable.getMessage()); + } + } + + private TestAdapter testAdapter = new TestAdapter(); + + @BeforeEach + void setAdapter() { + Log.setAdapter(testAdapter); + } + + @AfterEach + void resetAdapter() { + Log.setAdapter(new Log.SilentAdapter()); + } + + @Test + void testTrace() { + Log.trace("abc"); + Log.trace("a%sc%s", () -> "b", () -> "d"); + assertEquals("TabcTabcd", testAdapter.output); + } + + @Test + void testInfo() { + Log.info("abc"); + Log.info("a%sc", () -> "b"); + assertEquals("IabcIabc", testAdapter.output); + } + + @Test + void testError() { + Log.error("abc"); + Log.error("a%sc", () -> "b"); + Log.error(new Throwable("!!!"), "abc"); + Log.error(new Throwable("!!!"), "a%sc%s", () -> "b", () -> "d"); + Log.error(new Throwable("!!!")); + assertEquals("EabcMnullEabcMnullEabcM!!!EabcdM!!!EnullM!!!", testAdapter.output); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/PairTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/PairTest.java new file mode 100644 index 0000000..f809c87 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/PairTest.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class PairTest { + @Test + void testToString() { + Pair pair = new Pair<>("abc", "def"); + + assertEquals("", pair.toString()); + } + + @Test + void testToStringNulls() { + Pair pair = new Pair<>(null, null); + + assertEquals("", pair.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/ParserCollectionStrategyTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/ParserCollectionStrategyTest.java new file mode 100644 index 0000000..65c4f25 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/ParserCollectionStrategyTest.java @@ -0,0 +1,236 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_9; +import static com.github.javaparser.utils.CodeGenerationUtils.mavenModuleRoot; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.Test; + +class ParserCollectionStrategyTest { + + private final ParserCollectionStrategy parserCollectionStrategy = + new ParserCollectionStrategy(new ParserConfiguration().setLanguageLevel(JAVA_9)); + + @Test + void getSourceRoots() { + final Path root = + mavenModuleRoot(ParserCollectionStrategyTest.class).resolve("").getParent(); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + assertThat(projectRoot.getSourceRoots()).isNotEmpty(); + assertThat(projectRoot.getSourceRoot(root.resolve("javaparser-core/src/main/java"))) + .isNotEmpty(); + assertThat(projectRoot.getSourceRoot(root.resolve("javaparser-core-generators/src/main/java"))) + .isNotEmpty(); + assertThat(projectRoot.getSourceRoot(root.resolve("javaparser-core-metamodel-generator/src/main/java"))) + .isNotEmpty(); + assertThat(projectRoot.getSourceRoot(root.resolve("javaparser-symbol-solver-core/src/main/java"))) + .isNotEmpty(); + } + + @Test + void rootAreFound_singleJavaFileInPackage() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/projectroot/issue2615/without_module_info"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + List sourceRoots = projectRoot.getSourceRoots(); + sourceRoots.forEach(System.out::println); + + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactly("without_module_info"); + } + + @Test + void rootsAreFound_withModuleInfoAndJavaFileInPackage() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/projectroot/issue2615/with_module_info"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + List sourceRoots = projectRoot.getSourceRoots(); + sourceRoots.forEach(System.out::println); + + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactly("with_module_info"); + } + + @Test + void rootsAreFound_withModuleInfoInRootAndJavaFileInPackage() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve( + "src/test/resources/com/github/javaparser/utils/projectroot/issue2615/with_module_info_in_root"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + List sourceRoots = projectRoot.getSourceRoots(); + sourceRoots.forEach(System.out::println); + + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactly("with_module_info_in_root"); + } + + @Test + void rootsAreFound_parentOfMultipleSourceRootsWithAndWithoutModuleInfo() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/projectroot/issue2615"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + List sourceRoots = projectRoot.getSourceRoots(); + + // for (SourceRoot sourceRoot : sourceRoots) { + // sourceRoot.getRoot().normalize().endsWith("with_module_info"); + // System.out.println(sourceRoot); + // } + + assertEquals(3, sourceRoots.size()); + } + + @Test + void manualInspectionOfSystemOut_callbackOnSourceRootParse_parentOfMultipleSourceRootsWithAndWithoutModuleInfo() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/projectroot/issue2615"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + Callback cb = new Callback(); + + final List sourceRoots = projectRoot.getSourceRoots(); + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactlyInAnyOrder("with_module_info_in_root", "without_module_info", "with_module_info"); + + sourceRoots.forEach(sourceRoot -> { + try { + sourceRoot.parse("", cb); + } catch (IOException e) { + System.err.println("IOException: " + e); + } + }); + } + + @Test + void manualInspectionOfSystemOut_callbackOnSourceRootParse_singleJavaFileInPackage() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/projectroot/issue2615/without_module_info"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + Callback cb = new Callback(); + + final List sourceRoots = projectRoot.getSourceRoots(); + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactlyInAnyOrder("without_module_info"); + + sourceRoots.forEach(sourceRoot -> { + try { + sourceRoot.parse("", cb); + } catch (IOException e) { + System.err.println("IOException: " + e); + } + }); + } + + @Test + void manualInspectionOfSystemOut_callbackOnSourceRootParse_withModuleInfoAndJavaFileInPackage() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/projectroot/issue2615/with_module_info"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + Callback cb = new Callback(); + + final List sourceRoots = projectRoot.getSourceRoots(); + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactlyInAnyOrder("with_module_info"); + + sourceRoots.forEach(sourceRoot -> { + try { + sourceRoot.parse("", cb); + } catch (IOException e) { + System.err.println("IOException: " + e); + } + }); + } + + @Test + void manualInspectionOfSystemOut_callbackOnSourceRootParse_withModuleInfoInRootAndJavaFileInPackage() { + final Path root = mavenModuleRoot(SourceRootTest.class) + .resolve( + "src/test/resources/com/github/javaparser/utils/projectroot/issue2615/with_module_info_in_root"); + final ProjectRoot projectRoot = parserCollectionStrategy.collect(root); + + Callback cb = new Callback(); + + final List sourceRoots = projectRoot.getSourceRoots(); + assertThat(sourceRoots) + .map(SourceRoot::getRoot) + .extracting(Path::getFileName) + .map(Path::getFileName) + .map(Path::toString) + .containsExactlyInAnyOrder("with_module_info_in_root"); + + sourceRoots.forEach(sourceRoot -> { + try { + sourceRoot.parse("", cb); + } catch (IOException e) { + System.err.println("IOException: " + e); + } + }); + } + + private static class Callback implements SourceRoot.Callback { + + @Override + public Result process(Path localPath, Path absolutePath, ParseResult result) { + System.out.printf("Found %s%n", absolutePath); + return Result.SAVE; + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/PositionUtilsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/PositionUtilsTest.java new file mode 100644 index 0000000..a4a9070 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/PositionUtilsTest.java @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.utils.PositionUtils.nodeContains; +import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.expr.AnnotationExpr; +import com.github.javaparser.ast.expr.SimpleName; +import com.github.javaparser.ast.type.Type; +import org.junit.jupiter.api.Test; + +public class PositionUtilsTest { + @Test + public void nodeContains_NoAnnotationsAnywhere_IgnoringAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("class X { int a; }"); + FieldDeclaration field = cu.findFirst(FieldDeclaration.class).get(); + + boolean contains = nodeContains(cu, field, true); + assertTrue(contains); + } + + @Test + public void nodeDoesNotContain_NoAnnotationsAnywhere_IgnoringAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("class X { int a; }"); + FieldDeclaration field = cu.findFirst(FieldDeclaration.class).get(); + + Type fieldType = field.getVariable(0).getType(); + SimpleName fieldName = field.getVariable(0).getName(); + + boolean contains = nodeContains(fieldType, fieldName, true); + assertFalse(contains); + } + + @Test + public void nodeContains_NoAnnotationsAnywhere_IncludeAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("class X { int a; }"); + FieldDeclaration field = cu.findFirst(FieldDeclaration.class).get(); + + boolean contains = nodeContains(cu, field, false); + assertTrue(contains); + } + + @Test + public void nodeDoesNotContain_NoAnnotationsAnywhere_IncludeAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("class X { int a; }"); + FieldDeclaration field = cu.findFirst(FieldDeclaration.class).get(); + + Type fieldType = field.getVariable(0).getType(); + SimpleName fieldName = field.getVariable(0).getName(); + + boolean contains = nodeContains(fieldType, fieldName, false); + assertFalse(contains, "Type and Name are separate branches of the AST, thus should not contain each other."); + } + + @Test + public void nodeContainsAnnotations_IgnoringAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("@A class X {} class Y {}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + ClassOrInterfaceDeclaration y = cu.getClassByName("Y").get(); + + boolean contains = nodeContains(x, y, true); + assertFalse(contains); + } + + @Test + public void nodeContainsAnnotations_WithCommentNodeInTheMiddle_IgnoringAnnotations() { + String code = "" + "@A\n" + "/*o*/\n" + "@B\n" + "class X {\n" + "}\n" + ""; + + CompilationUnit cu = StaticJavaParser.parse(code); + assertEqualsStringIgnoringEol(code, cu.toString(), "Issue with the parsing of the code, not this test."); + + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + AnnotationExpr annotationB = x.getAnnotationByName("B").get(); + + // Comment gets added to the MarkerAnnotationExpr for @B -- correct + Comment o = annotationB.getComment().get(); + assertEquals(annotationB, o.getCommentedNode().get(), "Comment has been added to an unexpected node."); + + boolean contains = nodeContains(x, o, true); + assertFalse(contains); + } + + @Test + public void nodeContainsAnnotations_WithAnnotationNodeInTheMiddle() { + String code = "" + "@A\n" + "@B\n" + "@C\n" + "class X {\n" + "}\n" + ""; + CompilationUnit cu = StaticJavaParser.parse(code); + assertEqualsStringIgnoringEol(code, cu.toString(), "Issue with the parsing of the code, not this test."); + + final ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + final AnnotationExpr annotationA = x.getAnnotationByName("A").get(); + final AnnotationExpr annotationB = x.getAnnotationByName("B").get(); + final AnnotationExpr annotationC = x.getAnnotationByName("C").get(); + + // If including annotations (i.e. NOT ignoring them), all nodes should be included + assertTrue(nodeContains(x, annotationA, false), formatRangeCompareResult(x, annotationA, "X", "A")); + assertTrue(nodeContains(x, annotationB, false), formatRangeCompareResult(x, annotationB, "X", "B")); + assertTrue(nodeContains(x, annotationC, false), formatRangeCompareResult(x, annotationC, "X", "C")); + assertTrue(nodeContains(x, x, false), formatRangeCompareResult(x, x, "X", "X")); + + // If ignoring annotations, only the node itself should be included + assertFalse(nodeContains(x, annotationA, true), formatRangeCompareResult(x, annotationA, "X", "A")); + assertFalse(nodeContains(x, annotationB, true), formatRangeCompareResult(x, annotationB, "X", "B")); + assertFalse(nodeContains(x, annotationC, true), formatRangeCompareResult(x, annotationC, "X", "C")); + assertFalse(nodeContains(x, x, true), formatRangeCompareResult(x, x, "X", "X")); + } + + private String formatRangeCompareResult(Node x, Node annotationA, String containerId, String otherId) { + return String.format( + "container range in detected as NOT containing other range: " + "\n - container (%s): %s" + + "\n - other (%s): %s", + containerId, + x.getRange().get().toString(), + otherId, + annotationA.getRange().get().toString()); + } + + @Test + public void nodeContainsAnnotations_WithCommentAtTheEndOfAnnotations_IgnoringAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("@A @B /*o*/ public class X {}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + + // TODO: Should the comment be attached to the SimpleName (as opposed to the ClassOrInterfaceDeclaration?) + SimpleName simpleName = x.getName(); + Comment o = simpleName.getComment().get(); + + //// 0 1 2 2 + //// 123456789012345678901234567890 + //// @A @B /*o*/ public class X {} + //// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // range of x, WITH annotations -- thus contained == TRUE + //// @A @B /*o*/ public class X {} + //// ^^^^^^^^^^^^^^^^^ // range of x, ignoring annotations -- thus contained == FALSE + //// @A @B /*o*/ public class X {} + //// ^^^^^ // range of o + + // TODO: Determine if comments outside the text range of a node are "contained" within a node (part of the + // subtree, but are printed before). + assertTrue(nodeContains(x, o, false), formatRangeCompareResult(x, o, "X", "o")); + assertFalse(nodeContains(x, o, true), formatRangeCompareResult(x, o, "X", "o")); + + // FIXME: Both tests currently fail due to the comment being attached to the SimpleName, as opposed to the + // ClassOrInterfaceDeclaration + // assertEquals(x.getClass(), o.getCommentedNode().get().getClass(), "Comment attached to an unexpected + // node -- expected to be the ClassOrInterfaceDeclaration"); + // assertEquals(x, o.getCommentedNode().get(), "Comment attached to an unexpected node -- expected to be + // the ClassOrInterfaceDeclaration"); + + } + + @Test + public void nodeContainsAnnotations_WithCommentAfterTheEnd_IgnoringAnnotations() { + CompilationUnit cu = StaticJavaParser.parse("@A @B public /*o*/ class X {}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + + // TODO: Should the comment be attached to the SimpleName (as opposed to the ClassOrInterfaceDeclaration?) + SimpleName simpleName = x.getName(); + Comment o = simpleName.getComment().get(); + + //// 0 1 2 2 + //// 123456789012345678901234567890 + //// @A @B public /*o*/ class X {} + //// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // range of x, WITH annotations -- thus contained == TRUE + //// @A @B public /*o*/ class X {} + //// ^^^^^^^^^^^^^^^^^^^^^^^ // range of x, ignoring annotations -- thus contained == TRUE + //// @A @B public /*o*/ class X {} + //// ^^^^^ // range of o + + // TODO: Determine if comments outside the text range of a node are "contained" within a node (part of the + // subtree, but are printed before). + assertTrue(nodeContains(x, o, false), formatRangeCompareResult(x, o, "X", "o")); + assertTrue(nodeContains(x, o, true), formatRangeCompareResult(x, o, "X", "o")); + + // FIXME: Both tests currently fail due to the comment being attached to the SimpleName, as opposed to the + // ClassOrInterfaceDeclaration + // assertEquals(x.getClass(), o.getCommentedNode().get().getClass(), "Comment attached to an unexpected + // node -- expected to be the ClassOrInterfaceDeclaration"); + // assertEquals(x, o.getCommentedNode().get(), "Comment attached to an unexpected node -- expected to be + // the ClassOrInterfaceDeclaration"); + + } + + @Test + public void nodeContainsAnnotations_WithCommentAfterTheEnd_IgnoringAnnotations2() { + CompilationUnit cu = StaticJavaParser.parse("@A @B public class /*o*/ X {}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + + // TODO: Should the comment be attached to the SimpleName (as opposed to the ClassOrInterfaceDeclaration?) + SimpleName simpleName = x.getName(); + Comment o = simpleName.getComment().get(); + + //// 12345678912345678912345678901 + //// @A @B public class /*o*/ X {} + //// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // range of x, WITH annotations -- thus contained == TRUE + //// @A @B public class /*o*/ X {} + //// ^^^^^^^^^^^^^^^^^^^^^^^ // range of x, ignoring annotations -- thus contained == TRUE + //// @A @B public class /*o*/ X {} + //// ^^^^^ // range of o + + // TODO: Determine if comments outside the text range of a node are "contained" within a node (part of the + // subtree, but are printed before). + assertTrue(nodeContains(x, o, false), formatRangeCompareResult(x, o, "X", "o")); + assertTrue(nodeContains(x, o, true), formatRangeCompareResult(x, o, "X", "o")); + + assertTrue(o.getCommentedNode().isPresent()); + + // FIXME: Both tests currently fail due to the comment being attached to the SimpleName, as opposed to the + // ClassOrInterfaceDeclaration + // assertEquals(x.getClass(), o.getCommentedNode().get().getClass(), "Comment attached to an unexpected + // node -- expected to be the ClassOrInterfaceDeclaration"); + // assertEquals(x, o.getCommentedNode().get(), "Comment attached to an unexpected node -- expected to be + // the ClassOrInterfaceDeclaration"); + + } + + @Test + public void nodeContainsAnnotations_WithCommentAfterTheEnd_IgnoringAnnotations3() { + CompilationUnit cu = StaticJavaParser.parse("@A @B public class X /*o*/ {}"); + ClassOrInterfaceDeclaration x = cu.getClassByName("X").get(); + + // // TODO: At what point is the declaration supposed to end and the code block begin? Should the block + // comment move "inside" the code block? + // // cu = + // @A + // @B + // public class X { + // /*o*/ + // } + + // TODO: Should the comment be attached to the SimpleName (as opposed to being attached to null but not + // orphaned?) + Comment o = cu.getComments().get(0); + + //// 12345678912345678912345678901 + //// @A @B public class X /*o*/ {} + //// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // range of x, WITH annotations -- thus contained == TRUE + //// @A @B public class X /*o*/ {} + //// ^^^^^^^^^^^^^^^^^^^^^^^ // range of x, ignoring annotations -- thus contained == TRUE + //// @A @B public class X /*o*/ {} + //// ^^^^^ // range of o + + // TODO: Determine if comments outside the text range of a node are "contained" within a node (part of the + // subtree, but are printed before). + assertTrue(nodeContains(x, o, false), formatRangeCompareResult(x, o, "X", "o")); + assertTrue(nodeContains(x, o, true), formatRangeCompareResult(x, o, "X", "o")); + + // FIXME: Comment is unattached (returns null), but is not considered to be orphaned...? + // assertTrue(o.getCommentedNode().isPresent()); + + // FIXME: Both tests currently fail due to the comment being unattached, as opposed to the + // ClassOrInterfaceDeclaration + // assertEquals(x.getClass(), o.getCommentedNode().get().getClass(), "Comment attached to an unexpected + // node -- expected to be the ClassOrInterfaceDeclaration"); + // assertEquals(x, o.getCommentedNode().get(), "Comment attached to an unexpected node -- expected to be + // the ClassOrInterfaceDeclaration"); + + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/SourceRootTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/SourceRootTest.java new file mode 100644 index 0000000..33d3369 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/SourceRootTest.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.printer.ConfigurablePrinter; +import com.github.javaparser.printer.DefaultPrettyPrinter; +import com.github.javaparser.printer.configuration.DefaultConfigurationOption; +import com.github.javaparser.printer.configuration.DefaultPrinterConfiguration.ConfigOption; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; +import org.mockito.Mockito; + +class SourceRootTest { + private final Path root = CodeGenerationUtils.mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/"); + private final SourceRoot sourceRoot = new SourceRoot(root); + private ConfigurablePrinter printer; + + @BeforeEach + void before() { + sourceRoot.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.BLEEDING_EDGE); + printer = new DefaultPrettyPrinter(); + sourceRoot.setPrinter(printer::print); + } + + @Test + void parseTestDirectory() throws IOException { + List> parseResults = sourceRoot.tryToParse(); + List units = sourceRoot.getCompilationUnits(); + + assertEquals(7, units.size()); + assertTrue(units.stream() + .allMatch(unit -> !unit.getTypes().isEmpty() || unit.getModule().isPresent())); + assertTrue(parseResults.stream().noneMatch(cu -> cu.getResult() + .get() + .getStorage() + .get() + .getPath() + .toString() + .contains("source.root"))); + } + + @Test + void saveInCallback() throws IOException { + printer.getConfiguration() + .addOption(new DefaultConfigurationOption( + ConfigOption.END_OF_LINE_CHARACTER, LineSeparator.LF.asRawString())); + sourceRoot.parse( + "", + sourceRoot.getParserConfiguration(), + (localPath, absolutePath, result) -> SourceRoot.Callback.Result.SAVE); + } + + @Test + void saveInCallbackParallelized() { + printer.getConfiguration() + .addOption(new DefaultConfigurationOption( + ConfigOption.END_OF_LINE_CHARACTER, LineSeparator.LF.asRawString())); + sourceRoot.parseParallelized( + "", + sourceRoot.getParserConfiguration(), + ((localPath, absolutePath, result) -> SourceRoot.Callback.Result.SAVE)); + } + + @Test + void fileAsRootIsNotAllowed() { + assertThrows(IllegalArgumentException.class, () -> { + Path path = CodeGenerationUtils.classLoaderRoot(SourceRootTest.class) + .resolve("com/github/javaparser/utils/Bla.java"); + new SourceRoot(path); + }); + } + + @Test + void dotsInRootDirectoryAreAllowed() throws IOException { + Path path = CodeGenerationUtils.mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils/source.root"); + new SourceRoot(path).tryToParse(); + } + + @Test + void dotsInPackageAreNotAllowed() { + assertThrows(ParseProblemException.class, () -> { + Path path = CodeGenerationUtils.mavenModuleRoot(SourceRootTest.class) + .resolve("src/test/resources/com/github/javaparser/utils"); + new SourceRoot(path).parse("source.root", "Y.java"); + }); + } + + @Test + void isSensibleDirectoryToEnter() throws IOException { + try (MockedStatic mockedFiles = Mockito.mockStatic(Files.class)) { + mockedFiles.when(() -> Files.isHidden(Mockito.any())).thenReturn(false); + mockedFiles.when(() -> Files.isDirectory(Mockito.any())).thenReturn(true); + SourceRoot root = new SourceRoot(Paths.get("tests/01")); + assertTrue(root.isSensibleDirectoryToEnter(root.getRoot())); + } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java new file mode 100644 index 0000000..db94f3b --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/SourceZipTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ParseResult; +import com.github.javaparser.ast.CompilationUnit; +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class SourceZipTest { + + private final Path testDir = CodeGenerationUtils.mavenModuleRoot(SourceZipTest.class) + .resolve(Paths.get( + "..", + "javaparser-core-testing", + "src", + "test", + "resources", + "com", + "github", + "javaparser", + "source_zip")) + .normalize(); + + @Test + void parseTestDirectory() throws IOException { + SourceZip sourceZip = new SourceZip(testDir.resolve("test.zip")); + List>> results = sourceZip.parse(); + assertEquals(3, results.size()); + List units = new ArrayList<>(); + for (Pair> pr : results) { + units.add(pr.b.getResult().get()); + } + assertTrue(units.stream().noneMatch(unit -> unit.getTypes().isEmpty())); + } + + @Test + void parseTestDirectoryWithCallback() throws IOException { + SourceZip sourceZip = new SourceZip(testDir.resolve("test.zip")); + List>> results = new ArrayList<>(); + + sourceZip.parse((path, result) -> results.add(new Pair<>(path, result))); + + assertEquals(3, results.size()); + List units = new ArrayList<>(); + for (Pair> pr : results) { + units.add(pr.b.getResult().get()); + } + assertTrue(units.stream().noneMatch(unit -> unit.getTypes().isEmpty())); + } + + @Test + void dirAsZipIsNotAllowed() { + assertThrows(IOException.class, () -> new SourceZip(testDir.resolve("test")).parse()); + } + + @Test + void fileAsZipIsNotAllowed() { + assertThrows(IOException.class, () -> new SourceZip(testDir.resolve("test.txt")).parse()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/TestParser.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/TestParser.java new file mode 100644 index 0000000..4f79cd2 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/TestParser.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.BLEEDING_EDGE; +import static org.junit.jupiter.api.Assertions.fail; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.VariableDeclarationExpr; +import com.github.javaparser.ast.stmt.Statement; +import java.util.HashMap; +import java.util.Map; + +public class TestParser { + + private static final Map parserCache = new HashMap<>(); + + private static JavaParser parser(LanguageLevel languageLevel) { + return parserCache.computeIfAbsent( + languageLevel, ll -> new JavaParser(new ParserConfiguration().setLanguageLevel(ll))); + } + + private static T unpack(ParseResult result) { + if (!result.isSuccessful()) { + fail(result.getProblems().toString()); + } + return result.getResult().get(); + } + + public static CompilationUnit parseCompilationUnit(String stmt) { + return unpack(parser(BLEEDING_EDGE).parse(stmt)); + } + + public static Statement parseStatement(String stmt) { + return unpack(parser(BLEEDING_EDGE).parseStatement(stmt)); + } + + public static T parseExpression(String expr) { + return unpack(parser(BLEEDING_EDGE).parseExpression(expr)); + } + + public static > T parseBodyDeclaration(String bd) { + return (T) unpack(parser(BLEEDING_EDGE).parseBodyDeclaration(bd)); + } + + public static VariableDeclarationExpr parseVariableDeclarationExpr(String bd) { + return unpack(parser(BLEEDING_EDGE).parseVariableDeclarationExpr(bd)); + } + + public static CompilationUnit parseCompilationUnit(LanguageLevel languageLevel, String stmt) { + return unpack(parser(languageLevel).parse(stmt)); + } + + public static Statement parseStatement(LanguageLevel languageLevel, String stmt) { + return unpack(parser(languageLevel).parseStatement(stmt)); + } + + public static T parseExpression(LanguageLevel languageLevel, String expr) { + return unpack(parser(languageLevel).parseExpression(expr)); + } + + public static > T parseBodyDeclaration(LanguageLevel languageLevel, String bd) { + return (T) unpack(parser(languageLevel).parseBodyDeclaration(bd)); + } + + public static VariableDeclarationExpr parseVariableDeclarationExpr(LanguageLevel languageLevel, String bd) { + return unpack(parser(languageLevel).parseVariableDeclarationExpr(bd)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/TestUtils.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/TestUtils.java new file mode 100644 index 0000000..8028f07 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/TestUtils.java @@ -0,0 +1,392 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_9; +import static com.github.javaparser.Providers.provider; +import static com.github.javaparser.utils.CodeGenerationUtils.f; +import static com.github.javaparser.utils.Utils.normalizeEolInTextBlock; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.Arrays.asList; +import static java.util.stream.Collectors.toList; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.*; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.expr.Expression; +import java.io.*; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public class TestUtils { + + /** + * Read the resource's contents line-by-line, and use the system's line separator to separate lines. + * Takes care of setting all the end of line character to platform specific ones. + *
+ *
If you wish to read the file as-is, use {@link #readResource(String)} which reads the file stream character-by-character. + */ + public static String readResourceUsingSystemEol(String resourceName) { + return readResource(resourceName, LineSeparator.SYSTEM); + } + + /** + * Read the resource's contents line-by-line, and use the given line separator to separate lines. + *
+ *
If you wish to read the file as-is, use {@link #readResource(String)} which reads the file stream character-by-character. + */ + public static String readResource(String resourceName, LineSeparator lineSeparator) { + if (resourceName.startsWith("/")) { + resourceName = resourceName.substring(1); + } + try (final InputStream resourceAsStream = + TestUtils.class.getClassLoader().getResourceAsStream(resourceName)) { + if (resourceAsStream == null) { + fail("resource not found by name: " + resourceName); + } + try (final InputStreamReader reader = new InputStreamReader(resourceAsStream, UTF_8); + final BufferedReader br = new BufferedReader(reader)) { + final StringBuilder builder = new StringBuilder(4096); + String line; + while ((line = br.readLine()) != null) { + builder.append(line).append(lineSeparator.asRawString()); + } + return builder.toString(); + } + } catch (IOException e) { + fail(e); + return null; + } + } + + /** + * Read the resource's contents as-is. + *
+ *
If you wish to specify the line endings, + * use {@link #readResourceUsingSystemEol(String)} + * or {@link #readResource(String, LineSeparator)} + */ + public static String readResource(String resourceName) { + if (resourceName.startsWith("/")) { + resourceName = resourceName.substring(1); + } + try (final InputStream resourceAsStream = + TestUtils.class.getClassLoader().getResourceAsStream(resourceName)) { + if (resourceAsStream == null) { + fail("not found: " + resourceName); + } + try (final InputStreamReader reader = new InputStreamReader(resourceAsStream, UTF_8); + final BufferedReader br = new BufferedReader(reader)) { + // Switched to reading char-by-char as opposed to line-by-line. + // This helps to retain the resource's own line endings. + final StringBuilder builder = new StringBuilder(4096); + for (int c = br.read(); c != -1; c = br.read()) { + builder.append((char) c); + } + return builder.toString(); + } + } catch (IOException e) { + fail(e); + return null; + } + } + + /** + * Use this assertion if line endings are important, otherwise use {@link #assertEqualToTextResourceNoEol(String, String)} + */ + public static void assertEqualToTextResource(String resourceName, String actual) { + String expected = readResourceUsingSystemEol(resourceName); + assertEqualsString(expected, actual); + } + + /** + * If line endings are important, use {@link #assertEqualToTextResource(String, String)} + */ + public static void assertEqualToTextResourceNoEol(String resourceName, String actual) { + String expected = readResourceUsingSystemEol(resourceName); + assertEqualsStringIgnoringEol(expected, actual); + } + + public static String readTextResource(Class relativeClass, String resourceName) { + final URL resourceAsStream = relativeClass.getResource(resourceName); + try { + byte[] bytes = Files.readAllBytes(Paths.get(resourceAsStream.toURI())); + return new String(bytes, UTF_8); + } catch (IOException | URISyntaxException e) { + fail(e); + return null; + } + } + + public static void assertInstanceOf(Class expectedType, Object instance) { + assertTrue( + expectedType.isAssignableFrom(instance.getClass()), + f("%s is not an instance of %s.", instance.getClass(), expectedType)); + } + + /** + * Unzip a zip file into a directory. + */ + public static void unzip(Path zipFile, Path outputFolder) throws IOException { + Log.info("Unzipping %s to %s", () -> zipFile, () -> outputFolder); + + final byte[] buffer = new byte[1024 * 1024]; + + outputFolder.toFile().mkdirs(); + + try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile.toFile()))) { + ZipEntry ze = zis.getNextEntry(); + + while (ze != null) { + final Path newFile = outputFolder.resolve(ze.getName()); + if (!newFile.normalize().startsWith(outputFolder.normalize())) { + throw new IOException("Bad zip entry"); + } + + if (ze.isDirectory()) { + Log.trace("mkdir %s", newFile::toAbsolutePath); + newFile.toFile().mkdirs(); + } else { + Log.info("unzip %s", newFile::toAbsolutePath); + try (FileOutputStream fos = new FileOutputStream(newFile.toFile())) { + int len; + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len); + } + } + } + zis.closeEntry(); + ze = zis.getNextEntry(); + } + } + Log.info("Unzipped %s to %s", () -> zipFile, () -> outputFolder); + } + + /** + * Download a file from a URL to disk. + */ + public static void download(URL url, Path destination) throws IOException { + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url(url).build(); + + Response response = client.newCall(request).execute(); + Files.write(destination, response.body().bytes()); + } + + public static String temporaryDirectory() { + return System.getProperty("java.io.tmpdir"); + } + + public static void assertCollections(Collection expected, Collection actual) { + final StringBuilder out = new StringBuilder(); + for (Object e : expected) { + if (actual.contains(e)) { + actual.remove(e); + } else { + out.append("Missing: ").append(e).append(LineSeparator.SYSTEM); + } + } + for (Object a : actual) { + out.append("Unexpected: ").append(a).append(LineSeparator.SYSTEM); + } + + String s = out.toString(); + if (s.isEmpty()) { + return; + } + fail(s); + } + + public static void assertProblems(ParseResult result, String... expectedArg) { + assertProblems(result.getProblems(), expectedArg); + } + + public static void assertProblems(List result, String... expectedArg) { + Set actual = result.stream().map(Problem::toString).collect(Collectors.toSet()); + Set expected = new HashSet<>(asList(expectedArg)); + assertCollections(expected, actual); + } + + public static void assertNoProblems(ParseResult result) { + assertProblems(result); + } + + public static void assertExpressionValid(String expression) { + JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_9)); + ParseResult result = javaParser.parse(ParseStart.EXPRESSION, provider(expression)); + assertTrue(result.isSuccessful(), result.getProblems().toString()); + } + + /** + * Assert that "actual" equals "expected", ignoring line separators. + * @deprecated Use {@link #assertEqualsStringIgnoringEol(String, String)} + */ + @Deprecated + public static void assertEqualsNoEol(String expected, String actual) { + assertEqualsStringIgnoringEol(expected, actual); + } + + /** + * Assert that "actual" equals "expected", ignoring line separators. + * @deprecated Use {@link #assertEqualsStringIgnoringEol(String, String, String)} + */ + @Deprecated + public static void assertEqualsNoEol(String expected, String actual, String message) { + assertEqualsStringIgnoringEol(expected, actual, message); + } + + /** + * Assert that "actual" equals "expected". + *
First checks if the content is equal ignoring line separators. + *
If this passes, then we check if the content is equal - if this fails then we can + * advise that the difference is only in the line separators. + */ + public static void assertEqualsString(String expected, String actual) { + assertEqualsString(expected, actual, ""); + } + + /** + * Assert that "actual" equals "expected". + *
First checks if the content is equal ignoring line separators. + *
If this passes, then we check if the content is equal - if this fails then we can + * advise that the difference is only in the line separators. + */ + public static void assertEqualsString(String expected, String actual, String message) { + // First test equality ignoring EOL chars + assertEqualsStringIgnoringEol(expected, actual, message); + + // If this passes but the next one fails, the failure is due only to EOL differences, allowing a more precise + // test failure message. + assertEquals( + expected, + actual, + message + + String.format( + " -- failed due to line separator differences -- Expected: %s, but actual: %s (system eol: %s)", + LineSeparator.detect(expected).asEscapedString(), + LineSeparator.detect(actual).asEscapedString(), + LineSeparator.SYSTEM.asEscapedString())); + } + + /** + * Assert that "actual" equals "expected", ignoring line separators. + */ + public static void assertEqualsStringIgnoringEol(String expected, String actual) { + assertEquals( + normalizeEolInTextBlock(expected, LineSeparator.ARBITRARY), + normalizeEolInTextBlock(actual, LineSeparator.ARBITRARY)); + } + + /** + * Assert that "actual" equals "expected", ignoring line separators. + */ + public static void assertEqualsStringIgnoringEol(String expected, String actual, String message) { + assertEquals( + normalizeEolInTextBlock(expected, LineSeparator.ARBITRARY), + normalizeEolInTextBlock(actual, LineSeparator.ARBITRARY), + message); + } + + /** + * Assert that the given string is detected as having the given line separator. + */ + public static void assertLineSeparator(String text, LineSeparator expectedLineSeparator) { + LineSeparator actualLineSeparator = LineSeparator.detect(text); + assertEquals(expectedLineSeparator, actualLineSeparator); + } + + /** + * Does this node's token starting position match the line and col? + */ + public static boolean startsAtPosition(Node node, int line, int col) { + Position begin = getNodeStartTokenPosition(node); + return begin.line == line && begin.column == col; + } + + /** + * Quickly get token starting position of a given node + */ + public static Position getNodeStartTokenPosition(Node node) { + return node.getTokenRange() + .orElseThrow(() -> new IllegalStateException(node + " is missing the token range")) + .toRange() + .orElseThrow(() -> new IllegalStateException(node + "'s token range is missing the range")) + .begin; + } + + /** + * parse a file using a given parser relative to the classpath root + */ + public static CompilationUnit parseFile(JavaParser parser, String filePath) { + try (InputStream in = TestUtils.class.getResourceAsStream(filePath)) { + ParseResult parse = parser.parse(in); + List problems = parse.getProblems(); + if (!problems.isEmpty()) { + throw new IllegalStateException(problems.toString()); + } + return parse.getResult() + .orElseThrow(() -> new IllegalArgumentException("No result when attempting to parse " + filePath)); + } catch (IOException ex) { + throw new IllegalStateException("Error while parsing " + filePath, ex); + } + } + + /** + * parse a file relative to the classpath root + */ + public static CompilationUnit parseFile(String filePath) { + return parseFile(new JavaParser(), filePath); + } + + public static N getNodeStartingAtPosition(List chars, int line, int col) { + List nodesAtPosition = + chars.stream().filter(expr -> startsAtPosition(expr, line, col)).collect(toList()); + + if (nodesAtPosition.size() != 1) { + throw new IllegalArgumentException("Expecting exactly one node to be positioned at " + line + "," + col + + " but got " + nodesAtPosition); + } + return nodesAtPosition.get(0); + } + + /** + * Assert that the given string is detected as having the given line separator. + */ + public static void assertLineSeparator(String text, LineSeparator expectedLineSeparator, String message) { + LineSeparator actualLineSeparator = LineSeparator.detect(text); + assertEquals(expectedLineSeparator, actualLineSeparator, message); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/UtilsTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/UtilsTest.java new file mode 100644 index 0000000..5c71e24 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/UtilsTest.java @@ -0,0 +1,214 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.utils.Utils.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class UtilsTest { + + @Test + void testIsNullOrEmpty() { + assertTrue(isNullOrEmpty(null)); + assertTrue(isNullOrEmpty(new ArrayList<>())); + + assertFalse(isNullOrEmpty(new ArrayList<>(Arrays.asList("foo", "bar")))); + } + + @Test + void testAssertNotNull() { + assertEquals("foo", assertNotNull("foo")); + assertThrows(AssertionError.class, () -> assertNotNull(null)); + } + + @Test + void testAssertNonEmpty() { + assertEquals("foo", assertNonEmpty("foo")); + assertThrows(AssertionError.class, () -> assertNonEmpty("")); + assertThrows(AssertionError.class, () -> assertNonEmpty(null)); + } + + @Test + void testAssertNonNegative() { + assertEquals((Number) 2, assertNonNegative(2)); + assertThrows(AssertionError.class, () -> assertNonNegative(-2)); + } + + @Test + void testAssertPositive() { + assertEquals((Number) 2, assertPositive(2)); + assertThrows(AssertionError.class, () -> assertPositive(-2)); + } + + @Test + void testEscapeEndOfLines() { + assertEquals("f\\no\\ro", escapeEndOfLines("f\no\ro")); + } + + @Test + void testReaderToString() throws IOException { + Reader reader = new Reader() { + @Override + public int read(char[] chars, int i, int i1) throws IOException { + return 0; + } + + @Override + public void close() throws IOException {} + }; + assertEquals("", readerToString(reader)); + } + + @Test + void testToCamelCase() { + assertEquals("foo", toCamelCase("foo")); + assertEquals("foo", toCamelCase("Foo")); + assertEquals("foo", toCamelCase("FOO")); + assertEquals("foo", toCamelCase("fOo")); + } + + @Test + void testScreamingToCamelCase() { + assertEquals("abc", screamingToCamelCase("ABC")); + assertEquals("abcDef", screamingToCamelCase("ABC_DEF")); + assertEquals("abc", screamingToCamelCase("ABC_")); + } + + @Test + void screamingEmptyString() { + assertEquals("", camelCaseToScreaming("")); + assertEquals("ABC", camelCaseToScreaming("abc")); + assertEquals("HELLO_HELLO", camelCaseToScreaming("HelloHello")); + assertEquals("APE_TAIL", camelCaseToScreaming("apeTail")); + } + + @Test + void testNextWord() { + assertEquals("foo", nextWord("foo")); + assertEquals("foo", nextWord("foo bar")); + assertEquals("foo", nextWord("foo bar Baz")); + } + + @Test + void testIndent() { + assertEquals("foo", indent(new StringBuilder("foo"), 0).toString()); + assertEquals("foo\t", indent(new StringBuilder("foo"), 1).toString()); + assertEquals("foo\t\t", indent(new StringBuilder("foo"), 2).toString()); + assertEquals("foo\t\t\t", indent(new StringBuilder("foo"), 3).toString()); + } + + @Test + void capitalizeOnEmptyString() { + assertThrows(IllegalArgumentException.class, () -> capitalize("")); + } + + @Test + void capitalizeOnStringOfOneCharacter() { + assertEquals("F", capitalize("f")); + } + + @Test + void capitalizeOnStringOfTwoCharacters() { + assertEquals("Fo", capitalize("fo")); + } + + @Test + void decapitalizeOnEmptyString() { + assertThrows(IllegalArgumentException.class, () -> decapitalize("")); + } + + @Test + void decapitalizeOnStringOfOneCharacter() { + assertEquals("f", decapitalize("F")); + } + + @Test + void decapitalizeOnStringOfTwoCharacters() { + assertEquals("fo", decapitalize("Fo")); + } + + @Test + void testValueIsNullOrEmpty() { + assertTrue(valueIsNullOrEmpty(null)); + assertTrue(valueIsNullOrEmpty(Optional.empty())); + assertTrue(valueIsNullOrEmpty(new ArrayList<>())); + + assertFalse(valueIsNullOrEmpty(Optional.ofNullable("foo"))); + assertFalse(valueIsNullOrEmpty(new ArrayList<>(Arrays.asList("foo", "bar")))); + } + + @Test + void testValueIsNullOrEmptyStringOrOptional() { + assertTrue(valueIsNullOrEmptyStringOrOptional(null)); + assertTrue(valueIsNullOrEmptyStringOrOptional(Optional.empty())); + + assertFalse(valueIsNullOrEmptyStringOrOptional("foo")); + assertFalse(valueIsNullOrEmptyStringOrOptional("")); + assertFalse(valueIsNullOrEmptyStringOrOptional(Optional.ofNullable("foo"))); + assertFalse(valueIsNullOrEmptyStringOrOptional(Optional.ofNullable(""))); + } + + @Test + void testIndexOfElementByObjectIdentity() { + assertEquals(-1, indexOfElementByObjectIdentity(new ArrayList<>(), "bar")); + assertEquals(1, indexOfElementByObjectIdentity(new ArrayList<>(Arrays.asList("foo", "bar")), "bar")); + } + + @Test + void testSet() { + assertEquals(new HashSet<>(Arrays.asList("bar", "foo", "baz")), set("foo", "bar", "baz")); + } + + @Test + void normalizeEolInTextBlock() { + String result = Utils.normalizeEolInTextBlock("\r\n \r \n", "Q"); + assertEquals("Q Q Q", result); + } + + @Test + void testRemoveFileExtension() { + assertEquals("foo", removeFileExtension("foo")); + assertEquals("foo", removeFileExtension("foo.txt")); + } + + @Test + void testTrimTrailingSpaces() { + assertEquals("abc", trimTrailingSpaces("abc")); + assertEquals(" abc", trimTrailingSpaces(" abc")); + assertEquals("abc", trimTrailingSpaces("abc ")); + assertEquals(" abc", trimTrailingSpaces(" abc ")); + assertEquals("abc", trimTrailingSpaces("abc\t\0")); + assertEquals("", trimTrailingSpaces(" ")); + assertEquals("", trimTrailingSpaces("")); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorListTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorListTest.java new file mode 100644 index 0000000..35b05da --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorListTest.java @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor; +import com.github.javaparser.ast.visitor.ObjectIdentityHashCodeVisitor; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.junit.jupiter.api.Test; + +class VisitorListTest { + + @Test + void visitorAddAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + VisitorList vList = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + vList.addAll(list); + for (int i = 0; i < list.size(); i++) assertEquals(list.get(i), vList.get(i)); + } + + @Test + void visitorAddAllAtIndex() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class Y{}")); + VisitorList vList = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + vList.add(parse("class A{}")); + vList.add(parse("class B{}")); + vList.addAll(2, list); + vList.add(parse("class C{}")); + for (int i = 0; i < list.size(); i++) assertEquals(list.get(i), vList.get(2 + i)); + } + + @Test + void visitorListContains() { + CompilationUnit x1 = parse("class X{}"); + VisitorList list = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + list.add(x1); + assertTrue(list.contains(x1)); + } + + @Test + void visitorListContainsAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + VisitorList vList = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + vList.addAll(list); + assertTrue(vList.size() == 2 && vList.containsAll(list)); + } + + @Test + void visitorListIterator() { + VisitorList list = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + CompilationUnit x1 = parse("class X{}"); + list.add(x1); + CompilationUnit x2 = parse("class X{}"); + list.add(x2); + Iterator itr = list.iterator(); + assertEquals(x1, itr.next()); + itr.remove(); + assertEquals(1, list.size()); + assertEquals(x2, itr.next()); + itr.remove(); + assertEquals(0, list.size()); + } + + @Test + void visitorListListIterator() { + VisitorList list = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + CompilationUnit x1 = parse("class X{}"); + list.add(x1); + CompilationUnit x2 = parse("class X{}"); + list.add(x2); + Iterator itr = list.listIterator(2); + assertEquals(x1, itr.next()); + itr.remove(); + assertEquals(3, list.size()); + assertEquals(x2, itr.next()); + itr.remove(); + assertEquals(2, list.size()); + } + + @Test + void visitorListRemove() { + CompilationUnit x1 = parse("class X{}"); + VisitorList list = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + list.add(x1); + assertTrue(list.remove(x1)); + } + + @Test + void visitorListRemoveAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + VisitorList vList = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + vList.addAll(list); + vList.removeAll(list); + assertEquals(0, vList.size()); + } + + @Test + void visitorListRetainAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + VisitorList vList = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + vList.addAll(list); + vList.add(parse("class X{}")); + vList.retainAll(list); + assertEquals(2, vList.size()); + } + + @Test + void visitorListSubList() { + VisitorList list = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + assertEquals(4, list.size()); + List subLst = list.subList(1, 3); + assertEquals(2, subLst.size()); + subLst.add(parse("class X{}")); + assertEquals(3, subLst.size()); + assertEquals(5, list.size()); + } + + @Test + void visitorListToArray() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + List vList = + new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + vList.addAll(list); + for (CompilationUnit u : vList.toArray(new CompilationUnit[2])) assertTrue(vList.contains(u)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorMapTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorMapTest.java new file mode 100644 index 0000000..aa6ad78 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorMapTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.StaticJavaParser.parse; +import static org.junit.jupiter.api.Assertions.*; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor; +import com.github.javaparser.ast.visitor.ObjectIdentityHashCodeVisitor; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class VisitorMapTest { + @Test + void normalEqualsDoesDeepCompare() { + CompilationUnit x1 = parse("class X{}"); + CompilationUnit x2 = parse("class X{}"); + + Map map = new HashMap<>(); + map.put(x1, 1); + map.put(x2, 2); + assertEquals(1, map.size()); + } + + @Test + void objectIdentityEqualsDoesShallowCompare() { + CompilationUnit x1 = parse("class X{}"); + CompilationUnit x2 = parse("class X{}"); + + Map map = + new VisitorMap<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + map.put(x1, 1); + map.put(x2, 2); + assertEquals(2, map.size()); + } + + @Test + void visitorMapGet() { + CompilationUnit x1 = parse("class X{}"); + + Map map = + new VisitorMap<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + map.put(x1, 1); + assertEquals(1, (int) map.get(x1)); + } + + @Test + void visitorMapContainsKey() { + CompilationUnit x1 = parse("class X{}"); + + Map map = + new VisitorMap<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + map.put(x1, 1); + assertTrue(map.containsKey(x1)); + } + + @Test + void visitorMapPutAll() { + CompilationUnit x1 = parse("class X{}"); + CompilationUnit x2 = parse("class Y{}"); + Map map = new HashMap<>(); + map.put(x1, 1); + map.put(x2, 2); + Map visitorMap = + new VisitorMap<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + visitorMap.putAll(map); + assertEquals(2, visitorMap.size()); + } + + @Test + void remove() { + CompilationUnit x1 = parse("class X{}"); + VisitorMap map = + new VisitorMap<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + map.put(x1, 1); + assertTrue(map.containsKey(x1)); + + map.remove(x1); + + assertFalse(map.containsKey(x1)); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorSetTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorSetTest.java new file mode 100644 index 0000000..78fc025 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/utils/VisitorSetTest.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.utils; + +import static com.github.javaparser.StaticJavaParser.parse; +import static com.github.javaparser.StaticJavaParser.parseMethodDeclaration; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor; +import com.github.javaparser.ast.visitor.ObjectIdentityHashCodeVisitor; +import java.util.*; +import org.junit.jupiter.api.Test; + +class VisitorSetTest { + + @Test + void normalEqualsDoesDeepCompare() { + Set set = new HashSet<>(); + set.add(parse("class X{}")); + set.add(parse("class X{}")); + assertEquals(1, set.size()); + } + + @Test + void objectIdentityEqualsDoesShallowCompare() { + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.add(parse("class X{}")); + set.add(parse("class X{}")); + assertEquals(2, set.size()); + } + + @Test + void visitorSetContains() { + CompilationUnit x1 = parse("class X{}"); + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.add(x1); + assertTrue(set.contains(x1)); + } + + @Test + void visitorSetContainsAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.addAll(list); + assertTrue(set.size() == 2 && set.containsAll(list)); + } + + @Test + void visitorSetIterator() { + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + CompilationUnit x1 = parse("class X{}"); + set.add(x1); + CompilationUnit x2 = parse("class X{}"); + set.add(x2); + Iterator itr = set.iterator(); + assertEquals(x1, itr.next()); + itr.remove(); + assertEquals(1, set.size()); + assertEquals(x2, itr.next()); + itr.remove(); + assertEquals(0, set.size()); + } + + @Test + void visitorSetRemove() { + CompilationUnit x1 = parse("class X{}"); + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.add(x1); + assertTrue(set.remove(x1)); + } + + @Test + void visitorSetRemoveAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.addAll(list); + set.removeAll(list); + assertEquals(0, set.size()); + } + + @Test + void visitorSetRetainAll() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.addAll(list); + set.add(parse("class X{}")); + set.retainAll(list); + assertEquals(2, set.size()); + } + + @Test + void visitorSetToArray() { + List list = new ArrayList<>(); + list.add(parse("class X{}")); + list.add(parse("class X{}")); + Set set = + new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.addAll(list); + for (CompilationUnit u : set.toArray(new CompilationUnit[2])) assertTrue(set.contains(u)); + } + + @Test + void visitSetWithEmpty() { + Set set = new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + assertEquals("[]", set.toString()); + } + + @Test + void visitSetWithOneElement() { + Set set = new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.addAll(parseMethodDeclaration("public void main() {}").findAll(Type.class)); + assertEquals("[void]", set.toString()); + } + + @Test + void visitSetWithMultiElements() { + Set set = new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor()); + set.addAll(parseMethodDeclaration("public void main(String arg1, Integer arg2) {}") + .findAll(Type.class)); + assertEquals("[void,Integer,String]", set.toString()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/version/Java10PostProcessorTest.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/version/Java10PostProcessorTest.java new file mode 100644 index 0000000..527dec4 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/java/com/github/javaparser/version/Java10PostProcessorTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2024 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +package com.github.javaparser.version; + +import static com.github.javaparser.ParseStart.STATEMENT; +import static com.github.javaparser.ParserConfiguration.LanguageLevel.JAVA_10; +import static com.github.javaparser.Providers.provider; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ParserConfiguration; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.VarType; +import java.util.List; +import org.junit.jupiter.api.Test; + +class Java10PostProcessorTest { + public static final JavaParser javaParser = new JavaParser(new ParserConfiguration().setLanguageLevel(JAVA_10)); + + @Test + void varIsAType() { + ParseResult result = javaParser.parse(STATEMENT, provider("var x=\"\";")); + + List allVarTypes = result.getResult().get().findAll(VarType.class); + + assertEquals(1, allVarTypes.size()); + } + + @Test + void expressionThatShouldNotBeInterpretedAsAVarType() { + ParseResult result = javaParser.parse(STATEMENT, provider("var.class.getName();")); + + List allVarTypes = result.getResult().get().findAll(VarType.class); + + assertEquals(0, allVarTypes.size()); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/EscapeSequences.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/EscapeSequences.java new file mode 100644 index 0000000..9752994 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/EscapeSequences.java @@ -0,0 +1,32 @@ +package com.github.javaparser; + +public class EscapeSequences { + + public static void main(String[] args) { + Object[] chars = { + '\\', '\u005C\u005C', '\u005c\u005c', + "---", + '\n', '\u005cn', '\u005Cn', + "---", + '\r', '\u005cr', '\u005Cr', + "---", + '\t', '\u005ct', '\u005Ct', + "---", + '\b', '\u005cb', '\u005Cb', + "---", + '\f', '\u005cf', '\u005Cf', + "---", + '\'', '\u005c'', // '\u005C'', // that's weird, this last one won't compile + "---", + '\"', '\u005c"', '\u005C"' + }; + for (Object obj : chars) { + if (obj instanceof Character) { + System.out.println(obj + " " + (int) (char) obj); // print the numeric representation + } else { + System.out.println(obj); + } + } + } + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/Sample.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/Sample.java new file mode 100644 index 0000000..c4b3450 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/Sample.java @@ -0,0 +1,17 @@ +package com.github.javaparser; + +import java.util.List; + +public class Sample { + + private String name; + + public Sample(String name) { + this.name = name; + } + + public List process() { + List result = new A + } + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/TestFileIso88591.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/TestFileIso88591.java new file mode 100644 index 0000000..1777f94 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/TestFileIso88591.java @@ -0,0 +1,7 @@ +package com.github.javaparser; + +public class TestFile { + + public String strïng = "Strange attribute name [check the i]"; + +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_generators_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_generators_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_generators_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_metamodel_generator_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_metamodel_generator_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_metamodel_generator_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_testing_src_test_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_testing_src_test_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_core_testing_src_test_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_metamodel_generator_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_metamodel_generator_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_metamodel_generator_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_core_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_core_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_core_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_logic_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_logic_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_logic_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_model_src_main_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_model_src_main_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_model_src_main_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_testing_src_test_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_testing_src_test_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_symbol_solver_testing_src_test_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_testing_src_test_java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_testing_src_test_java.txt new file mode 100644 index 0000000..8a9fcbe --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/javaparser_test_results_javaparser_testing_src_test_java.txt @@ -0,0 +1 @@ +0 problems in 0 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/openjdk_src_repo_test_results.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/openjdk_src_repo_test_results.txt new file mode 100644 index 0000000..b3d4e57 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/openjdk_src_repo_test_results.txt @@ -0,0 +1,655 @@ +langtools-19293ea3999f/test/jdk/javadoc/doclet/testAnchorNames/pkg1/RegClass.java +(line 68,col 16) '_' is a reserved keyword. + +langtools-19293ea3999f/test/jdk/javadoc/doclet/testSourceTab/DoubleTab/C.java +Lexical error at line 33, column 2. Encountered: "t" (116), after : "\\" + +langtools-19293ea3999f/test/jdk/javadoc/doclet/testSourceTab/SingleTab/C.java +Lexical error at line 33, column 2. Encountered: "t" (116), after : "\\" + +langtools-19293ea3999f/test/jdk/javadoc/doclet/testUnnamedPackage/BadSource.java +Parse error. Found "Just" , expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/jdk/javadoc/tool/6964914/Error.java +(line 25,col 12) Parse error. Found "}", expected "(" + +langtools-19293ea3999f/test/jdk/javadoc/tool/6964914/JavacWarning.java +(line 25,col 12) '_' is a reserved keyword. + +langtools-19293ea3999f/test/jdk/javadoc/tool/enum/docComments/pkg1/Operation.java +(line 33,col 1) 'abstract' is not allowed here. + +langtools-19293ea3999f/test/jdk/javadoc/tool/T4994049/FileWithTabs.java +Lexical error at line 25, column 2. Encountered: "t" (116), after : "\\" + +langtools-19293ea3999f/test/tools/javac/6302184/T6302184.java +Lexical error at line 28, column 9. Encountered: "\ufffd" (65533), after : "" + +langtools-19293ea3999f/test/tools/javac/6440583/A.java +(line 25,col 28) Parse error. Found "1" , expected "}" + +langtools-19293ea3999f/test/tools/javac/annotations/AnnotationTypeElementModifiers.java +(line 17,col 5) 'private' is not allowed here. +(line 18,col 5) 'private' is not allowed here. +(line 20,col 5) 'protected' is not allowed here. +(line 21,col 5) 'protected' is not allowed here. +(line 23,col 5) 'static' is not allowed here. +(line 24,col 5) 'static' is not allowed here. +(line 26,col 5) 'final' is not allowed here. +(line 27,col 5) 'final' is not allowed here. +(line 29,col 5) 'synchronized' is not allowed here. +(line 30,col 5) 'synchronized' is not allowed here. +(line 32,col 5) 'volatile' is not allowed here. +(line 33,col 5) 'volatile' is not allowed here. +(line 35,col 5) 'transient' is not allowed here. +(line 36,col 5) 'transient' is not allowed here. +(line 38,col 5) 'native' is not allowed here. +(line 39,col 5) 'native' is not allowed here. +(line 41,col 5) 'strictfp' is not allowed here. +(line 42,col 5) 'strictfp' is not allowed here. +(line 44,col 5) 'default' is not allowed here. +(line 45,col 5) 'default' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/annotations/FinalReceiverTest.java +(line 11,col 43) Parse error. Found ".", expected one of ")" "," "@" "[" +(line 14,col 2) Parse error. Found , expected "}" +(line 14,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/AnnComma.java +(line 12,col 35) Parse error. Found ")", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/NoDefault.java +(line 8,col 19) Parse error. Found "{", expected one of ";" "default" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/NoDefaultAbstract.java +(line 8,col 5) 'default' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/annotations/neg/NoStatic.java +(line 9,col 18) Parse error. Found "{", expected one of ";" "default" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/NoStaticAbstract.java +(line 9,col 5) 'static' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Syntax1.java +(line 17,col 21) Parse error. Found ",", expected one of "!=" "%" "&" "&&" "(" ")" "*" "+" "-" "/" "<" "<=" "==" ">" ">=" "?" "^" "instanceof" "|" "||" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z12.java +(line 10,col 15) Parse error. Found "void", expected one of ";" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "volatile" "with" "}" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z13.java +(line 11,col 11) Parse error. Found "throws", expected one of ";" "default" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z14.java +(line 10,col 12) Parse error. Found "<", expected "{" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z2.java +(line 13,col 17) Parse error. Found "default", expected one of ";" "@" "[" "throws" "{" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z3.java +(line 13,col 17) Parse error. Found "default", expected one of ";" "@" "[" "throws" "{" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z5.java +(line 12,col 12) Parse error. Found "extends", expected "{" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z8.java +(line 11,col 10) Parse error. Found "int", expected ")" + +langtools-19293ea3999f/test/tools/javac/annotations/neg/Z9.java +(line 10,col 15) Parse error. Found "<", expected one of ";" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "volatile" "with" "}" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/6967002/T6967002.java +(line 33,col 16) Parse error. Found "...", expected one of "!=" "%" "%=" "&" "&&" "&=" "(" ")" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.java +(line 12,col 15) Parse error. Found "@", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" +(line 13,col 8) Parse error. Found "@", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" +(line 17,col 8) Parse error. Found "@", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" +(line 18,col 8) Parse error. Found "@", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest.java +(line 12,col 14) Parse error. Found ".", expected one of "%=" "&=" "(" "*=" "++" "+=" "--" "-=" "/=" ";" "<<=" "=" ">>=" ">>>=" "^=" "|=" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java +(line 12,col 16) Parse error. Found "@", expected one of "!" "(" ")" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java +(line 11,col 11) Parse error. Found "@", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java +(line 12,col 11) Parse error. Found "@", expected one of "!=" "%" "%=" "&" "&&" "&=" "(" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java +(line 12,col 10) Parse error. Found "@", expected one of "]" + +langtools-19293ea3999f/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java +(line 13,col 10) Parse error. Found "@", expected one of "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" +(line 17,col 9) Parse error. Found "@", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" + +langtools-19293ea3999f/test/tools/javac/api/T6265137a.java +(line 24,col 1) Parse error. Found , expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/BadAnnotation.java +(line 11,col 21) Parse error. Found "int", expected ")" + +langtools-19293ea3999f/test/tools/javac/BadHexConstant.java +(line 12,col 14) Parse error. Found "xL" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/declaration/method/MethodVoidParameter.java +(line 7,col 16) Parse error. Found "void", expected one of ")" "@" "abstract" "boolean" "byte" "char" "default" "double" "enum" "exports" "final" "float" "int" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "volatile" "with" + +langtools-19293ea3999f/test/tools/javac/defaultMethods/private/Private02.java +(line 13,col 9) Cannot be 'abstract' and also 'private'. + +langtools-19293ea3999f/test/tools/javac/defaultMethods/private/Private07.java +(line 9,col 5) 'private' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/defaultMethods/private/Private08.java +(line 13,col 9) Can have only one of 'public', 'private'. +(line 14,col 9) Cannot be 'abstract' and also 'private'. + +langtools-19293ea3999f/test/tools/javac/defaultMethods/private/Private09.java +(line 9,col 17) Duplicated modifier + +langtools-19293ea3999f/test/tools/javac/defaultMethods/private/Private10.java +(line 11,col 9) Cannot be 'abstract' and also 'private'. +(line 14,col 9) Cannot be 'abstract' and also 'private'. + +langtools-19293ea3999f/test/tools/javac/DefiniteAssignment/ConstantInfiniteWhile.java +Lexical error at line 68, column 0. Encountered: after : "" + +langtools-19293ea3999f/test/tools/javac/diags/examples/AnnotationMustBeNameValue.java +(line 32,col 15) Parse error. Found ",", expected one of "!=" "%" "&" "&&" ")" "*" "+" "-" "/" "<" "<=" "==" ">" ">=" "?" "^" "instanceof" "|" "||" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ArrayAndReceiver.java +(line 27,col 29) Parse error. Found "[", expected one of ")" "," + +langtools-19293ea3999f/test/tools/javac/diags/examples/AssertAsIdentifier2.java +(line 27,col 5) Parse error. Found "assert", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/diags/examples/CallMustBeFirst.java +(line 28,col 18) Parse error. Found "super", expected "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/CantAssignToThis.java +(line 28,col 9) Illegal left hand side of an assignment. + +langtools-19293ea3999f/test/tools/javac/diags/examples/CantExtendIntfAnno.java +(line 28,col 12) Parse error. Found "extends", expected "{" + +langtools-19293ea3999f/test/tools/javac/diags/examples/CatchWithoutTry.java +(line 27,col 14) Parse error. Found "catch", expected "}" +(line 30,col 5) Parse error. Found "}", expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/DefaultAllowedInIntfAnnotationMember.java +(line 27,col 18) Parse error. Found "default", expected one of ";" "@" "[" "throws" "{" + +langtools-19293ea3999f/test/tools/javac/diags/examples/DotClassExpected.java +(line 27,col 11) Parse error. Found "int", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ElseWithoutIf.java +(line 27,col 14) Parse error. Found "else", expected "}" +(line 30,col 5) Parse error. Found "}", expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/EmptyCharLiteral.java +Lexical error at line 27, column 15. Encountered: "\'" (39), after : "\'" + +langtools-19293ea3999f/test/tools/javac/diags/examples/EnumAsIdentifier2.java +(line 27,col 9) 'enum' cannot be used as an identifier as it is a keyword. + +langtools-19293ea3999f/test/tools/javac/diags/examples/Expected2.java +(line 30,col 13) Parse error. Found ";", expected one of "(" "@" "[" + +langtools-19293ea3999f/test/tools/javac/diags/examples/Expected3.java +Parse error. Found "int", expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ExpectedModule.java +(line 26,col 1) Parse error. Found "class", expected "module" + +langtools-19293ea3999f/test/tools/javac/diags/examples/FinallyWithoutTry.java +(line 27,col 14) Parse error. Found "finally", expected "}" +(line 30,col 5) Parse error. Found "}", expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ForeachBadInitialization.java +(line 29,col 14) Parse error. Found ":", expected one of "!=" "%" "%=" "&" "&&" "&=" "(" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 31,col 2) Parse error. Found , expected "}" +(line 31,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IdentifierExpected.java +(line 30,col 1) Parse error. Found "{", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalAnnotationDeclaration.java +(line 27,col 5) Parse error. Found "@", expected "}" +(line 29,col 5) Parse error. Found "}", expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalChar.java +Lexical error at line 27, column 13. Encountered: "`" (96), after : "" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalComboModifiers.java +(line 27,col 5) Can have only one of 'public', 'private'. + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalDot.java +(line 27,col 12) Parse error. Found ".", expected one of "..." "@" "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalEscapeChar.java +Lexical error at line 27, column 18. Encountered: "!" (33), after : "\"\\" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalLineEndInCharLit.java +Lexical error at line 27, column 15. Encountered: "\n" (10), after : "\'" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalNonAsciiDigit.java +(line 27,col 13) Parse error. Found "\\u0660" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalStartOfExpr.java +(line 27,col 11) Parse error. Found "=", expected one of "!" "(" "+" "++" "-" "--" "@" "boolean" "byte" "char" "double" "enum" "exports" "false" "float" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "short" "strictfp" "super" "this" "to" "transitive" "true" "uses" "void" "with" "{" "~" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalStartOfStmt.java +(line 29,col 17) Parse error. Found "}", expected one of "(" "++" "--" ";" "@" "assert" "boolean" "break" "byte" "char" "continue" "do" "double" "enum" "exports" "false" "float" "for" "if" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "return" "short" "strictfp" "super" "switch" "synchronized" "this" "throw" "to" "transitive" "true" "try" "uses" "void" "while" "with" "{" +(line 31,col 2) Parse error. Found , expected one of "else" "}" +(line 31,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalStartOfType.java +(line 27,col 27) Parse error. Found ")", expected one of "boolean" "byte" "char" "double" "float" "int" "long" "short" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalUnderscore.java +(line 27,col 13) Parse error. Found "_" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IllegalUnicodeEscape.java +Lexical error at line 27, column 15. Encountered: ";" (59), after : "\\u" + +langtools-19293ea3999f/test/tools/javac/diags/examples/InitializerNotAllowed.java +(line 27,col 5) An interface cannot have initializers. + +langtools-19293ea3999f/test/tools/javac/diags/examples/InterfaceNotAllowed.java +(line 28,col 9) There is no such thing as a local interface. + +langtools-19293ea3999f/test/tools/javac/diags/examples/IntfAnnotationCantHaveTypeParams.java +(line 26,col 12) Parse error. Found "<", expected "{" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IntfAnnotationsCantHaveParams.java +(line 27,col 17) Parse error. Found "int", expected ")" + +langtools-19293ea3999f/test/tools/javac/diags/examples/IntfAnnotationsCantHaveTypeParams.java +(line 26,col 14) Parse error. Found "<", expected one of ";" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "volatile" "with" "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/InvalidBinaryNumber.java +(line 27,col 13) Parse error. Found "b201000010" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/diags/examples/InvalidHexNumber.java +(line 28,col 13) Parse error. Found "xz1357abc" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/diags/examples/InvalidModuleDirective/module-info.java +(line 27,col 21) Parse error. Found "resuires" , expected one of "exports" "opens" "provides" "requires" "uses" "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/LocalEnum.java +(line 28,col 14) Parse error. Found "{", expected one of "," ";" "=" "@" "[" + +langtools-19293ea3999f/test/tools/javac/diags/examples/MalformedFpLit.java +(line 28,col 15) Parse error. Found "e" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ModifierNotAllowed.java +(line 26,col 1) 'synchronized' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/diags/examples/NoAnnotationsOnDotClass.java +(line 30,col 14) Parse error. Found "@", expected one of "!" "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" + +langtools-19293ea3999f/test/tools/javac/diags/examples/NotAllowedClass.java +(line 28,col 17) Parse error. Found "class", expected one of "(" "++" "--" ";" "@" "assert" "boolean" "break" "byte" "char" "continue" "do" "double" "enum" "exports" "false" "float" "for" "if" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "return" "short" "strictfp" "super" "switch" "synchronized" "this" "throw" "to" "transitive" "true" "try" "uses" "void" "while" "with" "{" +(line 31,col 2) Parse error. Found , expected one of "else" "}" +(line 31,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/NotAllowedVariable.java +(line 28,col 17) Parse error. Found "int", expected one of "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/diags/examples/NotAStatement.java +(line 27,col 14) Parse error. Found "x" , expected "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/Orphaned.java +(line 27,col 14) Parse error. Found "case", expected "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/PrematureEOF.java +(line 26,col 20) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ProcessorWrongType/ProcessorWrongType.java +Parse error. Found "clas" , expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/RepeatedModifier.java +(line 27,col 12) Duplicated modifier + +langtools-19293ea3999f/test/tools/javac/diags/examples/ThisAsIdentifier.java +(line 27,col 5) Parse error. Found "this", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/diags/examples/ThrowsNotAllowedInAnno.java +(line 27,col 18) Parse error. Found "throws", expected one of ";" "default" + +langtools-19293ea3999f/test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java +(line 29,col 9) Try has no finally, no catch, and no resources. + +langtools-19293ea3999f/test/tools/javac/diags/examples/TryWithoutCatchOrFinallyOrResource.java +(line 28,col 9) Try has no finally, no catch, and no resources. + +langtools-19293ea3999f/test/tools/javac/diags/examples/TypeReqClassArray.java +(line 30,col 34) Parse error. Found ")", expected "[" + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnclosedCharLiteral.java +Lexical error at line 27, column 16. Encountered: ";" (59), after : "\'a" + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnclosedComment.java +Lexical error at line 31, column 0. Encountered: after : "" + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnclosedStringLiteral.java +Lexical error at line 27, column 21. Encountered: "\n" (10), after : "\"abc;" + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnderscoreAsIdentifierError.java +(line 27,col 12) '_' is a reserved keyword. + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnderscoreAsIdentifierWarning.java +(line 28,col 12) '_' is a reserved keyword. + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnderscoreInLambdaExpression.java +(line 26,col 52) '_' is a reserved keyword. + +langtools-19293ea3999f/test/tools/javac/diags/examples/UnexpectedTokenInModuleInfo/module-info.java +Parse error. Found "weak" , expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/diags/examples/VarargsAndReceiver.java +(line 27,col 30) Parse error. Found "this", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/Digits.java +(line 11,col 40) Parse error. Found "\\u0663" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/enum/EnumAsIdentifier.java +(line 11,col 9) 'enum' cannot be used as an identifier as it is a keyword. + +langtools-19293ea3999f/test/tools/javac/enum/EnumMembersOrder.java +(line 11,col 10) Parse error. Found "d" , expected one of "!=" "%" "%=" "&" "&&" "&=" "(" ")" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/enum/ExplicitlyAbstractEnum1.java +(line 9,col 1) 'abstract' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/enum/ExplicitlyAbstractEnum2.java +(line 9,col 1) 'abstract' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/enum/ExplicitlyFinalEnum1.java +(line 9,col 1) 'final' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/enum/ExplicitlyFinalEnum2.java +(line 9,col 1) 'final' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/enum/LocalEnum.java +(line 11,col 14) Parse error. Found "{", expected one of "," ";" "=" "@" "[" +(line 13,col 2) Parse error. Found , expected "}" +(line 13,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/EOI.java +(line 10,col 16) Parse error. Found "foobar\u001a" , expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/ExtendArray.java +(line 11,col 34) Parse error. Found "[", expected one of "," "implements" "{" + +langtools-19293ea3999f/test/tools/javac/ExtraneousEquals.java +(line 10,col 22) Parse error. Found "=", expected one of "!" "(" "+" "++" "-" "--" "@" "]" "boolean" "byte" "char" "double" "enum" "exports" "false" "float" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "short" "strictfp" "super" "this" "to" "transitive" "true" "uses" "void" "with" "~" + +langtools-19293ea3999f/test/tools/javac/failover/FailOver01.java +(line 10,col 20) Parse error. Found "}", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 10,col 26) Parse error. Found , expected "}" +(line 10,col 26) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/failover/FailOver15.java +(line 17,col 9) Parse error. Found "}", expected one of "%=" "&=" "*=" "++" "+=" "--" "-=" "/=" ";" "<<=" "=" ">>=" ">>>=" "^=" "|=" +(line 19,col 2) Parse error. Found , expected "}" +(line 19,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/FloatingPointChanges/BadConstructorModifiers.java +(line 12,col 5) 'strictfp' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/generics/typevars/5060485/Compatibility02.java +(line 36,col 9) 'static' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/generics/typevars/6680106/T6680106.java +(line 11,col 24) Parse error. Found "[", expected one of "&" "," ">" + +langtools-19293ea3999f/test/tools/javac/IllegalAnnotation.java +(line 9,col 5) Parse error. Found "@", expected "}" +(line 11,col 5) Parse error. Found "}", expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/incompleteStatements/T8000484.java +(line 9,col 14) Parse error. Found "catch", expected "}" +(line 10,col 29) Parse error. Found "else", expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/LabeledDeclaration.java +(line 12,col 8) Parse error. Found "int", expected one of "(" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/lambda/8131742/T8131742.java +(line 8,col 32) Parse error. Found ".", expected one of ")" "," "@" "[" + +langtools-19293ea3999f/test/tools/javac/lambda/BadLambdaPos.java +(line 18,col 26) Parse error. Found "+", expected one of ")" "," +(line 19,col 26) Parse error. Found "instanceof", expected one of ")" "," +(line 23,col 30) Parse error. Found "+", expected one of "," ";" +(line 24,col 33) Parse error. Found "instanceof", expected one of "," ";" + +langtools-19293ea3999f/test/tools/javac/lambda/BadStatementInLambda.java +(line 18,col 19) Parse error. Found "1" , expected "}" + +langtools-19293ea3999f/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg1.java +(line 13,col 64) Parse error. Found "}", expected one of "," ";" +(line 15,col 2) Parse error. Found , expected "}" +(line 15,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/lambda/IdentifierTest.java +(line 41,col 11) '_' is a reserved keyword. +(line 44,col 16) '_' is a reserved keyword. +(line 45,col 20) '_' is a reserved keyword. +(line 46,col 22) '_' is a reserved keyword. +(line 51,col 13) '_' is a reserved keyword. +(line 51,col 15) '_' is a reserved keyword. +(line 51,col 23) '_' is a reserved keyword. +(line 53,col 13) '_' is a reserved keyword. +(line 55,col 13) '_' is a reserved keyword. +(line 61,col 21) '_' is a reserved keyword. +(line 62,col 42) '_' is a reserved keyword. +(line 63,col 67) '_' is a reserved keyword. +(line 70,col 13) '_' is a reserved keyword. +(line 71,col 14) '_' is a reserved keyword. +(line 72,col 18) '_' is a reserved keyword. +(line 77,col 22) '_' is a reserved keyword. +(line 79,col 13) '_' is a reserved keyword. +(line 79,col 15) '_' is a reserved keyword. +(line 81,col 13) '_' is a reserved keyword. +(line 81,col 15) '_' is a reserved keyword. +(line 88,col 10) '_' is a reserved keyword. +(line 88,col 38) '_' is a reserved keyword. +(line 94,col 14) '_' is a reserved keyword. +(line 101,col 17) '_' is a reserved keyword. +(line 101,col 26) '_' is a reserved keyword. +(line 118,col 20) '_' is a reserved keyword. +(line 123,col 10) '_' is a reserved keyword. +(line 128,col 17) '_' is a reserved keyword. +(line 131,col 17) '_' is a reserved keyword. +(line 138,col 17) '_' is a reserved keyword. +(line 138,col 24) '_' is a reserved keyword. +(line 138,col 33) '_' is a reserved keyword. +(line 139,col 39) '_' is a reserved keyword. +(line 143,col 13) '_' is a reserved keyword. +(line 144,col 15) '_' is a reserved keyword. +(line 145,col 13) '_' is a reserved keyword. +(line 150,col 15) '_' is a reserved keyword. +(line 151,col 17) '_' is a reserved keyword. +(line 157,col 16) '_' is a reserved keyword. +(line 159,col 25) '_' is a reserved keyword. +(line 168,col 5) '_' is a reserved keyword. +(line 172,col 26) '_' is a reserved keyword. +(line 174,col 19) '_' is a reserved keyword. +(line 180,col 11) '_' is a reserved keyword. + +langtools-19293ea3999f/test/tools/javac/lambda/lambdaExpression/InvalidExpression1.java +(line 15,col 66) Parse error. Found "}", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 16,col 5) Parse error. Found "}", expected one of "," ";" +(line 17,col 2) Parse error. Found , expected "}" +(line 17,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/lambda/UnderscoreAsIdent.java +(line 30,col 9) '_' is a reserved keyword. +(line 30,col 9) '_' is a reserved keyword. +(line 32,col 8) '_' is a reserved keyword. +(line 32,col 8) '_' is a reserved keyword. +(line 34,col 7) '_' is a reserved keyword. +(line 35,col 12) '_' is a reserved keyword. +(line 36,col 10) '_' is a reserved keyword. +(line 36,col 19) '_' is a reserved keyword. +(line 38,col 16) '_' is a reserved keyword. +(line 41,col 18) '_' is a reserved keyword. +(line 41,col 25) '_' is a reserved keyword. +(line 41,col 33) '_' is a reserved keyword. +(line 44,col 34) '_' is a reserved keyword. +(line 47,col 9) '_' is a reserved keyword. +(line 49,col 19) '_' is a reserved keyword. +(line 51,col 9) '_' is a reserved keyword. +(line 53,col 22) '_' is a reserved keyword. + +langtools-19293ea3999f/test/tools/javac/lambda/VoidLambdaParameter.java +(line 7,col 18) Parse error. Found "void", expected one of "!" "(" ")" "enum" "exports" "false" "module" "new" "null" "open" "opens" "provides" "requires" "strictfp" "super" "this" "to" "transitive" "true" "uses" "with" "~" + +langtools-19293ea3999f/test/tools/javac/literals/BadBinaryLiterals.java +(line 11,col 20) Parse error. Found "2" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/literals/BadUnderscoreLiterals.java +(line 15,col 14) Parse error. Found "_" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/literals/T6891079.java +(line 8,col 14) Parse error. Found "B" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/modules/InvalidModuleDirective/module-info.java +(line 9,col 21) Parse error. Found "resuires" , expected one of "exports" "opens" "provides" "requires" "uses" "}" + +langtools-19293ea3999f/test/tools/javac/overrridecrash/A.java +(line 25,col 5) Can have only one of 'protected', 'private'. + +langtools-19293ea3999f/test/tools/javac/overrridecrash/B.java +(line 12,col 5) Can have only one of 'protected', 'private'. + +langtools-19293ea3999f/test/tools/javac/Parens3.java +(line 12,col 9) Parse error. Found ":", expected one of "%=" "&=" "*=" "++" "+=" "--" "-=" "/=" ";" "<<=" "=" ">>=" ">>>=" "^=" "|=" + +langtools-19293ea3999f/test/tools/javac/ParseConditional.java +(line 23,col 13) Illegal left hand side of an assignment. + +langtools-19293ea3999f/test/tools/javac/parser/7157165/T7157165.java +(line 11,col 19) Parse error. Found "|", expected one of "," ">" + +langtools-19293ea3999f/test/tools/javac/parser/8081769/T8081769.java +(line 9,col 20) Parse error. Found ".", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 10,col 20) Parse error. Found ".", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 11,col 20) Parse error. Found ".", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 12,col 20) Parse error. Found ".", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 14,col 31) Parse error. Found ".", expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/parser/ErroneousParameters.java +(line 11,col 34) Parse error. Found "...", expected one of ")" "," "@" "[" + +langtools-19293ea3999f/test/tools/javac/parser/MissingClosingBrace.java +(line 13,col 1) Parse error. Found , expected one of "else" "}" +(line 13,col 2) Parse error. Found , expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/parser/SingleCommaAnnotationValueFail.java +(line 34,col 11) Parse error. Found "0" , expected "}" + +langtools-19293ea3999f/test/tools/javac/parser/T4881269.java +(line 32,col 10) Parse error. Found ".", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/policy/test3/A.java +(line 5,col 36) Parse error. Found "0" , expected "}" + +langtools-19293ea3999f/test/tools/javac/processing/6994946/SyntaxErrorTest.java +(line 14,col 9) Parse error. Found "}", expected "(" + +langtools-19293ea3999f/test/tools/javac/processing/errors/TestParseErrors/ParseErrors.java +(line 37,col 36) Parse error. Found ",", expected one of "..." "@" "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javac/quid/T6999438.java +Lexical error at line 8, column 9. Encountered: "#" (35), after : "" + +langtools-19293ea3999f/test/tools/javac/rawDiags/Error.java +(line 9,col 17) Parse error. Found , expected "(" + +langtools-19293ea3999f/test/tools/javac/StoreClass.java +(line 12,col 9) Illegal left hand side of an assignment. +(line 13,col 9) Illegal left hand side of an assignment. + +langtools-19293ea3999f/test/tools/javac/SynchronizedClass.java +(line 9,col 1) 'synchronized' is not allowed here. + +langtools-19293ea3999f/test/tools/javac/T4994049/T4994049.java +(line 11,col 5) Parse error. Found "BAR" , expected one of "," ";" "}" + +langtools-19293ea3999f/test/tools/javac/T6882235.java +(line 10,col 11) Parse error. Found ";", expected one of "!" "(" "+" "++" "-" "--" "@" "boolean" "byte" "char" "double" "enum" "exports" "false" "float" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "short" "strictfp" "super" "this" "to" "transitive" "true" "uses" "void" "with" "{" "~" + +langtools-19293ea3999f/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java +(line 9,col 19) Parse error. Found "this", expected one of ")" "@" "abstract" "boolean" "byte" "char" "default" "double" "enum" "exports" "final" "float" "int" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "volatile" "with" + +langtools-19293ea3999f/test/tools/javac/T8171325/NPEClearingLocalClassNameIndexesTest.java +(line 19,col 42) Type arguments may not be primitive. + +langtools-19293ea3999f/test/tools/javac/T8175198/AnnotationsAndFormalParamsTest.java +(line 9,col 14) Parse error. Found "int", expected ")" + +langtools-19293ea3999f/test/tools/javac/T8181464/LambdaInAnnotationsCausesNPETest1.java +(line 10,col 15) Parse error. Found "->", expected one of "!=" "%" "&" "&&" "(" ")" "*" "+" "," "-" "/" "<" "<=" "==" ">" ">=" "?" "^" "instanceof" "|" "||" + +langtools-19293ea3999f/test/tools/javac/T8181464/LambdaInAnnotationsCausesNPETest2.java +(line 10,col 24) Parse error. Found "->", expected one of "!=" "%" "&" "&&" ")" "*" "+" "," "-" "/" "<" "<=" "==" ">" ">=" "?" "^" "instanceof" "|" "||" + +langtools-19293ea3999f/test/tools/javac/TryWithResources/BadTwrSyntax.java +(line 14,col 42) Parse error. Found ";", expected ")" +(line 14,col 43) Parse error. Found ")", expected "}" +(line 16,col 9) Parse error. Found "try", expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/TryWithResources/PlainTry.java +(line 11,col 9) Try has no finally, no catch, and no resources. + +langtools-19293ea3999f/test/tools/javac/TryWithResources/ResDeclOutsideTry.java +(line 14,col 14) Parse error. Found "=", expected one of "(" ")" +(line 14,col 48) Parse error. Found ")", expected "}" +(line 15,col 9) Parse error. Found "return", expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/TryWithResources/TwrForVariable2.java +(line 13,col 13) Parse error. Found "final", expected one of "(" "@" "boolean" "byte" "char" "double" "enum" "exports" "false" "float" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "short" "strictfp" "super" "this" "to" "transitive" "true" "uses" "void" "with" +(line 15,col 9) Parse error. Found "try", expected one of ";" "<" "@" "abstract" "boolean" "byte" "char" "class" "default" "double" "enum" "exports" "final" "float" "int" "interface" "long" "module" "native" "open" "opens" "private" "protected" "provides" "public" "requires" "short" "static" "strictfp" "synchronized" "to" "transient" "transitive" "uses" "void" "volatile" "with" "{" "}" + +langtools-19293ea3999f/test/tools/javac/unicode/FirstChar2.java +Parse error. Found "\\u0070ublic" , expected one of ";" "@" "\u001a" "abstract" "class" "default" "enum" "final" "import" "interface" "module" "native" "open" "private" "protected" "public" "static" "strictfp" "synchronized" "transient" "transitive" "volatile" + +langtools-19293ea3999f/test/tools/javac/unicode/NonasciiDigit.java +(line 13,col 18) Parse error. Found "\\uff11" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 16,col 21) Parse error. Found ".0" , expected one of "!=" "%" "%=" "&" "&&" "&=" "(" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 17,col 21) Parse error. Found "\\uff11" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 18,col 21) Parse error. Found "P\\uff11" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 19,col 21) Parse error. Found "E\\uff11" , expected one of "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" +(line 20,col 19) Parse error. Found ".", expected one of "!" "(" "+" "++" "-" "--" "@" "boolean" "byte" "char" "double" "enum" "exports" "false" "float" "int" "long" "module" "new" "null" "open" "opens" "provides" "requires" "short" "strictfp" "super" "this" "to" "transitive" "true" "uses" "void" "with" "{" "~" +(line 21,col 21) Parse error. Found ".0" , expected one of "!=" "%" "%=" "&" "&&" "&=" "(" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||" + +langtools-19293ea3999f/test/tools/javac/unicode/TripleQuote.java +Lexical error at line 13, column 15. Encountered: "\'" (39), after : "\'" + +langtools-19293ea3999f/test/tools/javac/unicode/UnicodeAtEOL.java +(line 33,col 13) Parse error. Found "\\u000D" , expected "}" + +langtools-19293ea3999f/test/tools/javac/unicode/UnicodeCommentDelimiter.java +(line 44,col 22) Parse error. Found "plugh" , expected one of "," ";" "=" "@" "[" + +langtools-19293ea3999f/test/tools/javac/VoidArray.java +(line 12,col 5) Parse error. Found "[", expected one of "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" + +langtools-19293ea3999f/test/tools/javadoc/6964914/Error.java +(line 25,col 12) Parse error. Found "}", expected "(" + +langtools-19293ea3999f/test/tools/javadoc/6964914/JavacWarning.java +(line 25,col 12) '_' is a reserved keyword. + +langtools-19293ea3999f/test/tools/javadoc/enum/docComments/pkg1/Operation.java +(line 33,col 1) 'abstract' is not allowed here. + +langtools-19293ea3999f/test/tools/javadoc/T4994049/FileWithTabs.java +Lexical error at line 25, column 2. Encountered: "t" (116), after : "\\" + +304 problems in 175 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/openjdk_src_zip_test_results.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/openjdk_src_zip_test_results.txt new file mode 100644 index 0000000..8e95fac --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/bulk_test_results/openjdk_src_zip_test_results.txt @@ -0,0 +1,4 @@ +com/sun/xml/internal/rngom/parse/compact/CompactSyntax.java +Lexical error at line 244, column 38. Encountered: "n" (110), after : "\'\\u005c" + +1 problems in 1 files \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue290.java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue290.java.txt new file mode 100644 index 0000000..2b39ff8 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue290.java.txt @@ -0,0 +1,34 @@ +package org.test; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; + +import java.io.File; +import java.io.FileInputStream; + +public class TestComments { + String str = "\\"; + + /** + * Comment that is ignored + */ + public void someTestMethod() {} + + public static void main(String[] args) throws Exception { + // Correct path so that it will point to the file with this code + try (FileInputStream in = new FileInputStream( + new File(".\\src\\main\\java\\org\\test\\TestComments.java"))) { + CompilationUnit compilationUnit = JavaParser.parse(in); + + new VoidVisitorAdapter() { + public void visit(MethodDeclaration method, Object arg) { + System.out.println("Method: " + method.getName()); + System.out.println("Comment: " + method.getComment()); + System.out.println("JavaDoc: " + method.getJavaDoc() + "\n"); + } + }.visit(compilationUnit, null); + } + } +} \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue412.java.expected.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue412.java.expected.txt new file mode 100644 index 0000000..9bc4779 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue412.java.expected.txt @@ -0,0 +1,35 @@ +/* 1 +1 */ +/* +2 +2 + */ +package /* a */ +/* b */ +//c +//d +com.pany/*alma*/ +/*körte*/ +//lófasz +//jóska +.experiment; + +//z +//x +/*y*/ +/*w*/ +/*aa*/ +/*bb*/ +//cc +//dd +import com.github.javaparser.JavaParser; + +public class Main { + + public static void main(String[] args) throws FileNotFoundException, IOException, ParseException { + // try (FileInputStream fisTargetFile = new FileInputStream(new File(FILENAME))) { + // final String content = IOUtils.toString(fisTargetFile, "UTF-8"); + // System.out.println(content); + // } + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue412.java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue412.java.txt new file mode 100644 index 0000000..3a06006 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue412.java.txt @@ -0,0 +1,33 @@ +/* 1 +1 *//* +2 +2 + */ +package +/* a *//* b */ +//c +//d +com +/*alma*//*körte*/ +//lófasz +//jóska + . +pany +. +experiment +//z +//x +/*y*//*w*/ +; +/*aa*//*bb*///cc +//dd +import com.github.javaparser.JavaParser; + +public class Main { + public static void main(String[] args) throws FileNotFoundException, IOException, ParseException { +// try (FileInputStream fisTargetFile = new FileInputStream(new File(FILENAME))) { +// final String content = IOUtils.toString(fisTargetFile, "UTF-8"); +// System.out.println(content); +// } + } +} \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue624.java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue624.java.txt new file mode 100644 index 0000000..de86d11 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/Issue624.java.txt @@ -0,0 +1,14 @@ +package z; +public class A { + + @Override + protected void getDataForCalcul() { + + a.b(c)// + .success(data -> { + // DATA STD MACHINE + dosomething(); + })// + .error(defaultErrorConsumer); + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue1003.java.txt b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue1003.java.txt new file mode 100644 index 0000000..0f8f460 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue1003.java.txt @@ -0,0 +1,1470 @@ +package com.trigtech.privateme.server.am; + +import android.app.ActivityManager; +import android.app.ActivityManager.RecentTaskInfo; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.os.Handler; +import android.os.IBinder; +import android.util.SparseArray; +import com.trigtech.privateme.client.AppInterface; +import com.trigtech.privateme.client.g; +import com.trigtech.privateme.helper.proto.AppSetting; +import com.trigtech.privateme.helper.proto.AppTaskInfo; +import com.trigtech.privateme.helper.proto.i; +import com.trigtech.privateme.helper.utils.k; +import com.trigtech.privateme.helper.utils.v; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Set; + +class ActivityStack +{ + private static final String b = ActivityStack.class.getSimpleName(); + final SparseArray

a = new SparseArray(); + private final ActivityManager c; + private final TActivityManagerService d; + private com.trigtech.privateme.helper.utils.a e = new com.trigtech.privateme.helper.utils.a(); + private com.trigtech.privateme.helper.utils.a f = new com.trigtech.privateme.helper.utils.a(); + private com.trigtech.privateme.helper.utils.a> g = new com.trigtech.privateme.helper.utils.a(); + private com.trigtech.privateme.helper.utils.a> h = new com.trigtech.privateme.helper.utils.a(); + + ActivityStack(TActivityManagerService paramTActivityManagerService) + { + this.d = paramTActivityManagerService; + this.c = ((ActivityManager)AppInterface.e().i().getSystemService("activity")); + } + + private Intent a(int paramInt, c paramc, Intent paramIntent, ActivityInfo paramActivityInfo) + { + Intent localIntent1 = new Intent(paramIntent); + j localj = this.d.startProcessIfNeedLocked(paramActivityInfo.processName, paramInt, paramActivityInfo.packageName); + if (localj == null) + return null; + Intent localIntent2 = new Intent(); + localIntent2.setClassName(AppInterface.e().k(), a(localj.i, paramActivityInfo)); + ComponentName localComponentName1 = localIntent1.getComponent(); + if (localComponentName1 == null) + localComponentName1 = k.a(paramActivityInfo); + localIntent2.setType(localComponentName1.flattenToString()); + if (((0x80 & paramActivityInfo.flags) != 0) || (b(localIntent1, 1073741824))) + localIntent2.addFlags(1073741824); + if (paramc != null); + for (ComponentName localComponentName2 = paramc.b; ; localComponentName2 = null) + { + i locali = new i(localIntent1, paramActivityInfo, localComponentName2, paramInt); + localIntent2.putExtra("_PM_|_intent_", locali.a); + localIntent2.putExtra("_PM_|_info_", locali.b); + localIntent2.putExtra("_PM_|_caller_", locali.c); + localIntent2.putExtra("_PM_|_user_id_", locali.d); + return localIntent2; + } + } + + private static c a(p paramp) + { + while (true) + { + int i; + synchronized (paramp.e) + { + i = -1 + paramp.e.size(); + if (i >= 0) + { + c localc = (c)paramp.e.get(i); + if (!localc.i) + return localc; + } + else + { + return null; + } + } + i--; + } + } + + private p a(int paramInt, Intent paramIntent) + { + for (int i = 0; i < this.a.size(); i++) + { + p localp = (p)this.a.valueAt(i); + if ((paramInt == localp.b) && (localp.d != null) && (paramIntent.getComponent().equals(localp.d.getComponent()))) + return localp; + } + return null; + } + + // ERROR // + private static String a(int paramInt, ActivityInfo paramActivityInfo) + { + // Byte code: + // 0: getstatic 214 tbox/com/android/internal/R_Hide$styleable:Window Ltbox/RefStaticObject; + // 3: invokevirtual 219 tbox/RefStaticObject:get ()Ljava/lang/Object; + // 6: checkcast 221 [I + // 9: astore 9 + // 11: getstatic 225 tbox/com/android/internal/R_Hide$styleable:Window_windowIsTranslucent Ltbox/RefStaticInt; + // 14: invokevirtual 229 tbox/RefStaticInt:get ()I + // 17: istore 10 + // 19: getstatic 232 tbox/com/android/internal/R_Hide$styleable:Window_windowIsFloating Ltbox/RefStaticInt; + // 22: invokevirtual 229 tbox/RefStaticInt:get ()I + // 25: istore 11 + // 27: getstatic 235 tbox/com/android/internal/R_Hide$styleable:Window_windowShowWallpaper Ltbox/RefStaticInt; + // 30: invokevirtual 229 tbox/RefStaticInt:get ()I + // 33: istore 12 + // 35: invokestatic 240 com/trigtech/privateme/server/am/h:a ()Lcom/trigtech/privateme/server/am/h; + // 38: aload_1 + // 39: getfield 88 android/content/pm/ActivityInfo:packageName Ljava/lang/String; + // 42: aload_1 + // 43: getfield 243 android/content/pm/ActivityInfo:theme I + // 46: aload 9 + // 48: invokevirtual 246 com/trigtech/privateme/server/am/h:a (Ljava/lang/String;I[I)Lcom/trigtech/privateme/server/am/h$a; + // 51: astore 13 + // 53: aload 13 + // 55: ifnull +154 -> 209 + // 58: aload 13 + // 60: getfield 251 com/trigtech/privateme/server/am/h$a:b Landroid/content/res/TypedArray; + // 63: ifnull +146 -> 209 + // 66: aload 13 + // 68: getfield 251 com/trigtech/privateme/server/am/h$a:b Landroid/content/res/TypedArray; + // 71: iload 12 + // 73: iconst_0 + // 74: invokevirtual 257 android/content/res/TypedArray:getBoolean (IZ)Z + // 77: istore 14 + // 79: iload 14 + // 81: istore 5 + // 83: aload 13 + // 85: getfield 251 com/trigtech/privateme/server/am/h$a:b Landroid/content/res/TypedArray; + // 88: iload 10 + // 90: iconst_0 + // 91: invokevirtual 257 android/content/res/TypedArray:getBoolean (IZ)Z + // 94: istore 17 + // 96: iload 17 + // 98: istore 6 + // 100: aload 13 + // 102: getfield 251 com/trigtech/privateme/server/am/h$a:b Landroid/content/res/TypedArray; + // 105: iload 11 + // 107: iconst_0 + // 108: invokevirtual 257 android/content/res/TypedArray:getBoolean (IZ)Z + // 111: istore 19 + // 113: iload 19 + // 115: istore 7 + // 117: iload 7 + // 119: ifne +16 -> 135 + // 122: iload 6 + // 124: ifne +11 -> 135 + // 127: iconst_0 + // 128: istore 8 + // 130: iload 5 + // 132: ifeq +6 -> 138 + // 135: iconst_1 + // 136: istore 8 + // 138: iload 8 + // 140: ifeq +31 -> 171 + // 143: iload_0 + // 144: invokestatic 262 com/trigtech/privateme/client/stub/a:b (I)Ljava/lang/String; + // 147: areturn + // 148: astore_2 + // 149: iconst_0 + // 150: istore_3 + // 151: iconst_0 + // 152: istore 4 + // 154: aload_2 + // 155: invokevirtual 265 java/lang/Throwable:printStackTrace ()V + // 158: iload_3 + // 159: istore 5 + // 161: iload 4 + // 163: istore 6 + // 165: iconst_0 + // 166: istore 7 + // 168: goto -51 -> 117 + // 171: iload_0 + // 172: invokestatic 267 com/trigtech/privateme/client/stub/a:a (I)Ljava/lang/String; + // 175: areturn + // 176: astore 15 + // 178: iload 5 + // 180: istore 16 + // 182: aload 15 + // 184: astore_2 + // 185: iload 16 + // 187: istore_3 + // 188: iconst_0 + // 189: istore 4 + // 191: goto -37 -> 154 + // 194: astore 18 + // 196: iload 6 + // 198: istore 4 + // 200: iload 5 + // 202: istore_3 + // 203: aload 18 + // 205: astore_2 + // 206: goto -52 -> 154 + // 209: iconst_0 + // 210: istore 5 + // 212: iconst_0 + // 213: istore 6 + // 215: iconst_0 + // 216: istore 7 + // 218: goto -101 -> 117 + // + // Exception table: + // from to target type + // 0 53 148 java/lang/Throwable + // 58 79 148 java/lang/Throwable + // 83 96 176 java/lang/Throwable + // 100 113 194 java/lang/Throwable + } + + private void a() + { + ArrayList localArrayList = new ArrayList(this.c.getRecentTasks(2147483647, 3)); + int i = this.a.size(); + int j = i - 1; + p localp; + int k; + if (i > 0) + { + localp = (p)this.a.valueAt(j); + ListIterator localListIterator = localArrayList.listIterator(); + while (localListIterator.hasNext()) + if (((ActivityManager.RecentTaskInfo)localListIterator.next()).id == localp.a) + { + k = 1; + localListIterator.remove(); + } + } + while (true) + { + if (k == 0) + { + this.a.removeAt(j); + b(localp); + } + i = j; + break; + return; + k = 0; + } + } + + private static void a(Intent paramIntent, int paramInt) + { + paramIntent.setFlags(paramIntent.getFlags() & (paramInt ^ 0xFFFFFFFF)); + } + + private static boolean a(p paramp, ClearTarget paramClearTarget, ComponentName paramComponentName) + { + boolean bool1 = false; + boolean bool3; + switch (e.a[paramClearTarget.ordinal()]) + { + default: + return false; + case 1: + synchronized (paramp.e) + { + Iterator localIterator2 = paramp.e.iterator(); + while (localIterator2.hasNext()) + { + ((c)localIterator2.next()).i = true; + bool1 = true; + } + return bool1; + } + case 2: + synchronized (paramp.e) + { + Iterator localIterator1 = paramp.e.iterator(); + if (localIterator1.hasNext()) + { + c localc = (c)localIterator1.next(); + if (localc.b.equals(paramComponentName)) + { + localc.i = true; + bool3 = true; + break label307; + } + } + else + { + return bool1; + } + } + case 3: + } + while (true) + { + int i; + int j; + boolean bool2; + int k; + synchronized (paramp.e) + { + i = paramp.e.size(); + j = i - 1; + bool2 = false; + if (i <= 0) + break label313; + if (!((c)paramp.e.get(j)).b.equals(paramComponentName)) + break label325; + bool2 = true; + break label313; + int m = k + 1; + if (k < -1 + paramp.e.size()) + { + ((c)paramp.e.get(m)).i = true; + k = m; + continue; + } + return bool2; + } + bool3 = bool1; + label307: bool1 = bool3; + break; + label313: if (bool2) + { + k = j; + continue; + label325: i = j; + } + } + } + + private p b(int paramInt, String paramString) + { + for (int i = 0; i < this.a.size(); i++) + { + p localp = (p)this.a.valueAt(i); + if ((paramInt == localp.b) && (paramString.equals(localp.c))) + return localp; + } + return null; + } + + private void b() + { + int j; + for (int i = this.a.size(); ; i = j) + { + j = i - 1; + if (i <= 0) + break; + Iterator localIterator = ((p)this.a.valueAt(j)).e.iterator(); + while (localIterator.hasNext()) + { + c localc = (c)localIterator.next(); + if (localc.i) + g.a().post(new d(this, localc)); + } + } + } + + private void b(p paramp) + { + Iterator localIterator1 = this.h.keySet().iterator(); + while (localIterator1.hasNext()) + { + Integer localInteger2 = (Integer)localIterator1.next(); + List localList2 = (List)this.h.get(localInteger2); + Iterator localIterator4 = paramp.e.iterator(); + while (localIterator4.hasNext()) + { + c localc2 = (c)localIterator4.next(); + if (localList2.contains(localc2)) + { + v.a(b, "optimizeActivities started, activity: %s", new Object[] { localc2 }); + localList2.remove(localc2); + } + } + } + Iterator localIterator2 = this.g.keySet().iterator(); + while (localIterator2.hasNext()) + { + Integer localInteger1 = (Integer)localIterator2.next(); + List localList1 = (List)this.g.get(localInteger1); + Iterator localIterator3 = paramp.e.iterator(); + while (localIterator3.hasNext()) + { + c localc1 = (c)localIterator3.next(); + if (localList1.contains(localc1)) + { + v.a(b, "optimizeActivities resumed, activity: %s", new Object[] { localc1 }); + localList1.remove(localc1); + } + } + } + } + + private static boolean b(Intent paramIntent, int paramInt) + { + return (paramInt & paramIntent.getFlags()) != 0; + } + + private List e(int paramInt) + { + Object localObject = (List)this.g.get(Integer.valueOf(paramInt)); + if (localObject == null) + { + localObject = new ArrayList(); + this.g.put(Integer.valueOf(paramInt), localObject); + } + return localObject; + } + + private f f(int paramInt) + { + f localf = (f)this.f.get(Integer.valueOf(paramInt)); + if (localf == null) + { + localf = new f(); + this.f.put(Integer.valueOf(paramInt), localf); + } + return localf; + } + + // ERROR // + final int a(int paramInt1, Intent paramIntent, ActivityInfo paramActivityInfo, IBinder paramIBinder, android.os.Bundle paramBundle, String paramString, int paramInt2) + { + // Byte code: + // 0: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 3: astore 8 + // 5: iconst_2 + // 6: anewarray 4 java/lang/Object + // 9: astore 9 + // 11: aload 9 + // 13: iconst_0 + // 14: aload_3 + // 15: getfield 402 android/content/pm/ActivityInfo:name Ljava/lang/String; + // 18: aastore + // 19: aload 9 + // 21: iconst_1 + // 22: aload 4 + // 24: aastore + // 25: aload 8 + // 27: ldc_w 404 + // 30: aload 9 + // 32: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 35: aload_0 + // 36: invokespecial 406 com/trigtech/privateme/server/am/ActivityStack:a ()V + // 39: aload_0 + // 40: iload_1 + // 41: aload 4 + // 43: invokevirtual 409 com/trigtech/privateme/server/am/ActivityStack:a (ILandroid/os/IBinder;)Lcom/trigtech/privateme/server/am/c; + // 46: astore 10 + // 48: aload 10 + // 50: ifnull +594 -> 644 + // 53: aload 10 + // 55: getfield 412 com/trigtech/privateme/server/am/c:a Lcom/trigtech/privateme/server/am/p; + // 58: astore 11 + // 60: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 63: ldc_w 414 + // 66: iconst_1 + // 67: anewarray 4 java/lang/Object + // 70: dup + // 71: iconst_0 + // 72: aload 11 + // 74: aastore + // 75: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 78: getstatic 420 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:CURRENT Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 81: astore 12 + // 83: getstatic 424 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:NOTHING Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 86: astore 13 + // 88: aload_2 + // 89: ldc_w 425 + // 92: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 95: istore 14 + // 97: aload_2 + // 98: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 101: ifnonnull +36 -> 137 + // 104: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 107: ldc_w 427 + // 110: iconst_0 + // 111: anewarray 4 java/lang/Object + // 114: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 117: aload_2 + // 118: new 121 android/content/ComponentName + // 121: dup + // 122: aload_3 + // 123: getfield 88 android/content/pm/ActivityInfo:packageName Ljava/lang/String; + // 126: aload_3 + // 127: getfield 402 android/content/pm/ActivityInfo:name Ljava/lang/String; + // 130: invokespecial 430 android/content/ComponentName: (Ljava/lang/String;Ljava/lang/String;)V + // 133: invokevirtual 434 android/content/Intent:setComponent (Landroid/content/ComponentName;)Landroid/content/Intent; + // 136: pop + // 137: aload 10 + // 139: ifnull +33 -> 172 + // 142: aload 10 + // 144: getfield 436 com/trigtech/privateme/server/am/c:g I + // 147: iconst_3 + // 148: if_icmpne +24 -> 172 + // 151: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 154: ldc_w 438 + // 157: iconst_0 + // 158: anewarray 4 java/lang/Object + // 161: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 164: aload_2 + // 165: ldc_w 439 + // 168: invokevirtual 139 android/content/Intent:addFlags (I)Landroid/content/Intent; + // 171: pop + // 172: iload 14 + // 174: ifeq +28 -> 202 + // 177: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 180: ldc_w 441 + // 183: iconst_0 + // 184: anewarray 4 java/lang/Object + // 187: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 190: aload_2 + // 191: ldc_w 442 + // 194: invokestatic 444 com/trigtech/privateme/server/am/ActivityStack:a (Landroid/content/Intent;I)V + // 197: getstatic 447 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:TOP Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 200: astore 13 + // 202: aload_2 + // 203: ldc_w 448 + // 206: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 209: ifeq +31 -> 240 + // 212: aload_2 + // 213: ldc_w 439 + // 216: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 219: ifeq +431 -> 650 + // 222: getstatic 451 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:TASK Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 225: astore 13 + // 227: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 230: ldc_w 453 + // 233: iconst_0 + // 234: anewarray 4 java/lang/Object + // 237: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 240: getstatic 458 android/os/Build$VERSION:SDK_INT I + // 243: bipush 21 + // 245: if_icmplt +31 -> 276 + // 248: aload_3 + // 249: getfield 461 android/content/pm/ActivityInfo:documentLaunchMode I + // 252: tableswitch default:+24 -> 276, 1:+421->673, 2:+434->686 + // 277: getfield 464 android/content/pm/ActivityInfo:launchMode I + // 280: tableswitch default:+28 -> 308, 1:+414->694, 2:+466->746, 3:+509->789 + // 309: ldc_w 465 + // 312: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 315: ifeq +1290 -> 1605 + // 318: aload 13 + // 320: astore 19 + // 322: aconst_null + // 323: astore 17 + // 325: aload 12 + // 327: astore 18 + // 329: iconst_1 + // 330: istore 20 + // 332: aload 19 + // 334: getstatic 424 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:NOTHING Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 337: if_acmpne +1261 -> 1598 + // 340: aload_2 + // 341: ldc_w 442 + // 344: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 347: ifeq +1251 -> 1598 + // 350: getstatic 468 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:SPEC_ACTIVITY Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 353: astore 21 + // 355: aload 11 + // 357: ifnonnull +16 -> 373 + // 360: aload 18 + // 362: getstatic 420 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:CURRENT Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 365: if_acmpne +8 -> 373 + // 368: getstatic 471 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:AFFINITY Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 371: astore 18 + // 373: aload_3 + // 374: invokestatic 474 com/trigtech/privateme/helper/utils/k:a (Landroid/content/pm/ActivityInfo;)Ljava/lang/String; + // 377: astore 22 + // 379: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 382: ldc_w 476 + // 385: iconst_2 + // 386: anewarray 4 java/lang/Object + // 389: dup + // 390: iconst_0 + // 391: aload 22 + // 393: aastore + // 394: dup + // 395: iconst_1 + // 396: aload 17 + // 398: aastore + // 399: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 402: getstatic 478 com/trigtech/privateme/server/am/e:b [I + // 405: aload 18 + // 407: invokevirtual 479 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:ordinal ()I + // 410: iaload + // 411: istore 23 + // 413: aconst_null + // 414: astore 24 + // 416: iload 23 + // 418: tableswitch default:+26 -> 444, 1:+400->818, 2:+412->830, 3:+423->841 + // 445: aconst_null + // 446: + // 447: aload 22 + // 449: invokevirtual 338 java/lang/String:equals (Ljava/lang/Object;)Z + // 452: ifeq +19 -> 471 + // 455: aload_0 + // 456: getfield 40 com/trigtech/privateme/server/am/ActivityStack:e Lcom/trigtech/privateme/helper/utils/a; + // 459: iload_1 + // 460: invokestatic 385 java/lang/Integer:valueOf (I)Ljava/lang/Integer; + // 463: invokevirtual 366 com/trigtech/privateme/helper/utils/a:get (Ljava/lang/Object;)Ljava/lang/Object; + // 466: checkcast 177 com/trigtech/privateme/server/am/p + // 469: astore 24 + // 471: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 474: ldc_w 483 + // 477: iconst_1 + // 478: anewarray 4 java/lang/Object + // 481: dup + // 482: iconst_0 + // 483: aload 24 + // 485: aastore + // 486: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 489: aload 24 + // 491: ifnonnull +383 -> 874 + // 494: invokestatic 489 android/os/SystemClock:elapsedRealtime ()J + // 497: lstore 53 + // 499: aload_0 + // 500: iload_1 + // 501: aconst_null + // 502: aload_2 + // 503: aload_3 + // 504: invokespecial 491 com/trigtech/privateme/server/am/ActivityStack:a (ILcom/trigtech/privateme/server/am/c;Landroid/content/Intent;Landroid/content/pm/ActivityInfo;)Landroid/content/Intent; + // 507: astore 55 + // 509: aload 55 + // 511: ifnull +68 -> 579 + // 514: aload 55 + // 516: ldc_w 439 + // 519: invokevirtual 139 android/content/Intent:addFlags (I)Landroid/content/Intent; + // 522: pop + // 523: aload 55 + // 525: ldc_w 492 + // 528: invokevirtual 139 android/content/Intent:addFlags (I)Landroid/content/Intent; + // 531: pop + // 532: aload 55 + // 534: ldc_w 493 + // 537: invokevirtual 139 android/content/Intent:addFlags (I)Landroid/content/Intent; + // 540: pop + // 541: getstatic 458 android/os/Build$VERSION:SDK_INT I + // 544: bipush 21 + // 546: if_icmpge +302 -> 848 + // 549: aload 55 + // 551: ldc_w 494 + // 554: invokevirtual 139 android/content/Intent:addFlags (I)Landroid/content/Intent; + // 557: pop + // 558: getstatic 458 android/os/Build$VERSION:SDK_INT I + // 561: bipush 16 + // 563: if_icmplt +297 -> 860 + // 566: invokestatic 58 com/trigtech/privateme/client/AppInterface:e ()Lcom/trigtech/privateme/client/AppInterface; + // 569: invokevirtual 62 com/trigtech/privateme/client/AppInterface:i ()Landroid/content/Context; + // 572: aload 55 + // 574: aload 5 + // 576: invokevirtual 498 android/content/Context:startActivity (Landroid/content/Intent;Landroid/os/Bundle;)V + // 579: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 582: astore 56 + // 584: iconst_1 + // 585: anewarray 4 java/lang/Object + // 588: astore 57 + // 590: aload 57 + // 592: iconst_0 + // 593: invokestatic 489 android/os/SystemClock:elapsedRealtime ()J + // 596: lload 53 + // 598: lsub + // 599: invokestatic 503 java/lang/Long:valueOf (J)Ljava/lang/Long; + // 602: aastore + // 603: aload 56 + // 605: ldc_w 505 + // 608: aload 57 + // 610: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 613: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 616: astore 31 + // 618: iconst_1 + // 619: anewarray 4 java/lang/Object + // 622: astore 32 + // 624: aload 32 + // 626: iconst_0 + // 627: aload_3 + // 628: getfield 402 android/content/pm/ActivityInfo:name Ljava/lang/String; + // 631: aastore + // 632: aload 31 + // 634: ldc_w 507 + // 637: aload 32 + // 639: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 642: iconst_0 + // 643: ireturn + // 644: aconst_null + // 645: astore 11 + // 647: goto -587 -> 60 + // 650: aload_2 + // 651: ldc_w 448 + // 654: invokestatic 444 com/trigtech/privateme/server/am/ActivityStack:a (Landroid/content/Intent;I)V + // 657: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 660: ldc_w 509 + // 663: iconst_0 + // 664: anewarray 4 java/lang/Object + // 667: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 670: goto -430 -> 240 + // 673: getstatic 451 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:TASK Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 676: astore 13 + // 678: getstatic 512 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:DOCUMENT Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 681: astore 12 + // 683: goto -407 -> 276 + // 686: getstatic 515 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:MULTIPLE Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 689: astore 12 + // 691: goto -415 -> 276 + // 694: aload_2 + // 695: ldc_w 439 + // 698: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 701: ifeq +18 -> 719 + // 704: aload_2 + // 705: ldc_w 492 + // 708: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 711: ifeq +27 -> 738 + // 714: getstatic 515 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:MULTIPLE Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 717: astore 12 + // 719: aload 13 + // 721: astore 19 + // 723: ldc_w 517 + // 726: astore 17 + // 728: aload 12 + // 730: astore 18 + // 732: iconst_1 + // 733: istore 20 + // 735: goto -403 -> 332 + // 738: getstatic 471 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:AFFINITY Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 741: astore 12 + // 743: goto -24 -> 719 + // 746: getstatic 447 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:TOP Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 749: astore 19 + // 751: aload_2 + // 752: ldc_w 492 + // 755: invokestatic 135 com/trigtech/privateme/server/am/ActivityStack:b (Landroid/content/Intent;I)Z + // 758: ifeq +23 -> 781 + // 761: getstatic 515 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:MULTIPLE Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 764: astore 63 + // 766: aload 63 + // 768: astore 18 + // 770: ldc_w 519 + // 773: astore 17 + // 775: iconst_0 + // 776: istore 20 + // 778: goto -446 -> 332 + // 781: getstatic 471 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:AFFINITY Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 784: astore 63 + // 786: goto -20 -> 766 + // 789: getstatic 447 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:TOP Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget; + // 792: astore 15 + // 794: getstatic 471 com/trigtech/privateme/server/am/ActivityStack$ReuseTarget:AFFINITY Lcom/trigtech/privateme/server/am/ActivityStack$ReuseTarget; + // 797: astore 16 + // 799: ldc_w 521 + // 802: astore 17 + // 804: aload 16 + // 806: astore 18 + // 808: aload 15 + // 810: astore 19 + // 812: iconst_0 + // 813: istore 20 + // 815: goto -483 -> 332 + // 818: aload_0 + // 819: iload_1 + // 820: aload 22 + // 822: invokespecial 523 com/trigtech/privateme/server/am/ActivityStack:b (ILjava/lang/String;)Lcom/trigtech/privateme/server/am/p; + // 825: astore 24 + // 827: goto -383 -> 444 + // 830: aload_0 + // 831: iload_1 + // 832: aload_2 + // 833: invokespecial 525 com/trigtech/privateme/server/am/ActivityStack:a (ILandroid/content/Intent;)Lcom/trigtech/privateme/server/am/p; + // 836: astore 24 + // 838: goto -394 -> 444 + // 841: aload 11 + // 843: astore 24 + // 845: goto -401 -> 444 + // 848: aload 55 + // 850: ldc_w 494 + // 853: invokevirtual 139 android/content/Intent:addFlags (I)Landroid/content/Intent; + // 856: pop + // 857: goto -299 -> 558 + // 860: invokestatic 58 com/trigtech/privateme/client/AppInterface:e ()Lcom/trigtech/privateme/client/AppInterface; + // 863: invokevirtual 62 com/trigtech/privateme/client/AppInterface:i ()Landroid/content/Context; + // 866: aload 55 + // 868: invokevirtual 527 android/content/Context:startActivity (Landroid/content/Intent;)V + // 871: goto -292 -> 579 + // 874: aload_0 + // 875: getfield 74 com/trigtech/privateme/server/am/ActivityStack:c Landroid/app/ActivityManager; + // 878: aload 24 + // 880: getfield 297 com/trigtech/privateme/server/am/p:a I + // 883: iconst_0 + // 884: invokevirtual 531 android/app/ActivityManager:moveTaskToFront (II)V + // 887: iload 14 + // 889: ifne +654 -> 1543 + // 892: aload 24 + // 894: getfield 202 com/trigtech/privateme/server/am/p:d Landroid/content/Intent; + // 897: astore 49 + // 899: aload_2 + // 900: ifnull +637 -> 1537 + // 903: aload 49 + // 905: ifnull +632 -> 1537 + // 908: aload_2 + // 909: invokevirtual 534 android/content/Intent:getAction ()Ljava/lang/String; + // 912: aload 49 + // 914: invokevirtual 534 android/content/Intent:getAction ()Ljava/lang/String; + // 917: invokestatic 539 com/trigtech/privateme/helper/a/f:a (Ljava/lang/Object;Ljava/lang/Object;)Z + // 920: ifne +460 -> 1380 + // 923: iconst_0 + // 924: istore 50 + // 926: iload 50 + // 928: ifeq +615 -> 1543 + // 931: iconst_1 + // 932: istore 25 + // 934: aload 24 + // 936: aload 11 + // 938: if_acmpne +653 -> 1591 + // 941: aload 24 + // 943: invokevirtual 541 com/trigtech/privateme/server/am/p:a ()Z + // 946: ifne +645 -> 1591 + // 949: iconst_0 + // 950: istore 26 + // 952: aload 21 + // 954: getfield 544 com/trigtech/privateme/server/am/ActivityStack$ClearTarget:deliverIntent Z + // 957: ifne +11 -> 968 + // 960: iconst_0 + // 961: istore 27 + // 963: iload 20 + // 965: ifeq +620 -> 1585 + // 968: aload 24 + // 970: aload 21 + // 972: aload_2 + // 973: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 976: invokestatic 546 com/trigtech/privateme/server/am/ActivityStack:a (Lcom/trigtech/privateme/server/am/p;Lcom/trigtech/privateme/server/am/ActivityStack$ClearTarget;Landroid/content/ComponentName;)Z + // 979: istore 27 + // 981: aload 24 + // 983: invokestatic 548 com/trigtech/privateme/server/am/ActivityStack:a (Lcom/trigtech/privateme/server/am/p;)Lcom/trigtech/privateme/server/am/c; + // 986: astore 45 + // 988: iload 14 + // 990: ifeq +24 -> 1014 + // 993: iload 20 + // 995: ifne +19 -> 1014 + // 998: aload 45 + // 1000: ifnull +14 -> 1014 + // 1003: iload 27 + // 1005: ifeq +9 -> 1014 + // 1008: aload 45 + // 1010: iconst_1 + // 1011: putfield 193 com/trigtech/privateme/server/am/c:i Z + // 1014: aload 45 + // 1016: ifnull +569 -> 1585 + // 1019: aload 45 + // 1021: getfield 193 com/trigtech/privateme/server/am/c:i Z + // 1024: ifne +561 -> 1585 + // 1027: aload 45 + // 1029: getfield 144 com/trigtech/privateme/server/am/c:b Landroid/content/ComponentName; + // 1032: aload_2 + // 1033: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1036: invokevirtual 206 android/content/ComponentName:equals (Ljava/lang/Object;)Z + // 1039: ifeq +546 -> 1585 + // 1042: aload 45 + // 1044: ifnull +39 -> 1083 + // 1047: aload 10 + // 1049: ifnull +500 -> 1549 + // 1052: aload 10 + // 1054: getfield 144 com/trigtech/privateme/server/am/c:b Landroid/content/ComponentName; + // 1057: invokevirtual 551 android/content/ComponentName:getPackageName ()Ljava/lang/String; + // 1060: astore 46 + // 1062: aload 45 + // 1064: getfield 554 com/trigtech/privateme/server/am/c:f Lcom/trigtech/privateme/server/am/j; + // 1067: getfield 557 com/trigtech/privateme/server/am/j:e Lcom/trigtech/privateme/client/AppClient; + // 1070: aload 46 + // 1072: aload 45 + // 1074: getfield 560 com/trigtech/privateme/server/am/c:d Landroid/os/IBinder; + // 1077: aload_2 + // 1078: invokeinterface 566 4 0 + // 1083: iconst_1 + // 1084: istore 28 + // 1086: iload 27 + // 1088: ifeq +19 -> 1107 + // 1091: aload_0 + // 1092: getfield 45 com/trigtech/privateme/server/am/ActivityStack:a Landroid/util/SparseArray; + // 1095: astore 43 + // 1097: aload 43 + // 1099: monitorenter + // 1100: aload_0 + // 1101: invokespecial 568 com/trigtech/privateme/server/am/ActivityStack:b ()V + // 1104: aload 43 + // 1106: monitorexit + // 1107: iload 26 + // 1109: ifne -496 -> 613 + // 1112: iload 28 + // 1114: ifne -501 -> 613 + // 1117: aload_0 + // 1118: iload_1 + // 1119: aload 10 + // 1121: aload_2 + // 1122: aload_3 + // 1123: invokespecial 491 com/trigtech/privateme/server/am/ActivityStack:a (ILcom/trigtech/privateme/server/am/c;Landroid/content/Intent;Landroid/content/pm/ActivityInfo;)Landroid/content/Intent; + // 1126: astore 29 + // 1128: aload 29 + // 1130: ifnull -517 -> 613 + // 1133: aload 24 + // 1135: invokestatic 548 com/trigtech/privateme/server/am/ActivityStack:a (Lcom/trigtech/privateme/server/am/p;)Lcom/trigtech/privateme/server/am/c; + // 1138: astore 30 + // 1140: aload 30 + // 1142: ifnull +222 -> 1364 + // 1145: aload_0 + // 1146: aload 24 + // 1148: getfield 200 com/trigtech/privateme/server/am/p:b I + // 1151: aload 30 + // 1153: aload 29 + // 1155: aload_3 + // 1156: invokespecial 491 com/trigtech/privateme/server/am/ActivityStack:a (ILcom/trigtech/privateme/server/am/c;Landroid/content/Intent;Landroid/content/pm/ActivityInfo;)Landroid/content/Intent; + // 1159: ifnull +205 -> 1364 + // 1162: aload 30 + // 1164: getfield 560 com/trigtech/privateme/server/am/c:d Landroid/os/IBinder; + // 1167: astore 33 + // 1169: getstatic 573 tbox/android/app/IActivityManager:startActivity Ltbox/RefMethod; + // 1172: invokevirtual 579 tbox/RefMethod:paramList ()[Ljava/lang/Class; + // 1175: astore 34 + // 1177: aload 34 + // 1179: arraylength + // 1180: anewarray 4 java/lang/Object + // 1183: astore 35 + // 1185: aload 34 + // 1187: iconst_0 + // 1188: aaload + // 1189: getstatic 585 tbox/android/app/IApplicationThread:TYPE Ljava/lang/Class; + // 1192: if_acmpne +20 -> 1212 + // 1195: aload 35 + // 1197: iconst_0 + // 1198: getstatic 590 tbox/android/app/ActivityThread:getApplicationThread Ltbox/RefMethod; + // 1201: invokestatic 592 com/trigtech/privateme/client/AppInterface:g ()Ljava/lang/Object; + // 1204: iconst_0 + // 1205: anewarray 4 java/lang/Object + // 1208: invokevirtual 596 tbox/RefMethod:call (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; + // 1211: aastore + // 1212: aload 34 + // 1214: ldc 77 + // 1216: invokestatic 601 com/trigtech/privateme/helper/utils/e:a ([Ljava/lang/Class;Ljava/lang/Class;)I + // 1219: istore 36 + // 1221: aload 34 + // 1223: ldc_w 603 + // 1226: iconst_2 + // 1227: invokestatic 606 com/trigtech/privateme/helper/utils/e:a ([Ljava/lang/Class;Ljava/lang/Class;I)I + // 1230: istore 37 + // 1232: aload 34 + // 1234: ldc_w 608 + // 1237: invokestatic 601 com/trigtech/privateme/helper/utils/e:a ([Ljava/lang/Class;Ljava/lang/Class;)I + // 1240: istore 38 + // 1242: iload 36 + // 1244: iconst_1 + // 1245: iadd + // 1246: istore 39 + // 1248: iload 37 + // 1250: iconst_1 + // 1251: iadd + // 1252: istore 40 + // 1254: iload 37 + // 1256: iconst_2 + // 1257: iadd + // 1258: istore 41 + // 1260: aload 35 + // 1262: iload 36 + // 1264: aload 29 + // 1266: aastore + // 1267: aload 35 + // 1269: iload 37 + // 1271: aload 33 + // 1273: aastore + // 1274: aload 35 + // 1276: iload 40 + // 1278: aload 6 + // 1280: aastore + // 1281: aload 35 + // 1283: iload 41 + // 1285: iload 7 + // 1287: invokestatic 385 java/lang/Integer:valueOf (I)Ljava/lang/Integer; + // 1290: aastore + // 1291: iload 38 + // 1293: iconst_m1 + // 1294: if_icmpeq +10 -> 1304 + // 1297: aload 35 + // 1299: iload 38 + // 1301: aload 5 + // 1303: aastore + // 1304: aload 35 + // 1306: iload 39 + // 1308: aload 29 + // 1310: invokevirtual 611 android/content/Intent:getType ()Ljava/lang/String; + // 1313: aastore + // 1314: getstatic 458 android/os/Build$VERSION:SDK_INT I + // 1317: bipush 18 + // 1319: if_icmplt +16 -> 1335 + // 1322: aload 35 + // 1324: iload 36 + // 1326: iconst_1 + // 1327: isub + // 1328: invokestatic 58 com/trigtech/privateme/client/AppInterface:e ()Lcom/trigtech/privateme/client/AppInterface; + // 1331: invokevirtual 98 com/trigtech/privateme/client/AppInterface:k ()Ljava/lang/String; + // 1334: aastore + // 1335: aload 34 + // 1337: aload 35 + // 1339: invokestatic 616 com/trigtech/privateme/helper/utils/i:a ([Ljava/lang/Class;[Ljava/lang/Object;)V + // 1342: getstatic 573 tbox/android/app/IActivityManager:startActivity Ltbox/RefMethod; + // 1345: getstatic 622 tbox/android/app/ActivityManagerNative:getDefault Ltbox/RefStaticMethod; + // 1348: iconst_0 + // 1349: anewarray 4 java/lang/Object + // 1352: invokevirtual 627 tbox/RefStaticMethod:call ([Ljava/lang/Object;)Ljava/lang/Object; + // 1355: aload 35 + // 1357: checkcast 629 [Ljava/lang/Object; + // 1360: invokevirtual 596 tbox/RefMethod:call (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; + // 1363: pop + // 1364: getstatic 31 com/trigtech/privateme/server/am/ActivityStack:b Ljava/lang/String; + // 1367: ldc_w 631 + // 1370: iconst_0 + // 1371: anewarray 4 java/lang/Object + // 1374: invokestatic 376 com/trigtech/privateme/helper/utils/v:a (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V + // 1377: goto -764 -> 613 + // 1380: aload_2 + // 1381: invokevirtual 635 android/content/Intent:getData ()Landroid/net/Uri; + // 1384: aload 49 + // 1386: invokevirtual 635 android/content/Intent:getData ()Landroid/net/Uri; + // 1389: invokestatic 539 com/trigtech/privateme/helper/a/f:a (Ljava/lang/Object;Ljava/lang/Object;)Z + // 1392: ifne +9 -> 1401 + // 1395: iconst_0 + // 1396: istore 50 + // 1398: goto -472 -> 926 + // 1401: aload_2 + // 1402: invokevirtual 611 android/content/Intent:getType ()Ljava/lang/String; + // 1405: aload 49 + // 1407: invokevirtual 611 android/content/Intent:getType ()Ljava/lang/String; + // 1410: invokestatic 539 com/trigtech/privateme/helper/a/f:a (Ljava/lang/Object;Ljava/lang/Object;)Z + // 1413: ifne +9 -> 1422 + // 1416: iconst_0 + // 1417: istore 50 + // 1419: goto -493 -> 926 + // 1422: aload_2 + // 1423: invokevirtual 638 android/content/Intent:getPackage ()Ljava/lang/String; + // 1426: astore 51 + // 1428: aload 51 + // 1430: ifnonnull +19 -> 1449 + // 1433: aload_2 + // 1434: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1437: ifnull +12 -> 1449 + // 1440: aload_2 + // 1441: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1444: invokevirtual 551 android/content/ComponentName:getPackageName ()Ljava/lang/String; + // 1447: astore 51 + // 1449: aload 49 + // 1451: invokevirtual 638 android/content/Intent:getPackage ()Ljava/lang/String; + // 1454: astore 52 + // 1456: aload 52 + // 1458: ifnonnull +21 -> 1479 + // 1461: aload 49 + // 1463: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1466: ifnull +13 -> 1479 + // 1469: aload 49 + // 1471: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1474: invokevirtual 551 android/content/ComponentName:getPackageName ()Ljava/lang/String; + // 1477: astore 52 + // 1479: aload 51 + // 1481: aload 52 + // 1483: invokestatic 539 com/trigtech/privateme/helper/a/f:a (Ljava/lang/Object;Ljava/lang/Object;)Z + // 1486: ifne +9 -> 1495 + // 1489: iconst_0 + // 1490: istore 50 + // 1492: goto -566 -> 926 + // 1495: aload_2 + // 1496: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1499: aload 49 + // 1501: invokevirtual 114 android/content/Intent:getComponent ()Landroid/content/ComponentName; + // 1504: invokestatic 539 com/trigtech/privateme/helper/a/f:a (Ljava/lang/Object;Ljava/lang/Object;)Z + // 1507: ifne +9 -> 1516 + // 1510: iconst_0 + // 1511: istore 50 + // 1513: goto -587 -> 926 + // 1516: aload_2 + // 1517: invokevirtual 641 android/content/Intent:getCategories ()Ljava/util/Set; + // 1520: aload 49 + // 1522: invokevirtual 641 android/content/Intent:getCategories ()Ljava/util/Set; + // 1525: invokestatic 539 com/trigtech/privateme/helper/a/f:a (Ljava/lang/Object;Ljava/lang/Object;)Z + // 1528: ifne +9 -> 1537 + // 1531: iconst_0 + // 1532: istore 50 + // 1534: goto -608 -> 926 + // 1537: iconst_1 + // 1538: istore 50 + // 1540: goto -614 -> 926 + // 1543: iconst_0 + // 1544: istore 25 + // 1546: goto -612 -> 934 + // 1549: ldc_w 643 + // 1552: astore 46 + // 1554: goto -492 -> 1062 + // 1557: astore 48 + // 1559: aload 48 + // 1561: invokevirtual 644 android/os/RemoteException:printStackTrace ()V + // 1564: goto -481 -> 1083 + // 1567: astore 47 + // 1569: aload 47 + // 1571: invokevirtual 645 java/lang/NullPointerException:printStackTrace ()V + // 1574: goto -491 -> 1083 + // 1577: astore 44 + // 1579: aload 43 + // 1581: monitorexit + // 1582: aload 44 + // 1584: athrow + // 1585: iconst_0 + // 1586: istore 28 + // 1588: goto -502 -> 1086 + // 1591: iload 25 + // 1593: istore 26 + // 1595: goto -643 -> 952 + // 1598: aload 19 + // 1600: astore 21 + // 1602: goto -1247 -> 355 + // 1605: aload 13 + // 1607: astore 19 + // 1609: aload 12 + // 1611: astore 18 + // 1613: aconst_null + // 1614: astore 17 + // 1616: iconst_0 + // 1617: istore 20 + // 1619: goto -1287 -> 332 + // + // Exception table: + // from to target type + // 1062 1083 1557 android/os/RemoteException + // 1062 1083 1567 java/lang/NullPointerException + // 1100 1107 1577 finally + // 1579 1582 1577 finally + } + + final c a(int paramInt) + { + List localList = e(paramInt); + if (!localList.isEmpty()) + return (c)localList.get(-1 + localList.size()); + return null; + } + + final c a(int paramInt, IBinder paramIBinder) + { + Object localObject1 = null; + if (paramIBinder != null); + for (int i = 0; ; i++) + { + p localp; + if (i < this.a.size()) + { + localp = (p)this.a.valueAt(i); + if (localp.b != paramInt); + } + else + { + while (true) + { + synchronized (localp.e) + { + Iterator localIterator = localp.e.iterator(); + if (localIterator.hasNext()) + { + localObject3 = (c)localIterator.next(); + if (((c)localObject3).d != paramIBinder) + break label116; + break label119; + } + } + return localObject1; + } + } + } + } + + final void a(int paramInt, String paramString) + { + if (paramInt != -1) + f(paramInt).a(paramString); + while (true) + { + return; + Iterator localIterator = this.f.keySet().iterator(); + while (localIterator.hasNext()) + f(((Integer)localIterator.next()).intValue()).a(paramString); + } + } + + final void a(j paramj) + { + while (true) + { + int j; + synchronized (this.a) + { + a(); + i = this.a.size(); + j = i - 1; + if (i <= 0) + break; + p localp = (p)this.a.valueAt(j); + synchronized (localp.e) + { + Iterator localIterator = localp.e.iterator(); + if (localIterator.hasNext()) + { + c localc = (c)localIterator.next(); + if (localc.f.g != paramj.g) + continue; + localIterator.remove(); + if (localp.e.isEmpty()) + this.a.remove(localp.a); + this.g.remove(localc); + } + } + } + int i = j; + } + } + + final void a(j paramj, ComponentName paramComponentName1, ComponentName paramComponentName2, IBinder paramIBinder, Intent paramIntent, String paramString, int paramInt1, int paramInt2, int paramInt3) + { + v.a(b, "onActivityCreated>>>>>>>>>>>>>>>token: %s", new Object[] { paramIBinder }); + while (true) + { + p localp1; + synchronized (this.a) + { + a(); + localp1 = (p)this.a.get(paramInt1); + if (localp1 == null) + { + localp2 = new p(paramInt1, paramj.j, paramString, paramIntent); + this.a.put(paramInt1, localp2); + c localc = new c(localp2, paramComponentName1, paramComponentName2, paramIBinder, paramj.j, paramj, paramInt2, paramInt3, paramString); + synchronized (localp2.e) + { + localp2.e.add(localc); + return; + } + } + } + p localp2 = localp1; + } + } + + final List b(int paramInt) + { + Object localObject = (List)this.h.get(Integer.valueOf(paramInt)); + if (localObject == null) + { + localObject = new ArrayList(); + this.h.put(Integer.valueOf(paramInt), localObject); + } + return localObject; + } + + final void b(int paramInt, IBinder paramIBinder) + { + v.a(b, "onActivityResumed>>>>>>>>>>>>>>>token: %s", new Object[] { paramIBinder }); + synchronized (this.a) + { + a(); + c localc = a(paramInt, paramIBinder); + v.a(b, "onActivityResumed, r: %s", new Object[] { localc }); + if (localc != null) + if (localc.b != null) + { + a.a(); + a.a(localc.b.getPackageName()); + f localf = f(paramInt); + String str = localc.b.getPackageName(); + localf.a(AppInterface.e().b(str)); + } + synchronized (localc.a.e) + { + localc.a.e.remove(localc); + localc.a.e.add(localc); + this.e.put(Integer.valueOf(paramInt), localc.a); + List localList2 = e(paramInt); + if (!localList2.contains(localc)) + { + v.a(b, "onActivityResumed, add r: %s", new Object[] { localc }); + localList2.add(localc); + } + return; + } + } + } + + final List c(int paramInt) + { + return f(paramInt).a(); + } + + final void c(int paramInt, IBinder paramIBinder) + { + v.a(b, "onActivityStarted>>>>>>>>>>>>>>>token: %s", new Object[] { paramIBinder }); + synchronized (this.a) + { + a(); + c localc = a(paramInt, paramIBinder); + v.a(b, "onActivityStarted, r: %s", new Object[] { localc }); + List localList = b(paramInt); + if ((localc != null) && (!localList.contains(localc))) + { + localList.add(localc); + v.a(b, "onActivityStarted, add r: %s", new Object[] { localc }); + } + return; + } + } + + final AppTaskInfo d(int paramInt) + { + synchronized (this.a) + { + p localp = (p)this.a.get(paramInt); + if (localp != null) + { + int i = localp.e.size(); + if (i <= 0); + ComponentName localComponentName; + for (AppTaskInfo localAppTaskInfo = null; ; localAppTaskInfo = new AppTaskInfo(localp.a, localp.d, localp.d.getComponent(), localComponentName)) + { + return localAppTaskInfo; + localComponentName = ((c)localp.e.get(i - 1)).b; + } + } + return null; + } + } + + final void d(int paramInt, IBinder paramIBinder) + { + v.a(b, "onActivityPaused>>>>>>>>>>>>>>>token: %s", new Object[] { paramIBinder }); + synchronized (this.a) + { + a(); + c localc = a(paramInt, paramIBinder); + v.a(b, "onActivityPaused, r: %s", new Object[] { localc }); + List localList = e(paramInt); + if ((localc != null) && (localList.contains(localc))) + { + localList.remove(localc); + v.a(b, "onActivityPaused, remove r: %s", new Object[] { localc }); + } + return; + } + } + + final void e(int paramInt, IBinder paramIBinder) + { + v.a(b, "onActivityStopped>>>>>>>>>>>>>>>token: %s", new Object[] { paramIBinder }); + synchronized (this.a) + { + a(); + c localc = a(paramInt, paramIBinder); + v.a(b, "onActivityStopped, r: %s", new Object[] { localc }); + List localList = b(paramInt); + if ((localc != null) && (localList.contains(localc))) + { + localList.remove(localc); + v.a(b, "onActivityStopped, remove r: %s", new Object[] { localc }); + } + return; + } + } + + final boolean f(int paramInt, IBinder paramIBinder) + { + v.a(b, "onActivityDestroyed>>>>>>>>>>>>>>>token: %s", new Object[] { paramIBinder }); + synchronized (this.a) + { + c localc = a(paramInt, paramIBinder); + v.a(b, "onActivityDestroyed, r: %s", new Object[] { localc }); + if (localc != null); + synchronized (localc.a.e) + { + localc.a.e.remove(localc); + List localList2 = e(paramInt); + if (localList2.contains(localc)) + { + localList2.remove(localc); + v.a(b, "onActivityDestroyed, remove resumed r: %s", new Object[] { localc }); + } + List localList3 = b(paramInt); + if (localList3.contains(localc)) + { + localList3.remove(localc); + v.a(b, "onActivityDestroyed, remove started r: %s", new Object[] { localc }); + } + a(); + return false; + } + } + } + + final String g(int paramInt, IBinder paramIBinder) + { + synchronized (this.a) + { + c localc = a(paramInt, paramIBinder); + if (localc != null) + { + String str = localc.b.getPackageName(); + return str; + } + return null; + } + } + + final ComponentName h(int paramInt, IBinder paramIBinder) + { + synchronized (this.a) + { + c localc = a(paramInt, paramIBinder); + if (localc != null) + { + ComponentName localComponentName = localc.c; + return localComponentName; + } + return null; + } + } + + public final String i(int paramInt, IBinder paramIBinder) + { + synchronized (this.a) + { + c localc = a(paramInt, paramIBinder); + if (localc != null) + { + ComponentName localComponentName = localc.c; + String str = null; + if (localComponentName != null) + str = localc.c.getPackageName(); + return str; + } + return null; + } + } + + final ComponentName j(int paramInt, IBinder paramIBinder) + { + synchronized (this.a) + { + c localc = a(paramInt, paramIBinder); + if (localc != null) + { + ComponentName localComponentName = localc.b; + return localComponentName; + } + return null; + } + } + + +} + +/* Location: + * Qualified Name: com.trigtech.privateme.server.am.ActivityStack + * Java Class Version: 6 (50.0) + * JD-Core Version: 0.6.1-SNAPSHOT + */ \ No newline at end of file diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue_2627/DefaultStrategy.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue_2627/DefaultStrategy.java new file mode 100644 index 0000000..fa64ba3 --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue_2627/DefaultStrategy.java @@ -0,0 +1,297 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package groovy.transform.builder; + +import groovy.transform.Undefined; +import org.codehaus.groovy.ast.AnnotatedNode; +import org.codehaus.groovy.ast.AnnotationNode; +import org.codehaus.groovy.ast.ClassNode; +import org.codehaus.groovy.ast.ConstructorNode; +import org.codehaus.groovy.ast.FieldNode; +import org.codehaus.groovy.ast.InnerClassNode; +import org.codehaus.groovy.ast.MethodNode; +import org.codehaus.groovy.ast.Parameter; +import org.codehaus.groovy.ast.expr.Expression; +import org.codehaus.groovy.ast.stmt.BlockStatement; +import org.codehaus.groovy.transform.BuilderASTTransformation; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.apache.groovy.ast.tools.ClassNodeUtils.addGeneratedInnerClass; +import static org.apache.groovy.ast.tools.ClassNodeUtils.addGeneratedMethod; +import static org.codehaus.groovy.ast.ClassHelper.OBJECT_TYPE; +import static org.codehaus.groovy.ast.tools.GeneralUtils.args; +import static org.codehaus.groovy.ast.tools.GeneralUtils.assignX; +import static org.codehaus.groovy.ast.tools.GeneralUtils.block; +import static org.codehaus.groovy.ast.tools.GeneralUtils.callX; +import static org.codehaus.groovy.ast.tools.GeneralUtils.constX; +import static org.codehaus.groovy.ast.tools.GeneralUtils.ctorX; +import static org.codehaus.groovy.ast.tools.GeneralUtils.declS; +import static org.codehaus.groovy.ast.tools.GeneralUtils.localVarX; +import static org.codehaus.groovy.ast.tools.GeneralUtils.param; +import static org.codehaus.groovy.ast.tools.GeneralUtils.params; +import static org.codehaus.groovy.ast.tools.GeneralUtils.propX; +import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS; +import static org.codehaus.groovy.ast.tools.GeneralUtils.stmt; +import static org.codehaus.groovy.ast.tools.GeneralUtils.varX; +import static org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse; +import static org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec; +import static org.codehaus.groovy.ast.tools.GenericsUtils.extractSuperClassGenerics; +import static org.codehaus.groovy.ast.tools.GenericsUtils.newClass; +import static org.codehaus.groovy.transform.AbstractASTTransformation.getMemberStringValue; +import static org.codehaus.groovy.transform.BuilderASTTransformation.NO_EXCEPTIONS; +import static org.codehaus.groovy.transform.BuilderASTTransformation.NO_PARAMS; +import static org.objectweb.asm.Opcodes.ACC_PRIVATE; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACC_STATIC; + +/** + * This strategy is used with the {@link Builder} AST transform to create a builder helper class + * for the fluent creation of instances of a specified class. It can be used at the class, + * static method or constructor levels. + * + * You use it as follows: + *

+ * import groovy.transform.builder.*
+ *
+ * {@code @Builder}
+ * class Person {
+ *     String firstName
+ *     String lastName
+ *     int age
+ * }
+ * def person = Person.builder().firstName("Robert").lastName("Lewandowski").age(21).build()
+ * assert person.firstName == "Robert"
+ * assert person.lastName == "Lewandowski"
+ * assert person.age == 21
+ * 
+ * The {@code prefix} annotation attribute can be used to create setters with a different naming convention. The default is the + * empty string but you could change that to "set" as follows: + *
+ * {@code @groovy.transform.builder.Builder}(prefix='set')
+ * class Person {
+ *     String firstName
+ *     String lastName
+ *     int age
+ * }
+ * def p2 = Person.builder().setFirstName("Robert").setLastName("Lewandowski").setAge(21).build()
+ * 
+ * or using a prefix of 'with' would result in usage like this: + *
+ * def p3 = Person.builder().withFirstName("Robert").withLastName("Lewandowski").withAge(21).build()
+ * 
+ * + * You can also use the {@code @Builder} annotation in combination with this strategy on one or more constructor or + * static method instead of or in addition to using it at the class level. An example with a constructor follows: + *
+ * import groovy.transform.ToString
+ * import groovy.transform.builder.Builder
+ *
+ * {@code @ToString}
+ * class Person {
+ *     String first, last
+ *     int born
+ *
+ *     {@code @Builder}
+ *     Person(String roleName) {
+ *         if (roleName == 'Jack Sparrow') {
+ *             first = 'Johnny'; last = 'Depp'; born = 1963
+ *         }
+ *     }
+ * }
+ * assert Person.builder().roleName("Jack Sparrow").build().toString() == 'Person(Johnny, Depp, 1963)'
+ * 
+ * In this case, the parameter(s) for the constructor or static method become the properties available + * in the builder. For the case of a static method, the return type of the static method becomes the + * class of the instance being created. For static factory methods, this is normally the class containing the + * static method but in general it can be any class. + * + * Note: if using more than one {@code @Builder} annotation, which is only possible when using static method + * or constructor variants, it is up to you to ensure that any generated helper classes or builder methods + * have unique names. E.g. we can modify the previous example to have three builders. At least two of the builders + * in our case will need to set the 'builderClassName' and 'builderMethodName' annotation attributes to ensure + * we have unique names. This is shown in the following example: + *
+ * import groovy.transform.builder.*
+ * import groovy.transform.*
+ *
+ * {@code @ToString}
+ * {@code @Builder}
+ * class Person {
+ *     String first, last
+ *     int born
+ *
+ *     Person(){} // required to retain no-arg constructor
+ *
+ *     {@code @Builder}(builderClassName='MovieBuilder', builderMethodName='byRoleBuilder')
+ *     Person(String roleName) {
+ *         if (roleName == 'Jack Sparrow') {
+ *             this.first = 'Johnny'; this.last = 'Depp'; this.born = 1963
+ *         }
+ *     }
+ *
+ *     {@code @Builder}(builderClassName='SplitBuilder', builderMethodName='splitBuilder')
+ *     static Person split(String name, int year) {
+ *         def parts = name.split(' ')
+ *         new Person(first: parts[0], last: parts[1], born: year)
+ *     }
+ * }
+ *
+ * assert Person.splitBuilder().name("Johnny Depp").year(1963).build().toString() == 'Person(Johnny, Depp, 1963)'
+ * assert Person.byRoleBuilder().roleName("Jack Sparrow").build().toString() == 'Person(Johnny, Depp, 1963)'
+ * assert Person.builder().first("Johnny").last('Depp').born(1963).build().toString() == 'Person(Johnny, Depp, 1963)'
+ * 
+ * + * The 'forClass' annotation attribute for the {@code @Builder} transform isn't applicable for this strategy. + * The 'useSetters' annotation attribute for the {@code @Builder} transform is ignored by this strategy which always uses setters. + */ +public class DefaultStrategy extends BuilderASTTransformation.AbstractBuilderStrategy { + private static final Expression DEFAULT_INITIAL_VALUE = null; + private static final int PUBLIC_STATIC = ACC_PUBLIC | ACC_STATIC; + + public void build(BuilderASTTransformation transform, AnnotatedNode annotatedNode, AnnotationNode anno) { + if (unsupportedAttribute(transform, anno, "forClass")) return; + if (unsupportedAttribute(transform, anno, "force")) return; + if (annotatedNode instanceof ClassNode) { + buildClass(transform, (ClassNode) annotatedNode, anno); + } else if (annotatedNode instanceof MethodNode) { + buildMethod(transform, (MethodNode) annotatedNode, anno); + } + } + + public void buildMethod(BuilderASTTransformation transform, MethodNode mNode, AnnotationNode anno) { + if (transform.getMemberValue(anno, "includes") != null || transform.getMemberValue(anno, "excludes") != null) { + transform.addError("Error during " + BuilderASTTransformation.MY_TYPE_NAME + + " processing: includes/excludes only allowed on classes", anno); + } + ClassNode buildee = mNode.getDeclaringClass(); + ClassNode builder = createBuilder(anno, buildee); + createBuilderFactoryMethod(anno, buildee, builder); + for (Parameter parameter : mNode.getParameters()) { + builder.addField(createFieldCopy(buildee, parameter)); + addGeneratedMethod(builder, createBuilderMethodForProp(builder, new PropertyInfo(parameter.getName(), parameter.getType()), getPrefix(anno))); + } + addGeneratedMethod(builder, createBuildMethodForMethod(anno, buildee, mNode, mNode.getParameters())); + } + + public void buildClass(BuilderASTTransformation transform, ClassNode buildee, AnnotationNode anno) { + List excludes = new ArrayList(); + List includes = new ArrayList(); + includes.add(Undefined.STRING); + if (!getIncludeExclude(transform, anno, buildee, excludes, includes)) return; + if (includes.size() == 1 && Undefined.isUndefined(includes.get(0))) includes = null; + ClassNode builder = createBuilder(anno, buildee); + createBuilderFactoryMethod(anno, buildee, builder); +// List fields = getFields(transform, anno, buildee); + boolean allNames = transform.memberHasValue(anno, "allNames", true); + boolean allProperties = !transform.memberHasValue(anno, "allProperties", false); + List props = getPropertyInfos(transform, anno, buildee, excludes, includes, allNames, allProperties); + for (PropertyInfo pi : props) { + ClassNode correctedType = getCorrectedType(buildee, pi.getType(), builder); + String fieldName = pi.getName(); + builder.addField(createFieldCopy(buildee, fieldName, correctedType)); + addGeneratedMethod(builder, createBuilderMethodForProp(builder, new PropertyInfo(fieldName, correctedType), getPrefix(anno))); + } + addGeneratedMethod(builder, createBuildMethod(anno, buildee, props)); + } + + private static ClassNode getCorrectedType(ClassNode buildee, ClassNode fieldType, ClassNode declaringClass) { + Map genericsSpec = createGenericsSpec(declaringClass); + extractSuperClassGenerics(fieldType, buildee, genericsSpec); + return correctToGenericsSpecRecurse(genericsSpec, fieldType); + } + + private static void createBuilderFactoryMethod(AnnotationNode anno, ClassNode buildee, ClassNode builder) { + addGeneratedInnerClass(buildee, builder); + addGeneratedMethod(buildee, createBuilderMethod(anno, builder)); + } + + private static ClassNode createBuilder(AnnotationNode anno, ClassNode buildee) { + return new InnerClassNode(buildee, getFullName(anno, buildee), PUBLIC_STATIC, OBJECT_TYPE); + } + + private static String getFullName(AnnotationNode anno, ClassNode buildee) { + String builderClassName = getMemberStringValue(anno, "builderClassName", buildee.getNameWithoutPackage() + "Builder"); + return buildee.getName() + "$" + builderClassName; + } + + private static String getPrefix(AnnotationNode anno) { + return getMemberStringValue(anno, "prefix", ""); + } + + private static MethodNode createBuildMethodForMethod(AnnotationNode anno, ClassNode buildee, MethodNode mNode, Parameter[] params) { + String buildMethodName = getMemberStringValue(anno, "buildMethodName", "build"); + final BlockStatement body = new BlockStatement(); + ClassNode returnType; + if (mNode instanceof ConstructorNode) { + returnType = newClass(buildee); + body.addStatement(returnS(ctorX(newClass(mNode.getDeclaringClass()), args(params)))); + } else { + body.addStatement(returnS(callX(newClass(mNode.getDeclaringClass()), mNode.getName(), args(params)))); + returnType = newClass(mNode.getReturnType()); + } + return new MethodNode(buildMethodName, ACC_PUBLIC, returnType, NO_PARAMS, NO_EXCEPTIONS, body); + } + + private static MethodNode createBuilderMethod(AnnotationNode anno, ClassNode builder) { + String builderMethodName = getMemberStringValue(anno, "builderMethodName", "builder"); + final BlockStatement body = new BlockStatement(); + body.addStatement(returnS(ctorX(builder))); + return new MethodNode(builderMethodName, PUBLIC_STATIC, builder, NO_PARAMS, NO_EXCEPTIONS, body); + } + + private static MethodNode createBuildMethod(AnnotationNode anno, ClassNode buildee, List props) { + String buildMethodName = getMemberStringValue(anno, "buildMethodName", "build"); + final BlockStatement body = new BlockStatement(); + body.addStatement(returnS(initializeInstance(buildee, props, body))); + return new MethodNode(buildMethodName, ACC_PUBLIC, newClass(buildee), NO_PARAMS, NO_EXCEPTIONS, body); + } + + private MethodNode createBuilderMethodForProp(ClassNode builder, PropertyInfo pinfo, String prefix) { + ClassNode fieldType = pinfo.getType(); + String fieldName = pinfo.getName(); + String setterName = getSetterName(prefix, fieldName); + return new MethodNode(setterName, ACC_PUBLIC, newClass(builder), params(param(fieldType, fieldName)), NO_EXCEPTIONS, block( + stmt(assignX(propX(varX("this"), constX(fieldName)), varX(fieldName, fieldType))), + returnS(varX("this", builder)) + )); + } + + private static FieldNode createFieldCopy(ClassNode buildee, Parameter param) { + Map genericsSpec = createGenericsSpec(buildee); + extractSuperClassGenerics(param.getType(), buildee, genericsSpec); + ClassNode correctedParamType = correctToGenericsSpecRecurse(genericsSpec, param.getType()); + return new FieldNode(param.getName(), ACC_PRIVATE, correctedParamType, buildee, param.getInitialExpression()); + } + + private static FieldNode createFieldCopy(ClassNode buildee, String fieldName, ClassNode fieldType) { + return new FieldNode(fieldName, ACC_PRIVATE, fieldType, buildee, DEFAULT_INITIAL_VALUE); + } + + private static Expression initializeInstance(ClassNode buildee, List props, BlockStatement body) { + Expression instance = localVarX("_the" + buildee.getNameWithoutPackage(), buildee); + body.addStatement(declS(instance, ctorX(buildee))); + for (PropertyInfo pi : props) { + body.addStatement(stmt(assignX(propX(instance, pi.getName()), varX(pi.getName(), pi.getType())))); + } + return instance; + } +} diff --git a/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue_2627/Ops.java b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue_2627/Ops.java new file mode 100644 index 0000000..b108cff --- /dev/null +++ b/Assignment-2/javaparser-javaparser-parent-3.27.0/javaparser-core-testing/src/test/resources/com/github/javaparser/issue_samples/issue_2627/Ops.java @@ -0,0 +1,7632 @@ +// Copyright 2020 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ============================================================================== +// +// This class has been generated, DO NOT EDIT! +// +package org.tensorflow.op; + +import java.nio.charset.Charset; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.EagerSession; +import org.tensorflow.ExecutionEnvironment; +import org.tensorflow.Operand; +import org.tensorflow.Tensor; +import org.tensorflow.op.core.Abort; +import org.tensorflow.op.core.All; +import org.tensorflow.op.core.Any; +import org.tensorflow.op.core.AssertThat; +import org.tensorflow.op.core.Assign; +import org.tensorflow.op.core.AssignAdd; +import org.tensorflow.op.core.AssignAddVariableOp; +import org.tensorflow.op.core.AssignSub; +import org.tensorflow.op.core.AssignSubVariableOp; +import org.tensorflow.op.core.AssignVariableOp; +import org.tensorflow.op.core.Barrier; +import org.tensorflow.op.core.BarrierClose; +import org.tensorflow.op.core.BarrierIncompleteSize; +import org.tensorflow.op.core.BarrierInsertMany; +import org.tensorflow.op.core.BarrierReadySize; +import org.tensorflow.op.core.BarrierTakeMany; +import org.tensorflow.op.core.Batch; +import org.tensorflow.op.core.BatchToSpace; +import org.tensorflow.op.core.BatchToSpaceNd; +import org.tensorflow.op.core.Bitcast; +import org.tensorflow.op.core.BroadcastDynamicShape; +import org.tensorflow.op.core.BroadcastTo; +import org.tensorflow.op.core.Bucketize; +import org.tensorflow.op.core.ClipByValue; +import org.tensorflow.op.core.Concat; +import org.tensorflow.op.core.Constant; +import org.tensorflow.op.core.ConsumeMutexLock; +import org.tensorflow.op.core.ControlTrigger; +import org.tensorflow.op.core.CountUpTo; +import org.tensorflow.op.core.DeepCopy; +import org.tensorflow.op.core.DeleteSessionTensor; +import org.tensorflow.op.core.DestroyResourceOp; +import org.tensorflow.op.core.DestroyTemporaryVariable; +import org.tensorflow.op.core.DynamicPartition; +import org.tensorflow.op.core.DynamicStitch; +import org.tensorflow.op.core.EditDistance; +import org.tensorflow.op.core.Empty; +import org.tensorflow.op.core.EmptyTensorList; +import org.tensorflow.op.core.EnsureShape; +import org.tensorflow.op.core.ExpandDims; +import org.tensorflow.op.core.ExtractVolumePatches; +import org.tensorflow.op.core.Fill; +import org.tensorflow.op.core.Fingerprint; +import org.tensorflow.op.core.Gather; +import org.tensorflow.op.core.GatherNd; +import org.tensorflow.op.core.GetSessionHandle; +import org.tensorflow.op.core.GetSessionTensor; +import org.tensorflow.op.core.Gradients; +import org.tensorflow.op.core.GuaranteeConst; +import org.tensorflow.op.core.HashTable; +import org.tensorflow.op.core.Helpers; +import org.tensorflow.op.core.HistogramFixedWidth; +import org.tensorflow.op.core.Identity; +import org.tensorflow.op.core.IdentityN; +import org.tensorflow.op.core.ImmutableConst; +import org.tensorflow.op.core.Init; +import org.tensorflow.op.core.InitializeTable; +import org.tensorflow.op.core.InitializeTableFromTextFile; +import org.tensorflow.op.core.InplaceAdd; +import org.tensorflow.op.core.InplaceSub; +import org.tensorflow.op.core.InplaceUpdate; +import org.tensorflow.op.core.IsVariableInitialized; +import org.tensorflow.op.core.LinSpace; +import org.tensorflow.op.core.LookupTableExport; +import org.tensorflow.op.core.LookupTableFind; +import org.tensorflow.op.core.LookupTableImport; +import org.tensorflow.op.core.LookupTableInsert; +import org.tensorflow.op.core.LookupTableSize; +import org.tensorflow.op.core.LoopCond; +import org.tensorflow.op.core.MapClear; +import org.tensorflow.op.core.MapIncompleteSize; +import org.tensorflow.op.core.MapPeek; +import org.tensorflow.op.core.MapSize; +import org.tensorflow.op.core.MapStage; +import org.tensorflow.op.core.MapUnstage; +import org.tensorflow.op.core.MapUnstageNoKey; +import org.tensorflow.op.core.Max; +import org.tensorflow.op.core.Merge; +import org.tensorflow.op.core.Min; +import org.tensorflow.op.core.MirrorPad; +import org.tensorflow.op.core.MlirPassthroughOp; +import org.tensorflow.op.core.MutableDenseHashTable; +import org.tensorflow.op.core.MutableHashTable; +import org.tensorflow.op.core.MutableHashTableOfTensors; +import org.tensorflow.op.core.Mutex; +import org.tensorflow.op.core.MutexLock; +import org.tensorflow.op.core.NextIteration; +import org.tensorflow.op.core.NoOp; +import org.tensorflow.op.core.OneHot; +import org.tensorflow.op.core.OnesLike; +import org.tensorflow.op.core.OrderedMapClear; +import org.tensorflow.op.core.OrderedMapIncompleteSize; +import org.tensorflow.op.core.OrderedMapPeek; +import org.tensorflow.op.core.OrderedMapSize; +import org.tensorflow.op.core.OrderedMapStage; +import org.tensorflow.op.core.OrderedMapUnstage; +import org.tensorflow.op.core.OrderedMapUnstageNoKey; +import org.tensorflow.op.core.Pad; +import org.tensorflow.op.core.ParallelConcat; +import org.tensorflow.op.core.ParallelDynamicStitch; +import org.tensorflow.op.core.Placeholder; +import org.tensorflow.op.core.PlaceholderWithDefault; +import org.tensorflow.op.core.Print; +import org.tensorflow.op.core.Prod; +import org.tensorflow.op.core.QuantizedReshape; +import org.tensorflow.op.core.Range; +import org.tensorflow.op.core.Rank; +import org.tensorflow.op.core.ReadVariableOp; +import org.tensorflow.op.core.ReduceAll; +import org.tensorflow.op.core.ReduceAny; +import org.tensorflow.op.core.ReduceMax; +import org.tensorflow.op.core.ReduceMin; +import org.tensorflow.op.core.ReduceProd; +import org.tensorflow.op.core.ReduceSum; +import org.tensorflow.op.core.RefNextIteration; +import org.tensorflow.op.core.RefSelect; +import org.tensorflow.op.core.RefSwitch; +import org.tensorflow.op.core.RemoteFusedGraphExecute; +import org.tensorflow.op.core.Reshape; +import org.tensorflow.op.core.ResourceCountUpTo; +import org.tensorflow.op.core.ResourceGather; +import org.tensorflow.op.core.ResourceGatherNd; +import org.tensorflow.op.core.ResourceScatterAdd; +import org.tensorflow.op.core.ResourceScatterDiv; +import org.tensorflow.op.core.ResourceScatterMax; +import org.tensorflow.op.core.ResourceScatterMin; +import org.tensorflow.op.core.ResourceScatterMul; +import org.tensorflow.op.core.ResourceScatterNdAdd; +import org.tensorflow.op.core.ResourceScatterNdSub; +import org.tensorflow.op.core.ResourceScatterNdUpdate; +import org.tensorflow.op.core.ResourceScatterSub; +import org.tensorflow.op.core.ResourceScatterUpdate; +import org.tensorflow.op.core.ResourceStridedSliceAssign; +import org.tensorflow.op.core.Reverse; +import org.tensorflow.op.core.ReverseSequence; +import org.tensorflow.op.core.Roll; +import org.tensorflow.op.core.Rpc; +import org.tensorflow.op.core.ScatterAdd; +import org.tensorflow.op.core.ScatterDiv; +import org.tensorflow.op.core.ScatterMax; +import org.tensorflow.op.core.ScatterMin; +import org.tensorflow.op.core.ScatterMul; +import org.tensorflow.op.core.ScatterNd; +import org.tensorflow.op.core.ScatterNdAdd; +import org.tensorflow.op.core.ScatterNdNonAliasingAdd; +import org.tensorflow.op.core.ScatterNdSub; +import org.tensorflow.op.core.ScatterNdUpdate; +import org.tensorflow.op.core.ScatterSub; +import org.tensorflow.op.core.ScatterUpdate; +import org.tensorflow.op.core.Select; +import org.tensorflow.op.core.SetDiff1d; +import org.tensorflow.op.core.SetSize; +import org.tensorflow.op.core.ShapeN; +import org.tensorflow.op.core.Size; +import org.tensorflow.op.core.Skipgram; +import org.tensorflow.op.core.Slice; +import org.tensorflow.op.core.Snapshot; +import org.tensorflow.op.core.SpaceToBatchNd; +import org.tensorflow.op.core.Split; +import org.tensorflow.op.core.SplitV; +import org.tensorflow.op.core.Squeeze; +import org.tensorflow.op.core.Stack; +import org.tensorflow.op.core.Stage; +import org.tensorflow.op.core.StageClear; +import org.tensorflow.op.core.StagePeek; +import org.tensorflow.op.core.StageSize; +import org.tensorflow.op.core.StopGradient; +import org.tensorflow.op.core.StridedSlice; +import org.tensorflow.op.core.StridedSliceAssign; +import org.tensorflow.op.core.StridedSliceGrad; +import org.tensorflow.op.core.Sum; +import org.tensorflow.op.core.SwitchCond; +import org.tensorflow.op.core.TemporaryVariable; +import org.tensorflow.op.core.TensorArray; +import org.tensorflow.op.core.TensorArrayClose; +import org.tensorflow.op.core.TensorArrayConcat; +import org.tensorflow.op.core.TensorArrayGather; +import org.tensorflow.op.core.TensorArrayGrad; +import org.tensorflow.op.core.TensorArrayGradWithShape; +import org.tensorflow.op.core.TensorArrayPack; +import org.tensorflow.op.core.TensorArrayRead; +import org.tensorflow.op.core.TensorArrayScatter; +import org.tensorflow.op.core.TensorArraySize; +import org.tensorflow.op.core.TensorArraySplit; +import org.tensorflow.op.core.TensorArrayUnpack; +import org.tensorflow.op.core.TensorArrayWrite; +import org.tensorflow.op.core.TensorListConcat; +import org.tensorflow.op.core.TensorListConcatLists; +import org.tensorflow.op.core.TensorListElementShape; +import org.tensorflow.op.core.TensorListFromTensor; +import org.tensorflow.op.core.TensorListGather; +import org.tensorflow.op.core.TensorListGetItem; +import org.tensorflow.op.core.TensorListLength; +import org.tensorflow.op.core.TensorListPopBack; +import org.tensorflow.op.core.TensorListPushBack; +import org.tensorflow.op.core.TensorListPushBackBatch; +import org.tensorflow.op.core.TensorListReserve; +import org.tensorflow.op.core.TensorListResize; +import org.tensorflow.op.core.TensorListScatter; +import org.tensorflow.op.core.TensorListScatterIntoExistingList; +import org.tensorflow.op.core.TensorListSetItem; +import org.tensorflow.op.core.TensorListSplit; +import org.tensorflow.op.core.TensorListStack; +import org.tensorflow.op.core.TensorScatterNdAdd; +import org.tensorflow.op.core.TensorScatterNdSub; +import org.tensorflow.op.core.TensorScatterNdUpdate; +import org.tensorflow.op.core.TensorStridedSliceUpdate; +import org.tensorflow.op.core.Tile; +import org.tensorflow.op.core.Timestamp; +import org.tensorflow.op.core.TryRpc; +import org.tensorflow.op.core.Unbatch; +import org.tensorflow.op.core.UnbatchGrad; +import org.tensorflow.op.core.Unique; +import org.tensorflow.op.core.UniqueWithCounts; +import org.tensorflow.op.core.UnravelIndex; +import org.tensorflow.op.core.Unstack; +import org.tensorflow.op.core.Unstage; +import org.tensorflow.op.core.VarHandleOp; +import org.tensorflow.op.core.VarIsInitializedOp; +import org.tensorflow.op.core.Variable; +import org.tensorflow.op.core.VariableShape; +import org.tensorflow.op.core.Where; +import org.tensorflow.op.core.Zeros; +import org.tensorflow.op.core.ZerosLike; +import org.tensorflow.tools.Shape; +import org.tensorflow.tools.buffer.BooleanDataBuffer; +import org.tensorflow.tools.buffer.ByteDataBuffer; +import org.tensorflow.tools.buffer.DataBuffer; +import org.tensorflow.tools.buffer.DoubleDataBuffer; +import org.tensorflow.tools.buffer.FloatDataBuffer; +import org.tensorflow.tools.buffer.IntDataBuffer; +import org.tensorflow.tools.buffer.LongDataBuffer; +import org.tensorflow.tools.ndarray.BooleanNdArray; +import org.tensorflow.tools.ndarray.ByteNdArray; +import org.tensorflow.tools.ndarray.DoubleNdArray; +import org.tensorflow.tools.ndarray.FloatNdArray; +import org.tensorflow.tools.ndarray.IntNdArray; +import org.tensorflow.tools.ndarray.LongNdArray; +import org.tensorflow.tools.ndarray.NdArray; +import org.tensorflow.types.TBool; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; +import org.tensorflow.types.TString; +import org.tensorflow.types.TUint8; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * An API for building operations as {@link Op Op}s + *

+ * Any operation wrapper found in the classpath properly annotated as an{@link org.tensorflow.op.annotation.Operator @Operator} is exposed + * by this API or one of its subgroup. + *

Example usage: + *

{@code
+ * try (Graph g = new Graph()) {
+ *   Ops tf = Ops.create(g);
+ *   // Operations are typed classes with convenience
+ *   // builders in Ops.
+ *   Constant three = tf.constant(3);
+ *   // Single-result operations implement the Operand
+ *   // interface, so this works too.
+ *   Operand four = tf.constant(4);
+ *   // Most builders are found within a group, and accept
+ *   // Operand types as operands
+ *   Operand nine = tf.math.add(four, tf.constant(5));
+ *   // Multi-result operations however offer methods to
+ *   // select a particular result for use.
+ *   Operand result = 
+ *       tf.math.add(tf.unique(s, a).y(), b);
+ *   // Optional attributes
+ *   tf.linalg.matMul(a, b, MatMul.transposeA(true));
+ *   // Naming operators
+ *   tf.withName("foo").constant(5); // name "foo"
+ *   // Names can exist in a hierarchy
+ *   Ops sub = tf.withSubScope("sub");
+ *   sub.withName("bar").constant(4); // "sub/bar"
+ * }
+ * }
+ */ +public final class Ops { + public final NnOps nn; + + public final SummaryOps summary; + + public final ImageOps image; + + public final DataOps data; + + public final IoOps io; + + public final DtypesOps dtypes; + + public final LinalgOps linalg; + + public final RandomOps random; + + public final StringsOps strings; + + public final SparseOps sparse; + + public final BitwiseOps bitwise; + + public final MathOps math; + + public final AudioOps audio; + + public final SignalOps signal; + + public final TrainOps train; + + public final QuantizationOps quantization; + + private final Scope scope; + + private Ops(Scope scope) { + this.scope = scope; + nn = new NnOps(scope); + summary = new SummaryOps(scope); + image = new ImageOps(scope); + data = new DataOps(scope); + io = new IoOps(scope); + dtypes = new DtypesOps(scope); + linalg = new LinalgOps(scope); + random = new RandomOps(scope); + strings = new StringsOps(scope); + sparse = new SparseOps(scope); + bitwise = new BitwiseOps(scope); + math = new MathOps(scope); + audio = new AudioOps(scope); + signal = new SignalOps(scope); + train = new TrainOps(scope); + quantization = new QuantizationOps(scope); + } + + /** + * Raise a exception to abort the process when called. + *

+ * If exit_without_error is true, the process will exit normally, + * otherwise it will exit with a SIGABORT signal. + *

+ * Returns nothing but an exception. + * + * @param options carries optional attributes values + * @return a new instance of Abort + */ + public Abort abort(Abort.Options... options) { + return Abort.create(scope, options); + } + + /** + * Computes the "logical and" of elements across dimensions of a tensor. + *

+ * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of All + */ + public All all(Operand input, Operand axis, + All.Options... options) { + return All.create(scope, input, axis, options); + } + + /** + * Computes the "logical or" of elements across dimensions of a tensor. + *

+ * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Any + */ + public Any any(Operand input, Operand axis, + Any.Options... options) { + return Any.create(scope, input, axis, options); + } + + /** + * Creates a constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return a float constant + */ + public Constant array(int... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code String} elements, using the default UTF-8 charset. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return the {@code String} constant + */ + public Constant array(String... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return a boolean constant + */ + public Constant array(boolean... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return a long constant + */ + public Constant array(long... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return a float constant + */ + public Constant array(float... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return a double constant + */ + public Constant array(double... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. + * @return a byte constant + */ + public Constant array(byte... data) { + return Constant.arrayOf(scope, data); + } + + /** + * Creates a constant of {@code String} elements, using the given charset. + * + * @param scope is a scope used to add the underlying operation. + * @param charset charset for encoding/decoding strings bytes. + * @param data An array containing the values to put into the new constant. String elements are + * sequences of bytes from the last array dimension. + * @return the {@code String} constant + */ + public Constant array(Charset charset, String... data) { + return Constant.arrayOf(scope, charset, data); + } + + /** + * Asserts that the given condition is true. + *

+ * If `condition` evaluates to false, print the list of tensors in `data`. + * `summarize` determines how many entries of the tensors to print. + * + * @param condition The condition to evaluate. + * @param data The tensors to print out when condition is false. + * @param options carries optional attributes values + * @return a new instance of AssertThat + */ + public AssertThat assertThat(Operand condition, Iterable> data, + AssertThat.Options... options) { + return AssertThat.create(scope, condition, data, options); + } + + /** + * Update 'ref' by assigning 'value' to it. + *

+ * This operation outputs "ref" after the assignment is done. + * This makes it easier to chain operations that need to use the reset value. + * + * @param data type for {@code outputRef()} output + * @param ref Should be from a `Variable` node. May be uninitialized. + * @param value The value to be assigned to the variable. + * @param options carries optional attributes values + * @return a new instance of Assign + */ + public Assign assign(Operand ref, Operand value, + Assign.Options... options) { + return Assign.create(scope, ref, value, options); + } + + /** + * Update 'ref' by adding 'value' to it. + *

+ * This operation outputs "ref" after the update is done. + * This makes it easier to chain operations that need to use the reset value. + * + * @param data type for {@code outputRef()} output + * @param ref Should be from a `Variable` node. + * @param value The value to be added to the variable. + * @param options carries optional attributes values + * @return a new instance of AssignAdd + */ + public AssignAdd assignAdd(Operand ref, Operand value, + AssignAdd.Options... options) { + return AssignAdd.create(scope, ref, value, options); + } + + /** + * Adds a value to the current value of a variable. + *

+ * Any ReadVariableOp with a control dependency on this op is guaranteed to + * see the incremented value or a subsequent newer one. + * + * @param resource handle to the resource in which to store the variable. + * @param value the value by which the variable will be incremented. + * @return a new instance of AssignAddVariableOp + */ + public AssignAddVariableOp assignAddVariableOp(Operand resource, + Operand value) { + return AssignAddVariableOp.create(scope, resource, value); + } + + /** + * Update 'ref' by subtracting 'value' from it. + *

+ * This operation outputs "ref" after the update is done. + * This makes it easier to chain operations that need to use the reset value. + * + * @param data type for {@code outputRef()} output + * @param ref Should be from a `Variable` node. + * @param value The value to be subtracted to the variable. + * @param options carries optional attributes values + * @return a new instance of AssignSub + */ + public AssignSub assignSub(Operand ref, Operand value, + AssignSub.Options... options) { + return AssignSub.create(scope, ref, value, options); + } + + /** + * Subtracts a value from the current value of a variable. + *

+ * Any ReadVariableOp with a control dependency on this op is guaranteed to + * see the decremented value or a subsequent newer one. + * + * @param resource handle to the resource in which to store the variable. + * @param value the value by which the variable will be incremented. + * @return a new instance of AssignSubVariableOp + */ + public AssignSubVariableOp assignSubVariableOp(Operand resource, + Operand value) { + return AssignSubVariableOp.create(scope, resource, value); + } + + /** + * Assigns a new value to a variable. + *

+ * Any ReadVariableOp with a control dependency on this op is guaranteed to return + * this value or a subsequent newer value of the variable. + * + * @param resource handle to the resource in which to store the variable. + * @param value the value to set the new tensor to use. + * @return a new instance of AssignVariableOp + */ + public AssignVariableOp assignVariableOp(Operand resource, + Operand value) { + return AssignVariableOp.create(scope, resource, value); + } + + /** + * Defines a barrier that persists across different graph executions. + *

+ * A barrier represents a key-value map, where each key is a string, and + * each value is a tuple of tensors. + *

+ * At runtime, the barrier contains 'complete' and 'incomplete' + * elements. A complete element has defined tensors for all components of + * its value tuple, and may be accessed using BarrierTakeMany. An + * incomplete element has some undefined components in its value tuple, + * and may be updated using BarrierInsertMany. + * + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of Barrier + */ + public Barrier barrier(List> componentTypes, Barrier.Options... options) { + return Barrier.create(scope, componentTypes, options); + } + + /** + * Closes the given barrier. + *

+ * This operation signals that no more new elements will be inserted in the + * given barrier. Subsequent InsertMany that try to introduce a new key will fail. + * Subsequent InsertMany operations that just add missing components to already + * existing elements will continue to succeed. Subsequent TakeMany operations will + * continue to succeed if sufficient completed elements remain in the barrier. + * Subsequent TakeMany operations that would block will fail immediately. + * + * @param handle The handle to a barrier. + * @param options carries optional attributes values + * @return a new instance of BarrierClose + */ + public BarrierClose barrierClose(Operand handle, BarrierClose.Options... options) { + return BarrierClose.create(scope, handle, options); + } + + /** + * Computes the number of incomplete elements in the given barrier. + * + * @param handle The handle to a barrier. + * @return a new instance of BarrierIncompleteSize + */ + public BarrierIncompleteSize barrierIncompleteSize(Operand handle) { + return BarrierIncompleteSize.create(scope, handle); + } + + /** + * For each key, assigns the respective value to the specified component. + *

+ * If a key is not found in the barrier, this operation will create a new + * incomplete element. If a key is found in the barrier, and the element + * already has a value at component_index, this operation will fail with + * INVALID_ARGUMENT, and leave the barrier in an undefined state. + * + * @param handle The handle to a barrier. + * @param keys A one-dimensional tensor of keys, with length n. + * @param values An any-dimensional tensor of values, which are associated with the + * respective keys. The 0th dimension must have length n. + * @param componentIndex The component of the barrier elements that is being assigned. + * @return a new instance of BarrierInsertMany + */ + public BarrierInsertMany barrierInsertMany(Operand handle, + Operand keys, Operand values, Long componentIndex) { + return BarrierInsertMany.create(scope, handle, keys, values, componentIndex); + } + + /** + * Computes the number of complete elements in the given barrier. + * + * @param handle The handle to a barrier. + * @return a new instance of BarrierReadySize + */ + public BarrierReadySize barrierReadySize(Operand handle) { + return BarrierReadySize.create(scope, handle); + } + + /** + * Takes the given number of completed elements from a barrier. + *

+ * This operation concatenates completed-element component tensors along + * the 0th dimension to make a single component tensor. + *

+ * Elements come out of the barrier when they are complete, and in the order + * in which they were placed into the barrier. The indices output provides + * information about the batch in which each element was originally inserted + * into the barrier. + * + * @param handle The handle to a barrier. + * @param numElements A single-element tensor containing the number of elements to + * take. + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of BarrierTakeMany + */ + public BarrierTakeMany barrierTakeMany(Operand handle, Operand numElements, + List> componentTypes, BarrierTakeMany.Options... options) { + return BarrierTakeMany.create(scope, handle, numElements, componentTypes, options); + } + + /** + * Batches all input tensors nondeterministically. + *

+ * When many instances of this Op are being run concurrently with the same + * container/shared_name in the same device, some will output zero-shaped Tensors + * and others will output Tensors of size up to max_batch_size. + *

+ * All Tensors in in_tensors are batched together (so, for example, labels and + * features should be batched with a single instance of this operation. + *

+ * Each invocation of batch emits an `id` scalar which will be used to identify + * this particular invocation when doing unbatch or its gradient. + *

+ * Each op which emits a non-empty batch will also emit a non-empty batch_index + * Tensor, which, is a [K, 3] matrix where each row contains the invocation's id, + * start, and length of elements of each set of Tensors present in batched_tensors. + *

+ * Batched tensors are concatenated along the first dimension, and all tensors in + * in_tensors must have the first dimension of the same size. + *

+ * in_tensors: The tensors to be batched. + * num_batch_threads: Number of scheduling threads for processing batches of work. + * Determines the number of batches processed in parallel. + * max_batch_size: Batch sizes will never be bigger than this. + * batch_timeout_micros: Maximum number of microseconds to wait before outputting + * an incomplete batch. + * allowed_batch_sizes: Optional list of allowed batch sizes. If left empty, does + * nothing. Otherwise, supplies a list of batch sizes, causing the op to pad + * batches up to one of those sizes. The entries must increase monotonically, and + * the final entry must equal max_batch_size. + * grad_timeout_micros: The timeout to use for the gradient. See Unbatch. + * batched_tensors: Either empty tensors or a batch of concatenated Tensors. + * batch_index: If out_tensors is non-empty, has information to invert it. + * container: Controls the scope of sharing of this batch. + * id: always contains a scalar with a unique ID for this invocation of Batch. + * shared_name: Concurrently running instances of batch in the same device with the + * same container and shared_name will batch their elements together. If left + * empty, the op name will be used as the shared name. + * T: the types of tensors to be batched. + * + * @param inTensors + * @param numBatchThreads + * @param maxBatchSize + * @param batchTimeoutMicros + * @param gradTimeoutMicros + * @param options carries optional attributes values + * @return a new instance of Batch + */ + public Batch batch(Iterable> inTensors, Long numBatchThreads, Long maxBatchSize, + Long batchTimeoutMicros, Long gradTimeoutMicros, Batch.Options... options) { + return Batch.create(scope, inTensors, numBatchThreads, maxBatchSize, batchTimeoutMicros, gradTimeoutMicros, options); + } + + /** + * BatchToSpace for 4-D tensors of type T. + *

+ * This is a legacy version of the more general BatchToSpaceND. + *

+ * Rearranges (permutes) data from batch into blocks of spatial data, followed by + * cropping. This is the reverse transformation of SpaceToBatch. More specifically, + * this op outputs a copy of the input tensor where values from the `batch` + * dimension are moved in spatial blocks to the `height` and `width` dimensions, + * followed by cropping along the `height` and `width` dimensions. + * + * @param data type for {@code output()} output + * @param input 4-D tensor with shape + * `[batchblock_sizeblock_size, height_pad/block_size, width_pad/block_size, + * depth]`. Note that the batch size of the input tensor must be divisible by + * `block_size * block_size`. + * @param crops 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies + * how many elements to crop from the intermediate result across the spatial + * dimensions as follows: + *

+ * crops = [[crop_top, crop_bottom], [crop_left, crop_right]] + * @param blockSize + * @return a new instance of BatchToSpace + */ + public BatchToSpace batchToSpace(Operand input, + Operand crops, Long blockSize) { + return BatchToSpace.create(scope, input, crops, blockSize); + } + + /** + * BatchToSpace for N-D tensors of type T. + *

+ * This operation reshapes the "batch" dimension 0 into `M + 1` dimensions of shape + * `block_shape + [batch]`, interleaves these blocks back into the grid defined by + * the spatial dimensions `[1, ..., M]`, to obtain a result with the same rank as + * the input. The spatial dimensions of this intermediate result are then + * optionally cropped according to `crops` to produce the output. This is the + * reverse of SpaceToBatch. See below for a precise description. + * + * @param data type for {@code output()} output + * @param input N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, + * where spatial_shape has M dimensions. + * @param blockShape 1-D with shape `[M]`, all values must be >= 1. + * @param crops 2-D with shape `[M, 2]`, all values must be >= 0. + * `crops[i] = [crop_start, crop_end]` specifies the amount to crop from input + * dimension `i + 1`, which corresponds to spatial dimension `i`. It is + * required that + * `crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]`. + *

+ * This operation is equivalent to the following steps: + *

+ * 1. Reshape `input` to `reshaped` of shape: + * [block_shape[0], ..., block_shape[M-1], + * batch / prod(block_shape), + * input_shape[1], ..., input_shape[N-1]] + *

+ * 2. Permute dimensions of `reshaped` to produce `permuted` of shape + * [batch / prod(block_shape), + *

+ * input_shape[1], block_shape[0], + * ..., + * input_shape[M], block_shape[M-1], + *

+ * input_shape[M+1], ..., input_shape[N-1]] + *

+ * 3. Reshape `permuted` to produce `reshaped_permuted` of shape + * [batch / prod(block_shape), + *

+ * input_shape[1] * block_shape[0], + * ..., + * input_shape[M] * block_shape[M-1], + *

+ * input_shape[M+1], + * ..., + * input_shape[N-1]] + *

+ * 4. Crop the start and end of dimensions `[1, ..., M]` of + * `reshaped_permuted` according to `crops` to produce the output of shape: + * [batch / prod(block_shape), + *

+ * input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1], + * ..., + * input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1], + *

+ * input_shape[M+1], ..., input_shape[N-1]] + *

+ * Some examples: + *

+ * (1) For the following input of shape `[4, 1, 1, 1]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [0, 0]]`: + *

{@code
+   *  [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+   *  }
+ * The output tensor has shape `[1, 2, 2, 1]` and value: + *
{@code
+   *  x = [[[[1], [2]], [[3], [4]]]]
+   *  }
+ * (2) For the following input of shape `[4, 1, 1, 3]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [0, 0]]`: + *
{@code
+   *  [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
+   *  }
+ * The output tensor has shape `[1, 2, 2, 3]` and value: + *
{@code
+   *  x = [[[[1, 2, 3], [4, 5, 6]],
+   *        [[7, 8, 9], [10, 11, 12]]]]
+   *  }
+ * (3) For the following input of shape `[4, 2, 2, 1]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [0, 0]]`: + *
{@code
+   *  x = [[[[1], [3]], [[9], [11]]],
+   *       [[[2], [4]], [[10], [12]]],
+   *       [[[5], [7]], [[13], [15]]],
+   *       [[[6], [8]], [[14], [16]]]]
+   *  }
+ * The output tensor has shape `[1, 4, 4, 1]` and value: + *
{@code
+   *  x = [[[[1],   [2],  [3],  [4]],
+   *       [[5],   [6],  [7],  [8]],
+   *       [[9],  [10], [11],  [12]],
+   *       [[13], [14], [15],  [16]]]]
+   *  }
+ * (4) For the following input of shape `[8, 1, 3, 1]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [2, 0]]`: + *
{@code
+   *  x = [[[[0], [1], [3]]], [[[0], [9], [11]]],
+   *       [[[0], [2], [4]]], [[[0], [10], [12]]],
+   *       [[[0], [5], [7]]], [[[0], [13], [15]]],
+   *       [[[0], [6], [8]]], [[[0], [14], [16]]]]
+   *  }
+ * The output tensor has shape `[2, 2, 4, 1]` and value: + *
{@code
+   *  x = [[[[1],   [2],  [3],  [4]],
+   *        [[5],   [6],  [7],  [8]]],
+   *       [[[9],  [10], [11],  [12]],
+   *        [[13], [14], [15],  [16]]]]
+   *  }
+ * @return a new instance of BatchToSpaceNd + */ + public BatchToSpaceNd batchToSpaceNd( + Operand input, Operand blockShape, Operand crops) { + return BatchToSpaceNd.create(scope, input, blockShape, crops); + } + + /** + * Bitcasts a tensor from one type to another without copying data. + *

+ * Given a tensor `input`, this operation returns a tensor that has the same buffer + * data as `input` with datatype `type`. + *

+ * If the input datatype `T` is larger than the output datatype `type` then the + * shape changes from [...] to [..., sizeof(`T`)/sizeof(`type`)]. + *

+ * If `T` is smaller than `type`, the operator requires that the rightmost + * dimension be equal to sizeof(`type`)/sizeof(`T`). The shape then goes from + * [..., sizeof(`type`)/sizeof(`T`)] to [...]. + *

+ * tf.bitcast() and tf.cast() work differently when real dtype is casted as a complex dtype + * (e.g. tf.complex64 or tf.complex128) as tf.cast() make imaginary part 0 while tf.bitcast() + * gives module error. + * For example, + *

+ * Example 1: + *

+ * >>> a = [1., 2., 3.] + * >>> equality_bitcast = tf.bitcast(a, tf.complex128) + * Traceback (most recent call last): + * ... + * InvalidArgumentError: Cannot bitcast from 1 to 18 [Op:Bitcast] + * >>> equality_cast = tf.cast(a, tf.complex128) + * >>> print(equality_cast) + * tf.Tensor([1.+0.j 2.+0.j 3.+0.j], shape=(3,), dtype=complex128) + *

+ * Example 2: + *

+ * >>> tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8) + * + *

+ * Example 3: + *

+ * >>> x = [1., 2., 3.] + * >>> y = [0., 2., 3.] + * >>> equality= tf.equal(x,y) + * >>> equality_cast = tf.cast(equality,tf.float32) + * >>> equality_bitcast = tf.bitcast(equality_cast,tf.uint8) + * >>> print(equality) + * tf.Tensor([False True True], shape=(3,), dtype=bool) + * >>> print(equality_cast) + * tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32) + * >>> print(equality_bitcast) + * tf.Tensor( + * [[ 0 0 0 0] + * [ 0 0 128 63] + * [ 0 0 128 63]], shape=(3, 4), dtype=uint8) + *

+ * NOTE: Bitcast is implemented as a low-level cast, so machines with different + * endian orderings will give different results. + * + * @param data type for {@code output()} output + * @param input + * @param type + * @return a new instance of Bitcast + */ + public Bitcast bitcast(Operand input, DataType type) { + return Bitcast.create(scope, input, type); + } + + /** + * Return the shape of s0 op s1 with broadcast. + *

+ * Given `s0` and `s1`, tensors that represent shapes, compute `r0`, the + * broadcasted shape. `s0`, `s1` and `r0` are all integer vectors. + * + * @param data type for {@code r0()} output + * @param s0 + * @param s1 + * @return a new instance of BroadcastDynamicShape + */ + public BroadcastDynamicShape broadcastDynamicShape(Operand s0, + Operand s1) { + return BroadcastDynamicShape.create(scope, s0, s1); + } + + /** + * Broadcast an array for a compatible shape. + *

+ * Broadcasting is the process of making arrays to have compatible shapes + * for arithmetic operations. Two shapes are compatible if for each + * dimension pair they are either equal or one of them is one. When trying + * to broadcast a Tensor to a shape, it starts with the trailing dimensions, + * and works its way forward. + *

+ * For example, + *

+ * >>> x = tf.constant([1, 2, 3]) + * >>> y = tf.broadcast_to(x, [3, 3]) + * >>> print(y) + * tf.Tensor( + * [[1 2 3] + * [1 2 3] + * [1 2 3]], shape=(3, 3), dtype=int32) + *

+ * In the above example, the input Tensor with the shape of `[1, 3]` + * is broadcasted to output Tensor with shape of `[3, 3]`. + * + * @param data type for {@code output()} output + * @param input A Tensor to broadcast. + * @param shape An 1-D `int` Tensor. The shape of the desired output. + * @return a new instance of BroadcastTo + */ + public BroadcastTo broadcastTo(Operand input, + Operand shape) { + return BroadcastTo.create(scope, input, shape); + } + + /** + * Bucketizes 'input' based on 'boundaries'. + *

+ * For example, if the inputs are + * boundaries = [0, 10, 100] + * input = [[-5, 10000] + * [150, 10] + * [5, 100]] + *

+ * then the output will be + * output = [[0, 3] + * [3, 2] + * [1, 3]] + * + * @param input Any shape of Tensor contains with int or float type. + * @param boundaries A sorted list of floats gives the boundary of the buckets. + * @return a new instance of Bucketize + */ + public Bucketize bucketize(Operand input, List boundaries) { + return Bucketize.create(scope, input, boundaries); + } + + /** + * Clips tensor values to a specified min and max. + *

+ * Given a tensor `t`, this operation returns a tensor of the same type and + * shape as `t` with its values clipped to `clip_value_min` and `clip_value_max`. + * Any values less than `clip_value_min` are set to `clip_value_min`. Any values + * greater than `clip_value_max` are set to `clip_value_max`. + * + * @param data type for {@code output()} output + * @param t A `Tensor`. + * @param clipValueMin A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape + * as `t`. The minimum value to clip by. + * @param clipValueMax A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape + * as `t`. The maximum value to clip by. + * @return a new instance of ClipByValue + */ + public ClipByValue clipByValue(Operand t, Operand clipValueMin, + Operand clipValueMax) { + return ClipByValue.create(scope, t, clipValueMin, clipValueMax); + } + + /** + * Concatenates tensors along one dimension. + * + * @param data type for {@code output()} output + * @param values List of `N` Tensors to concatenate. Their ranks and types must match, + * and their sizes must match in all dimensions except `concat_dim`. + * @param axis 0-D. The dimension along which to concatenate. Must be in the + * range [-rank(values), rank(values)). + * @return a new instance of Concat + */ + public Concat concat(Iterable> values, + Operand axis) { + return Concat.create(scope, values, axis); + } + + /** + * Creates a rank-1 constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return an integer constant + */ + public Constant constant(int[] data) { + return Constant.vectorOf(scope, data); + } + + /** + * Creates a rank-3 constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return an integer constant + */ + public Constant constant(int[][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant containing a single {@code double} element. + * + * @param scope is a scope used to add the underlying operation. + * @param data The value to put into the new constant. + * @return a double constant + */ + public Constant constant(double data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a rank-5 constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a long constant + */ + public Constant constant(long[][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-5 constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a boolean constant + */ + public Constant constant(boolean[][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-4 constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return an integer constant + */ + public Constant constant(int[][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-6 constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a float constant + */ + public Constant constant(float[][][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant of {@code String} elements that is a copy of a given n-dimensional array, + * using the default UTF-8 encoding. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code String} elements. + * @return a string constant + */ + public Constant constant(NdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant containing a single {@code byte} element. + * + * @param scope is a scope used to add the underlying operation. + * @param data The value to put into the new constant. + * @return a byte constant + */ + public Constant constant(byte data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a constant of {@code double} elements that is a copy of a given n-dimensional array. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code double} elements. + * @return a double constant + */ + public Constant constant(DoubleNdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-3 constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a boolean constant + */ + public Constant constant(boolean[][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-4 constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a float constant + */ + public Constant constant(float[][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-2 constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a long constant + */ + public Constant constant(long[][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant of {@code long} elements that is a copy of a given n-dimensional array. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code long} elements. + * @return a long constant + */ + public Constant constant(LongNdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-5 constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a byte constant + */ + public Constant constant(byte[][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-2 constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a float constant + */ + public Constant constant(float[][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-2 constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a byte constant + */ + public Constant constant(byte[][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-5 constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a double constant + */ + public Constant constant(double[][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-3 constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a float constant + */ + public Constant constant(float[][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-1 constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a byte constant + */ + public Constant constant(byte[] data) { + return Constant.vectorOf(scope, data); + } + + /** + * Creates a rank-1 constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a float constant + */ + public Constant constant(float[] data) { + return Constant.vectorOf(scope, data); + } + + /** + * Creates a rank-2 constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a boolean constant + */ + public Constant constant(boolean[][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant of {@code byte} elements that is a copy of a given n-dimensional array. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code byte} elements. + * @return a byte constant + */ + public Constant constant(ByteNdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant of {@code int} elements that is a copy of a given n-dimensional array. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code int} elements. + * @return an integer constant + */ + public Constant constant(IntNdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a {@code String} constant using the default, UTF-8 encoding. + * + * @param scope is a scope used to add the underlying operation. + * @param data The string to put into the new constant. + * @return a string constant + */ + public Constant constant(String data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a rank-4 constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a double constant + */ + public Constant constant(double[][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-2 constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a double constant + */ + public Constant constant(double[][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant containing a single {@code int} element. + * + * @param scope is a scope used to add the underlying operation. + * @param data The value to put into the new constant. + * @return an integer constant + */ + public Constant constant(int data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a rank-4 constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a byte constant + */ + public Constant constant(byte[][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-6 constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return an integer constant + */ + public Constant constant(int[][][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant containing a single {@code long} element. + * + * @param scope is a scope used to add the underlying operation. + * @param data The value to put into the new constant. + * @return a long constant + */ + public Constant constant(long data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a constant containing a single {@code float} element. + * + * @param scope is a scope used to add the underlying operation. + * @param data The value to put into the new constant. + * @return a float constant + */ + public Constant constant(float data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a rank-5 constant of {@code float} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a float constant + */ + public Constant constant(float[][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-3 constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a double constant + */ + public Constant constant(double[][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-6 constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a long constant + */ + public Constant constant(long[][][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-4 constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a long constant + */ + public Constant constant(long[][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-1 constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a long constant + */ + public Constant constant(long[] data) { + return Constant.vectorOf(scope, data); + } + + /** + * Creates a rank-1 constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a boolean constant + */ + public Constant constant(boolean[] data) { + return Constant.vectorOf(scope, data); + } + + /** + * Creates a rank-3 constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a byte constant + */ + public Constant constant(byte[][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-6 constant of {@code byte} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a byte constant + */ + public Constant constant(byte[][][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-2 constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return an integer constant + */ + public Constant constant(int[][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-5 constant of {@code int} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return an integer constant + */ + public Constant constant(int[][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant of {@code float} elements that is a copy of a given n-dimensional array. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code float} elements. + * @return a float constant + */ + public Constant constant(FloatNdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-1 constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a double constant + */ + public Constant constant(double[] data) { + return Constant.vectorOf(scope, data); + } + + /** + * Creates a rank-6 constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a boolean constant + */ + public Constant constant(boolean[][][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-6 constant of {@code double} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a double constant + */ + public Constant constant(double[][][][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant containing a single {@code boolean} element. + * + * @param scope is a scope used to add the underlying operation. + * @param data The value to put into the new constant. + * @return a boolean constant + */ + public Constant constant(boolean data) { + return Constant.scalarOf(scope, data); + } + + /** + * Creates a rank-4 constant of {@code boolean} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a boolean constant + */ + public Constant constant(boolean[][][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-3 constant of {@code long} elements. + * + * @param scope is a scope used to add the underlying operation. + * @param data An array containing the values to put into the new constant. The dimensions of the + * new constant will match those of the array. + * @return a long constant + */ + public Constant constant(long[][][] data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a constant of {@code boolean} elements that is a copy of a given n-dimensional array. + * + * @param scope is a scope used to add the underlying operation. + * @param data an n-dimensional array of {@code boolean} elements. + * @return a boolean constant + */ + public Constant constant(BooleanNdArray data) { + return Constant.tensorOf(scope, data); + } + + /** + * Creates a rank-1 constant of {@code long} elements representing the size of each dimensions of + * the given shape. + * + * @param scope is a scope used to add the underlying operation. + * @param shape a shape + * @return a long constant + */ + public Constant constant(Shape shape) { + return Constant.tensorOf(scope, shape); + } + + /** + * Create a constant from a Tensor. + * + * @param scope is a scope used to add the underlying operation. + * @param tensor a Tensor holding the constant value + * @return a constant of the same data type as `tensor` + */ + public Constant constant(Tensor tensor) { + return Constant.create(scope, tensor); + } + + /** + * Creates a constant of {@code String} elements, using the given charset. + * + * @param scope is a scope used to add the underlying operation. + * @param charset charset for encoding/decoding strings bytes. + * @param data An array containing the values to put into the new constant. String elements are + * sequences of bytes from the last array dimension. + * @return the {@code String} constant + */ + public Constant constant(Charset charset, String[] data) { + return Constant.vectorOf(scope, charset, data); + } + + /** + * Creates a {@code String} constant using a specified encoding. + * + * @param scope is a scope used to add the underlying operation. + * @param charset The encoding from String to bytes. + * @param data The string to put into the new constant. + * @return a string constant + */ + public Constant constant(Charset charset, String data) { + return Constant.scalarOf(scope, charset, data); + } + + /** + * Creates a constant of {@code String} elements that is a copy of a given n-dimensional array, + * using the given encoding. + * + * @param scope is a scope used to add the underlying operation. + * @param charset charset used to encode/decode string bytes. + * @param data an n-dimensional array of {@code String} elements. + * @return a string constant + */ + public Constant constant(Charset charset, NdArray data) { + return Constant.tensorOf(scope, charset, data); + } + + /** + * Create a {@link TInt32} constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return an integer constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, IntDataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TFloat64} constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a double constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, DoubleDataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TBool} constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return an boolean constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, BooleanDataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TFloat32} constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a float constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, FloatDataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TInt64} constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a long constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, LongDataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TUint8} constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a byte constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, ByteDataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TString} constant with data from the given buffer, using the default UTF-8 + * encoding. + * + * @param scope is a scope used to add the underlying operation. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a string constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Shape shape, DataBuffer data) { + return Constant.tensorOf(scope, shape, data); + } + + /** + * Create a {@link TString} constant with data from the given buffer, using the given encoding. + * + * @param scope is a scope used to add the underlying operation. + * @param charset charset used to encode/decode string bytes. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a string constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + */ + public Constant constant(Charset charset, Shape shape, DataBuffer data) { + return Constant.tensorOf(scope, charset, shape, data); + } + + /** + * Create a constant with data from the given buffer. + * + * @param scope is a scope used to add the underlying operation. + * @param type the tensor datatype. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a constant of type `type` + * @throws IllegalArgumentException If the tensor datatype or shape is not compatible with the + * buffer + */ + public Constant constant(DataType type, Shape shape, + ByteDataBuffer data) { + return Constant.tensorOf(scope, type, shape, data); + } + + /** + * This op consumes a lock created by `MutexLock`. + *

+ * This op exists to consume a tensor created by `MutexLock` (other than + * direct control dependencies). It should be the only that consumes the tensor, + * and will raise an error if it is not. Its only purpose is to keep the + * mutex lock tensor alive until it is consumed by this op. + *

+ * NOTE: This operation must run on the same device as its input. This may + * be enforced via the `colocate_with` mechanism. + * + * @param mutexLock A tensor returned by `MutexLock`. + * @return a new instance of ConsumeMutexLock + */ + public ConsumeMutexLock consumeMutexLock(Operand mutexLock) { + return ConsumeMutexLock.create(scope, mutexLock); + } + + /** + * Does nothing. Serves as a control trigger for scheduling. + *

+ * Only useful as a placeholder for control edges. + * + * @return a new instance of ControlTrigger + */ + public ControlTrigger controlTrigger() { + return ControlTrigger.create(scope); + } + + /** + * Increments 'ref' until it reaches 'limit'. + * + * @param data type for {@code output()} output + * @param ref Should be from a scalar `Variable` node. + * @param limit If incrementing ref would bring it above limit, instead generates an + * 'OutOfRange' error. + * @return a new instance of CountUpTo + */ + public CountUpTo countUpTo(Operand ref, Long limit) { + return CountUpTo.create(scope, ref, limit); + } + + /** + * Makes a copy of `x`. + * + * @param data type for {@code y()} output + * @param x The source tensor of type `T`. + * @return a new instance of DeepCopy + */ + public DeepCopy deepCopy(Operand x) { + return DeepCopy.create(scope, x); + } + + /** + * Delete the tensor specified by its handle in the session. + * + * @param handle The handle for a tensor stored in the session state. + * @return a new instance of DeleteSessionTensor + */ + public DeleteSessionTensor deleteSessionTensor(Operand handle) { + return DeleteSessionTensor.create(scope, handle); + } + + /** + * Deletes the resource specified by the handle. + *

+ * All subsequent operations using the resource will result in a NotFound + * error status. + * + * @param resource handle to the resource to delete. + * @param options carries optional attributes values + * @return a new instance of DestroyResourceOp + */ + public DestroyResourceOp destroyResourceOp(Operand resource, + DestroyResourceOp.Options... options) { + return DestroyResourceOp.create(scope, resource, options); + } + + /** + * Destroys the temporary variable and returns its final value. + *

+ * Sets output to the value of the Tensor pointed to by 'ref', then destroys + * the temporary variable called 'var_name'. + * All other uses of 'ref' must have executed before this op. + * This is typically achieved by chaining the ref through each assign op, or by + * using control dependencies. + *

+ * Outputs the final value of the tensor pointed to by 'ref'. + * + * @param data type for {@code value()} output + * @param ref A reference to the temporary variable tensor. + * @param varName Name of the temporary variable, usually the name of the matching + * 'TemporaryVariable' op. + * @return a new instance of DestroyTemporaryVariable + */ + public DestroyTemporaryVariable destroyTemporaryVariable(Operand ref, + String varName) { + return DestroyTemporaryVariable.create(scope, ref, varName); + } + + /** + * Partitions `data` into `num_partitions` tensors using indices from `partitions`. + *

+ * For each index tuple `js` of size `partitions.ndim`, the slice `data[js, ...]` + * becomes part of `outputs[partitions[js]]`. The slices with `partitions[js] = i` + * are placed in `outputs[i]` in lexicographic order of `js`, and the first + * dimension of `outputs[i]` is the number of entries in `partitions` equal to `i`. + * In detail, + *

{@code
+   *      outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:]
+   *
+   *      outputs[i] = pack([data[js, ...] for js if partitions[js] == i])
+   *  }
+ * `data.shape` must start with `partitions.shape`. + *

+ * For example: + *

{@code
+   *      # Scalar partitions.
+   *      partitions = 1
+   *      num_partitions = 2
+   *      data = [10, 20]
+   *      outputs[0] = []  # Empty with shape [0, 2]
+   *      outputs[1] = [[10, 20]]
+   *
+   *      # Vector partitions.
+   *      partitions = [0, 0, 1, 1, 0]
+   *      num_partitions = 2
+   *      data = [10, 20, 30, 40, 50]
+   *      outputs[0] = [10, 20, 50]
+   *      outputs[1] = [30, 40]
+   *  }
+ * See `dynamic_stitch` for an example on how to merge partitions back. + *

+ *

+ * + *
+ * + * @param data type for {@code outputs()} output + * @param data + * @param partitions Any shape. Indices in the range `[0, num_partitions)`. + * @param numPartitions The number of partitions to output. + * @return a new instance of DynamicPartition + */ + public DynamicPartition dynamicPartition(Operand data, + Operand partitions, Long numPartitions) { + return DynamicPartition.create(scope, data, partitions, numPartitions); + } + + /** + * Interleave the values from the `data` tensors into a single tensor. + *

+ * Builds a merged tensor such that + *

{@code
+   *      merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
+   *  }
+ * For example, if each `indices[m]` is scalar or vector, we have + *
{@code
+   *      # Scalar indices:
+   *      merged[indices[m], ...] = data[m][...]
+   *
+   *      # Vector indices:
+   *      merged[indices[m][i], ...] = data[m][i, ...]
+   *  }
+ * Each `data[i].shape` must start with the corresponding `indices[i].shape`, + * and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we + * must have `data[i].shape = indices[i].shape + constant`. In terms of this + * `constant`, the output shape is + *

+ * merged.shape = [max(indices)] + constant + *

+ * Values are merged in order, so if an index appears in both `indices[m][i]` and + * `indices[n][j]` for `(m,i) < (n,j)` the slice `data[n][j]` will appear in the + * merged result. If you do not need this guarantee, ParallelDynamicStitch might + * perform better on some devices. + *

+ * For example: + *

{@code
+   *      indices[0] = 6
+   *      indices[1] = [4, 1]
+   *      indices[2] = [[5, 2], [0, 3]]
+   *      data[0] = [61, 62]
+   *      data[1] = [[41, 42], [11, 12]]
+   *      data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
+   *      merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
+   *                [51, 52], [61, 62]]
+   *  }
+ * This method can be used to merge partitions created by `dynamic_partition` + * as illustrated on the following example: + *
{@code
+   *      # Apply function (increments x_i) on elements for which a certain condition
+   *      # apply (x_i != -1 in this example).
+   *      x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
+   *      condition_mask=tf.not_equal(x,tf.constant(-1.))
+   *      partitioned_data = tf.dynamic_partition(
+   *          x, tf.cast(condition_mask, tf.int32) , 2)
+   *      partitioned_data[1] = partitioned_data[1] + 1.0
+   *      condition_indices = tf.dynamic_partition(
+   *          tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
+   *      x = tf.dynamic_stitch(condition_indices, partitioned_data)
+   *      # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
+   *      # unchanged.
+   *  }
+ *
+ * + *
+ * + * @param data type for {@code merged()} output + * @param indices + * @param data + * @return a new instance of DynamicStitch + */ + public DynamicStitch dynamicStitch(Iterable> indices, + Iterable> data) { + return DynamicStitch.create(scope, indices, data); + } + + /** + * Computes the (possibly normalized) Levenshtein Edit Distance. + *

+ * The inputs are variable-length sequences provided by SparseTensors + * (hypothesis_indices, hypothesis_values, hypothesis_shape) + * and + * (truth_indices, truth_values, truth_shape). + *

+ * The inputs are: + * + * @param hypothesisIndices The indices of the hypothesis list SparseTensor. + * This is an N x R int64 matrix. + * @param hypothesisValues The values of the hypothesis list SparseTensor. + * This is an N-length vector. + * @param hypothesisShape The shape of the hypothesis list SparseTensor. + * This is an R-length vector. + * @param truthIndices The indices of the truth list SparseTensor. + * This is an M x R int64 matrix. + * @param truthValues The values of the truth list SparseTensor. + * This is an M-length vector. + * @param truthShape truth indices, vector. + * @param options carries optional attributes values + * @return a new instance of EditDistance + */ + public EditDistance editDistance(Operand hypothesisIndices, + Operand hypothesisValues, Operand hypothesisShape, Operand truthIndices, + Operand truthValues, Operand truthShape, EditDistance.Options... options) { + return EditDistance.create(scope, hypothesisIndices, hypothesisValues, hypothesisShape, truthIndices, truthValues, truthShape, options); + } + + /** + * Creates a tensor with the given shape. + *

+ * This operation creates a tensor of `shape` and `dtype`. + * + * @param data type for {@code output()} output + * @param shape 1-D. Represents the shape of the output tensor. + * @param dtype + * @param options carries optional attributes values + * @return a new instance of Empty + */ + public Empty empty(Operand shape, DataType dtype, + Empty.Options... options) { + return Empty.create(scope, shape, dtype, options); + } + + /** + * Creates and returns an empty tensor list. + *

+ * All list elements must be tensors of dtype element_dtype and shape compatible + * with element_shape. + *

+ * handle: an empty tensor list. + * element_dtype: the type of elements in the list. + * element_shape: a shape compatible with that of elements in the list. + * + * @param elementShape + * @param maxNumElements + * @param elementDtype + * @return a new instance of EmptyTensorList + */ + public EmptyTensorList emptyTensorList( + Operand elementShape, Operand maxNumElements, DataType elementDtype) { + return EmptyTensorList.create(scope, elementShape, maxNumElements, elementDtype); + } + + /** + * Ensures that the tensor's shape matches the expected shape. + *

+ * Raises an error if the input tensor's shape does not match the specified shape. + * Returns the input tensor otherwise. + * + * @param data type for {@code output()} output + * @param input A tensor, whose shape is to be validated. + * @param shape The expected (possibly partially specified) shape of the input tensor. + * @return a new instance of EnsureShape + */ + public EnsureShape ensureShape(Operand input, Shape shape) { + return EnsureShape.create(scope, input, shape); + } + + /** + * Inserts a dimension of 1 into a tensor's shape. + *

+ * Given a tensor `input`, this operation inserts a dimension of 1 at the + * dimension index `axis` of `input`'s shape. The dimension index `axis` starts at + * zero; if you specify a negative number for `axis` it is counted backward from + * the end. + *

+ * This operation is useful if you want to add a batch dimension to a single + * element. For example, if you have a single image of shape `[height, width, + * channels]`, you can make it a batch of 1 image with `expand_dims(image, 0)`, + * which will make the shape `[1, height, width, channels]`. + *

+ * Other examples: + *

{@code
+   *  # 't' is a tensor of shape [2]
+   *  shape(expand_dims(t, 0)) ==> [1, 2]
+   *  shape(expand_dims(t, 1)) ==> [2, 1]
+   *  shape(expand_dims(t, -1)) ==> [2, 1]
+   *
+   *  # 't2' is a tensor of shape [2, 3, 5]
+   *  shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
+   *  shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
+   *  shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]
+   *  }
+ * This operation requires that: + *

+ * `-1-input.dims() <= dim <= input.dims()` + *

+ * This operation is related to `squeeze()`, which removes dimensions of + * size 1. + * + * @param data type for {@code output()} output + * @param input + * @param axis 0-D (scalar). Specifies the dimension index at which to + * expand the shape of `input`. Must be in the range + * `[-rank(input) - 1, rank(input)]`. + * @return a new instance of ExpandDims + */ + public ExpandDims expandDims(Operand input, + Operand axis) { + return ExpandDims.create(scope, input, axis); + } + + /** + * Extract `patches` from `input` and put them in the "depth" output dimension. 3D extension of `extract_image_patches`. + * + * @param data type for {@code patches()} output + * @param input 5-D Tensor with shape `[batch, in_planes, in_rows, in_cols, depth]`. + * @param ksizes The size of the sliding window for each dimension of `input`. + * @param strides 1-D of length 5. How far the centers of two consecutive patches are in + * `input`. Must be: `[1, stride_planes, stride_rows, stride_cols, 1]`. + * @param padding The type of padding algorithm to use. + *

+ * We specify the size-related attributes as: + *

{@code
+   *        ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1]
+   *        strides = [1, stride_planes, strides_rows, strides_cols, 1]
+   *  }
+ * @return a new instance of ExtractVolumePatches + */ + public ExtractVolumePatches extractVolumePatches(Operand input, + List ksizes, List strides, String padding) { + return ExtractVolumePatches.create(scope, input, ksizes, strides, padding); + } + + /** + * Creates a tensor filled with a scalar value. + *

+ * This operation creates a tensor of shape `dims` and fills it with `value`. + *

+ * For example: + *

{@code
+   *  # Output tensor has shape [2, 3].
+   *  fill([2, 3], 9) ==> [[9, 9, 9]
+   *                       [9, 9, 9]]
+   *  }
+ * `tf.fill` differs from `tf.constant` in a few ways: + *