Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 36 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
Expand All @@ -18,14 +17,13 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<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>

<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>37</version>
<version>39</version>
<relativePath />
</parent>

Expand All @@ -37,15 +35,21 @@ under the License.
<description>The Compiler Plugin is used to compile the sources of your project.</description>
<inceptionYear>2001</inceptionYear>

<contributors>
<contributor>
<name>Jan Sievers</name>
</contributor>
</contributors>

<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>

<scm>
<connection>scm:git:https://github.com/apache/maven-compiler-plugin.git</connection>
<developerConnection>scm:git:https://github.com/apache/maven-compiler-plugin.git</developerConnection>
<url>https://github.com/apache/maven-compiler-plugin/tree/${project.scm.tag}</url>
<tag>maven-compiler-plugin-3.10.0</tag>
<url>https://github.com/apache/maven-compiler-plugin/tree/${project.scm.tag}</url>
</scm>
<issueManagement>
<system>JIRA</system>
Expand Down Expand Up @@ -80,25 +84,6 @@ under the License.
<invoker.junitPackageName>org.apache.maven.plugins.compiler.its</invoker.junitPackageName>
</properties>

<contributors>
<contributor>
<name>Jan Sievers</name>
</contributor>
</contributors>

<repositories>
<repository>
<id>plexus.snapshots</id>
<url>https://oss.sonatype.org/content/repositories/plexus-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -145,16 +130,16 @@ under the License.
<version>1.1</version>
<exclusions>
<exclusion>
<artifactId>maven-core</artifactId>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</exclusion>
<exclusion>
<artifactId>maven-plugin-api</artifactId>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</exclusion>
<exclusion>
<artifactId>maven-shared-utils</artifactId>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -209,12 +194,36 @@ under the License.
</dependency>
</dependencies>

<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>plexus.snapshots</id>
<url>https://oss.sonatype.org/content/repositories/plexus-snapshots</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<java>
<includes>
<include>src/**/*.java</include>
</includes>
</java>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
44 changes: 21 additions & 23 deletions src/it/MCOMPILER-129/src/main/java/MyClass.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

public class MyClass
{

}
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package foo;

public class MyClass {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.issue;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.issue;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand All @@ -26,6 +25,4 @@

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface SimpleAnnotation {

}
public @interface SimpleAnnotation {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.issue;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,10 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import java.io.IOException;
import java.io.Writer;
import java.util.Set;
package org.issue;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
Expand All @@ -37,44 +32,39 @@
import javax.tools.FileObject;
import javax.tools.StandardLocation;

@SupportedSourceVersion( SourceVersion.RELEASE_6 )
@SupportedAnnotationTypes( "org.issue.SimpleAnnotation" )
public class SimpleAnnotationProcessor
extends AbstractProcessor
{
import java.io.IOException;
import java.io.Writer;
import java.util.Set;

@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedAnnotationTypes("org.issue.SimpleAnnotation")
public class SimpleAnnotationProcessor extends AbstractProcessor {

@Override
public boolean process( Set<? extends TypeElement> annotations, RoundEnvironment roundEnv )
{
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Filer filer = processingEnv.getFiler();

Elements elementUtils = processingEnv.getElementUtils();

Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith( SimpleAnnotation.class );
Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(SimpleAnnotation.class);

for ( Element element : elements )
{
for (Element element : elements) {
Name name = element.getSimpleName();

PackageElement packageElement = elementUtils.getPackageOf( element );
PackageElement packageElement = elementUtils.getPackageOf(element);

try
{
FileObject resource =
filer.createResource( StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(), name
+ ".txt", element );
try {
FileObject resource = filer.createResource(
StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(), name + ".txt", element);

Writer writer = resource.openWriter();
writer.write( name.toString() );
writer.write(name.toString());
writer.close();
}
catch ( IOException e )
{
throw new RuntimeException( e );
} catch (IOException e) {
throw new RuntimeException(e);
}
}

return !elements.isEmpty();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.issue;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,9 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.issue;

@SimpleAnnotation
public class SimpleObject
{

}
public class SimpleObject {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.issue;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,9 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.issue;

@SimpleAnnotation
public class SimpleTestObject
{

}
public class SimpleTestObject {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.plugins.compiler.it;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -8,45 +6,39 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.maven.plugins.compiler.it;

/**
* Hello world!
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
public class App {
public static void main(String[] args) {
System.out.println("Hello World!");
}

public static void mainFoo( String[] args )
{
System.out.println( "Hello World!" );
public static void mainFoo(String[] args) {
System.out.println("Hello World!");
}

public void bar( String[] args )
{
System.out.println( "Hello World!" );
public void bar(String[] args) {
System.out.println("Hello World!");
}

public void foo( String[] args )
{
System.out.println( "Hello World!" );
public void foo(String[] args) {
System.out.println("Hello World!");
}

public void barfoo( String[] args )
{
System.out.println( "Hello World!" );
public void barfoo(String[] args) {
System.out.println("Hello World!");
}
}
Loading