TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.17k stars 287 forks source link

Wrong line numbers and constructor call order #1236

Open esfomeado opened 7 months ago

esfomeado commented 7 months ago

Code sample:

1: public class Sample {
2:    public List<Object> getValues() {
3:         return List.of(
4:             new Integer( 0 ),
5:             new Long( 0 )
6:        );
7:     }
8: }

Now if I check the constructor calls from self on the getValues()

Set<JavaConstructorCall> constructorCallsFromSelf = javaMethod.getConstructorCallsFromSelf();

I will get in this case 3 method calls (List, Integer, Long) in a "random" order and not the order of declaration plus the getSourceCodeLocation().getLineNumber() for all of them will be line 3 instead of 3, 4 and 5.

Thanks