Jasig / jspc-maven-plugin

UNMAINTAINED Maven plugin that compiles JSPs
http://unmaintained.tech/
Apache License 2.0
24 stars 38 forks source link

Compile error with "Comparator" and sourceVersion 1.8 #31

Closed muffl0n closed 7 years ago

muffl0n commented 8 years ago

When trying to compile the JSPs in my webapp that relies on Java sourceVersion 1.8 I'm getting this error message:

[ERROR] An error occurred at line: 32 in the jsp file: /foo/bar.jsp
[ERROR] The type new Comparator<RoundVO>(){} must implement the inherited abstract method Comparator<RoundVO>.thenComparing(Function<? super RoundVO,? extends U>)
[ERROR] 29:
[ERROR] 30: <%
[ERROR] 31:     List<RoundVO> sortedRounds = new ArrayList<RoundVO>((Collection<RoundVO>) pageContext.getAttribute("rounds"));
[ERROR] 32:     Collections.sort(sortedRounds, new Comparator<RoundVO>() {
[ERROR] 33:             public int compare(RoundVO round1, RoundVO round2) {
[...]

/foo/bar.jsp:

<%
    List<RoundVO> sortedRounds = new ArrayList<RoundVO>((Collection<RoundVO>) pageContext.getAttribute("rounds"));
    Collections.sort(sortedRounds, new Comparator<RoundVO>() {
        public int compare(RoundVO round1, RoundVO round2) {
            [...]
        }
    });
    pageContext.setAttribute("sortedRounds", sortedRounds);
%>

This is the configuration in pom.xml:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jasig.mojo.jspc</groupId>
                <artifactId>jspc-maven-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <includeInProject>false</includeInProject>
                    <showSuccess>false</showSuccess>
                    <caching>false</caching>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jasig.mojo.jspc</groupId>
                        <artifactId>jspc-compiler-tomcat7</artifactId>
                        <version>2.0.2</version>
                    </dependency>
                </dependencies>
            </plugin>

When using jspc-maven-plugin with version 2.0.0 everything runs fine.

Something I found is this thread: http://stackoverflow.com/questions/28203243/not-implementing-all-the-methods-of-an-interface

ChristianMurphy commented 7 years ago

Thanks for reporting this @muffl0n! Would you be willing to create a pull request resolving the issue?

muffl0n commented 7 years ago

I can't reproduce this anymore. The problem only occured in Eclipse and I think I solved it by manually setting the "source level" to 1.8.

I switched to IntelliJ and the problem (and several other problems ;)) just vanished.

Thanks for putting your time into this project! I will gladly help you out whenever I can!