Skip to content

removing public modifier attempts to assign weaker access privileges #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pway99 opened this issue Mar 12, 2021 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@pway99
Copy link
Contributor

pway99 commented Mar 12, 2021

recipe removes public modifier from abstract m

setup()' in 'org.springframework.cloud.netflix.eureka.http.WebClientEurekaHttpClientTest' clashes with 'setup()' in 'org.springframework.cloud.netflix.eureka.http.AbstractEurekaHttpClientTest'; attempting to assign weaker access privileges ('package-private'); was 'public'

https://github.com/spring-cloud/spring-cloud-netflix/blob/8eb11b5730953daf53dd7a65286e82e5bda3ce5f/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java#L51

@pway99 pway99 added the bug Something isn't working label Mar 12, 2021
@kmccarp
Copy link
Contributor

kmccarp commented Mar 13, 2021

I am unable to recreate this. Here is the diff of WebClientEurekaHttpClientTest:

diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java
index 1bd615ac3..ce85a8a40 100644
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java
+++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java
@@ -19,8 +19,7 @@ package org.springframework.cloud.netflix.eureka.http;
 import com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider;
 import com.netflix.discovery.shared.resolver.DefaultEndpoint;
 import org.junit.Before;
-import org.junit.runner.RunWith;
-
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -28,13 +27,13 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
 import org.springframework.cloud.commons.util.InetUtils;
 import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
 import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
 import org.springframework.web.reactive.function.client.WebClient;
 
 /**
  * @author Daniel Lavoie
  */
-@RunWith(SpringJUnit4ClassRunner.class)
+@ExtendWith(SpringExtension.class)
 @SpringBootTest(classes = EurekaServerMockApplication.class,
 		properties = { "debug=true", "security.basic.enabled=true", "eureka.client.webclient.enabled=true" },
 		webEnvironment = WebEnvironment.RANDOM_PORT)

