Community
Participate
Working Groups
I'm trying to compile the following code with ajc through the Maven compiler plugin: ~~ Main.java ~~ public class Main { public static void main(String[] args) { List<DataStore> list = new LinkedList<>(); list.add(null); list.add(null); list.add(null); list.add(null); list.add(null); List<DataStore> integersPlusOne = list.stream().map(store -> new DataStore() { @Override public void connect() { } @Override public void disconnect() { } @Override public void write(UUID value) { } @Override public List<String> read(String value) { return null; } }).collect(Collectors.toList()); } } But it does not compile with the following error message: Type mismatch: cannot convert from List<Object> to List<DataStore> It compiles fine when I run it through javac. Here is the DataStore class, and my POM. ~~ DataStore.java ~~ public interface DataStore { public void connect(); public void disconnect(); public void write(UUID value); public List<String> read(String value); } ~~~ pom.xml ~~~ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>minimal-aspectj</groupId> <artifactId>minimal</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>8</source> <target>8</target> </configuration> </plugin> </plugins> </build> <profiles> <profile> <id>aspectj</id> <activation> <property> <name>aspectj</name> </property> </activation> <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.9.3.RC1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.11</version> <configuration> <complianceLevel>1.8</complianceLevel> <source>1.8</source> <target>1.8</target> <showWeaveInfo>true</showWeaveInfo> <verbose>true</verbose> <Xlint>ignore</Xlint> <encoding>UTF-8 </encoding> <weaveDependencies> </weaveDependencies> </configuration> <executions> <execution> <id>compile</id> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> <phase>compile</phase> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>