An issue I keep running into in the Groovy editor is that static imports get mangled when using content assist or pasting a block of code that modifies the imports. I have a small example below that should demonstrate the issue. When trying to add "@TypeChecked" using content assist, the static import is cut off, resulting in compiler errors. (I am using 2.9.2 in MarsSR2.)
Before (cursor is after TypeCh and content assist is used to complete):
import static org.mockito.Mockito.mock
import org.junit.Test
@TypeCh
final class WeakReferenceSetTests {
@Test
void testAddAndEmpty() {
WeakReferenceSet set = new WeakReferenceSet()
assert set.empty
set << mock(ConcreteType)
assert !set.empty
}
}
After (notice the ".mock" has been removed from the static import):
import static org.mockito.Mockito
import groovy.transform.TypeChecked;
import org.junit.Test
@TypeChecked
final class WeakReferenceSetTests
{
@Test
void testAddAndEmpty() {
WeakReferenceSet set = new WeakReferenceSet()
assert set.empty
set << mock(ConcreteType)
assert !set.empty
}
}
Also, the import keystroke (Ctrl-Shift-M) does not seem to be working for Groovy files. Is this supposed to work or is it unimplemented?
An issue I keep running into in the Groovy editor is that static imports get mangled when using content assist or pasting a block of code that modifies the imports. I have a small example below that should demonstrate the issue. When trying to add "@TypeChecked" using content assist, the static import is cut off, resulting in compiler errors. (I am using 2.9.2 in MarsSR2.)
Before (cursor is after TypeCh and content assist is used to complete):
After (notice the ".mock" has been removed from the static import):
Also, the import keystroke (Ctrl-Shift-M) does not seem to be working for Groovy files. Is this supposed to work or is it unimplemented?