List of usage examples for org.eclipse.jdt.core.dom ArrayCreation DIMENSIONS_PROPERTY
ChildListPropertyDescriptor DIMENSIONS_PROPERTY
To view the source code for org.eclipse.jdt.core.dom ArrayCreation DIMENSIONS_PROPERTY.
Click Source Link
From source file:org.evosuite.junit.TestExtractingVisitor.java
License:Open Source License
private VariableReference retrieveVariableReference(ArrayCreation arrayCreation) { Class<?> arrayType = retrieveTypeClass(arrayCreation.getType()); List<?> dimensions = ((AbstractList<?>) arrayCreation .getStructuralProperty(ArrayCreation.DIMENSIONS_PROPERTY)); if (dimensions.size() > 1) { throw new RuntimeException("Multidimensional arrays not implemented!"); }/* www . j a v a 2 s . c om*/ Integer length = (Integer) ((NumberLiteral) dimensions.get(0)).resolveConstantExpressionValue(); // ArrayReference arrayReference = new // ValidArrayReference(testCase.getReference(), arrayType, length); ArrayStatement arrayAssignment = new ArrayStatement(testCase.getReference(), arrayType, length); testCase.addStatement(arrayAssignment); return arrayAssignment.getReturnValue(); }