-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi,
I am trying to automatize the process of generating test oracles with Toga, for a given project.
However, I got an AttributeError: module 'javalang.parser' has no attribute 'LexerError' when I try to generate oracles for a given class. I have 81 triplets of focal methods, test prefixes, and docstrings (corresponding to 81 rows in the input.csv file). 1 of them raise this exception. I would want to understand the meaning of this error and the cause (it's not clear to me, analyzing the stack trace, the focal method, and the test prefix).
I attach the input.csv and metadata.csv files for replicability. The rows that triggers the error is the following (row 46 of the csv, from line 790 to line 804 - test4545):
"public boolean getUseSeriesOffset() {}","public void test4545() throws Throwable {
DefaultCategoryItemRenderer defaultCategoryItemRenderer0 = new DefaultCategoryItemRenderer();
StandardCategoryURLGenerator standardCategoryURLGenerator0 = new StandardCategoryURLGenerator('Null 'stroke' argument.', 'l', 'P');
defaultCategoryItemRenderer0.setSeriesURLGenerator(1607, (CategoryURLGenerator) standardCategoryURLGenerator0, false);
assertFalse(defaultCategoryItemRenderer0.getUseSeriesOffset());
}"," /**
* Returns the flag that controls whether or not the x-position for each
* data item is offset within the category according to the series.
*
* @return A boolean.
*
* @see #setUseSeriesOffset(boolean)
*
* @since 1.0.7
*/"
The stack trace of the error is the following:
Traceback (most recent call last):
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1345, in parse_block_statement
statement = self.parse_local_variable_declaration_statement()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1355, in parse_local_variable_declaration_statement
declarators = self.parse_variable_declarators()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1207, in parse_variable_declarators
declarator = self.parse_variable_declarator()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1218, in parse_variable_declarator
array_dimension, initializer = self.parse_variable_declarator_rest()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1230, in parse_variable_declarator_rest
initializer = self.parse_variable_initializer()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1239, in parse_variable_initializer
return self.parse_expression()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1773, in parse_expression
expressionl = self.parse_expressionl()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1788, in parse_expressionl
expression_2 = self.parse_expression_2()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1814, in parse_expression_2
expression_3 = self.parse_expression_3()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1870, in parse_expression_3
primary = self.parse_primary()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1972, in parse_primary
return self.parse_creator()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 2120, in parse_creator
arguments, body = self.parse_class_creator_rest()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 2147, in parse_class_creator_rest
arguments = self.parse_arguments()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 2052, in parse_arguments
self.accept(')')
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 131, in accept
self.illegal("Expected '%s'" % (accept,))
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 119, in illegal
raise JavaSyntaxError(description, at)
javalang.parser.JavaSyntaxError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/darthdaver/Documents/phd/repositories/toga/model/assertion_data.py", line 128, in get_type_info_evo
test_method_node = parser.parse_member_declaration()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 801, in parse_member_declaration
member = self.parse_void_method_declarator_rest()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 905, in parse_void_method_declarator_rest
body = self.parse_block()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1274, in parse_block
statement = self.parse_block_statement()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1349, in parse_block_statement
return self.parse_statement()
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 1542, in parse_statement
self.accept(';')
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 131, in accept
self.illegal("Expected '%s'" % (accept,))
File "/Users/darthdaver/Downloads/toga/lib/python3.9/site-packages/javalang/parser.py", line 119, in illegal
raise JavaSyntaxError(description, at)
javalang.parser.JavaSyntaxError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/darthdaver/Documents/phd/repositories/toga/toga.py", line 232, in <module>
main()
File "/Users/darthdaver/Documents/phd/repositories/toga/toga.py", line 86, in main
method_test_assert_data, idxs = assertion_data.get_model_inputs(tests, methods, vocab)
File "/Users/darthdaver/Documents/phd/repositories/toga/model/assertion_data.py", line 303, in get_model_inputs
out = get_type_info_evo(assertion, focal_method, test_method, vocab=vocab)
File "/Users/darthdaver/Documents/phd/repositories/toga/model/assertion_data.py", line 130, in get_type_info_evo
javalang.parser.LexerError):
AttributeError: module 'javalang.parser' has no attribute 'LexerError'
If I remove that triplet of focal methods, test prefix and docstring, everything works fine. The problem is that I have different projects to analyze and I want to automatize the process, and process a single triplet at a time is infeasible. I want to understand how can I fix the error, understand if the nature is due to toga or the project.
Thank you in advance!