Here is my parent pom:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<artifactId>spring-cloud-netflix</artifactId>
	<version>3.0.2-SNAPSHOT</version>
	<packaging>pom</packaging>
	<name>Spring Cloud Netflix</name>
	<description>Spring Cloud Netflix</description>
	<parent>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-build</artifactId>
		<version>3.0.2-SNAPSHOT</version>
		<relativePath />
	</parent>
	<scm>
		<url>https://github.com/spring-cloud/spring-cloud-netflix</url>
		<connection>scm:git:git://github.com/spring-cloud/spring-cloud-netflix.git</connection>
		<developerConnection>scm:git:ssh://[email protected]/spring-cloud/spring-cloud-netflix.git</developerConnection>
		<tag>HEAD</tag>
	</scm>
	<properties>
		<bintray.package>netflix</bintray.package>
		<spring-cloud-commons.version>3.0.2-SNAPSHOT</spring-cloud-commons.version>
		<spring-cloud-config.version>3.0.3-SNAPSHOT</spring-cloud-config.version>

		<!-- Sonar -->
		<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
		<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
		<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
		<sonar.language>java</sonar.language>
		<eureka-jersey.version>1.19.4</eureka-jersey.version>

		<!-- rewrite -->
		<rewrite.version>7.0.0-SNAPSHOT</rewrite.version>
		<rewrite.spring.version>4.0.0-SNAPSHOT</rewrite.spring.version>
		<rewrite.maven-plugin.version>3.0.0-rc.6</rewrite.maven-plugin.version>

	</properties>
	<build>
		<plugins>
			<plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>${rewrite.maven-plugin.version}</version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.spring.Boot2JUnit4to5Migration</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-spring</artifactId>
                        <version>${rewrite.spring.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-core</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-java</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-java-8</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-maven</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-properties</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-maven</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-xml</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite</groupId>
                        <artifactId>rewrite-yaml</artifactId>
                        <version>${rewrite.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>flatten-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>${maven-eclipse-plugin.version}</version>
				<configuration>
					<useProjectReferences>false</useProjectReferences>
					<additionalConfig>
						<file>
							<name>.settings/org.eclipse.jdt.ui.prefs</name>
							<location>${maven.multiModuleProjectDirectory}/eclipse/org.eclipse.jdt.ui.prefs</location>
						</file>
						<file>
							<name>.settings/org.eclipse.jdt.core.prefs</name>
							<location>${maven.multiModuleProjectDirectory}/eclipse/org.eclipse.jdt.core.prefs</location>
						</file>
					</additionalConfig>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin.version}</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>io.spring.javaformat</groupId>
				<artifactId>spring-javaformat-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-netflix-dependencies</artifactId>
				<version>${project.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-commons-dependencies</artifactId>
				<version>${spring-cloud-commons.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-test-support</artifactId>
				<scope>test</scope>
				<version>${spring-cloud-commons.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-config-dependencies</artifactId>
				<version>${spring-cloud-config.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>javax.inject</groupId>
				<artifactId>javax.inject</artifactId>
				<version>1</version>
			</dependency>
			<!-- Eureka core dep that is now optional -->
			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-servlet</artifactId>
				<version>${eureka-jersey.version}</version>
			</dependency>
			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-core</artifactId>
				<version>${eureka-jersey.version}</version>
			</dependency>
			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-client</artifactId>
				<version>${eureka-jersey.version}</version>
			</dependency>
			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-server</artifactId>
				<version>${eureka-jersey.version}</version>
			</dependency>
			<dependency>
				<groupId>com.sun.jersey.contribs</groupId>
				<artifactId>jersey-apache-client4</artifactId>
				<version>${eureka-jersey.version}</version>
			</dependency>
			<!-- end eureka deps -->
		</dependencies>
	</dependencyManagement>
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
			</plugin>
		</plugins>
	</reporting>
	<modules>
		<module>spring-cloud-netflix-dependencies</module>
		<module>spring-cloud-netflix-eureka-client</module>
		<module>spring-cloud-netflix-eureka-server</module>
		<module>spring-cloud-starter-netflix-eureka-client</module>
		<module>spring-cloud-starter-netflix-eureka-server</module>
		<module>spring-cloud-netflix-eureka-client-tls-tests</module>
		<module>docs</module>
    </modules>
	<profiles>
		<profile>
			<id>spring</id>
			<repositories>
				<repository>
					<id>spring-snapshots</id>
					<name>Spring Snapshots</name>
					<url>https://repo.spring.io/libs-snapshot-local</url>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
					<releases>
						<enabled>false</enabled>
					</releases>
				</repository>
				<repository>
					<id>spring-milestones</id>
					<name>Spring Milestones</name>
					<url>https://repo.spring.io/libs-milestone-local</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
				<repository>
					<id>spring-releases</id>
					<name>Spring Releases</name>
					<url>https://repo.spring.io/release</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>spring-snapshots</id>
					<name>Spring Snapshots</name>
					<url>https://repo.spring.io/libs-snapshot-local</url>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
					<releases>
						<enabled>false</enabled>
					</releases>
				</pluginRepository>
				<pluginRepository>
					<id>spring-milestones</id>
					<name>Spring Milestones</name>
					<url>https://repo.spring.io/libs-milestone-local</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</pluginRepository>
				<pluginRepository>
					<id>spring-releases</id>
					<name>Spring Releases</name>
					<url>https://repo.spring.io/libs-release-local</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
		<profile>
			<id>sonar</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>pre-unit-test</id>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
								<configuration>
									<propertyName>surefireArgLine</propertyName>
									<destFile>${project.build.directory}/jacoco.exec</destFile>
								</configuration>
							</execution>
							<execution>
								<id>post-unit-test</id>
								<phase>test</phase>
								<goals>
									<goal>report</goal>
								</goals>
								<configuration>
									<!-- Sets the path to the file which contains the execution data. -->
									<dataFile>${project.build.directory}/jacoco.exec</dataFile>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<!-- Sets the VM argument line used when unit tests are run. -->
							<argLine>${surefireArgLine}</argLine>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>

@pway99
Copy link
Contributor Author

pway99 commented Mar 13, 2021

Try running org.openrewrite.java.testing.junit5.JUnit5BestPractices recipe.

gadams00 pushed a commit that referenced this issue Apr 15, 2021
@sambsnyd
Copy link
Member

sambsnyd commented Jun 15, 2021

This requires openrewrite/rewrite#150

@pway99
Copy link
Contributor Author

pway99 commented Oct 8, 2021

closing this since we have a TestsShouldNotBePublic recipe

@pway99 pway99 closed this as completed Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants