Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
New upstream version 1.13
· 6938b8bd
Emmanuel Bourg
authored
Jun 04, 2018
6938b8bd
New upstream version 1.14
· e69c3329
Emmanuel Bourg
authored
Jun 04, 2018
e69c3329
Show whitespace changes
Inline
Side-by-side
access-modifier-annotation/pom.xml
View file @
e69c3329
...
...
@@ -4,11 +4,11 @@
<parent>
<artifactId>
access-modifier
</artifactId>
<groupId>
org.kohsuke
</groupId>
<version>
1.1
2
</version>
<version>
1.1
4
</version>
</parent>
<artifactId>
access-modifier-annotation
</artifactId>
<name>
Custom Acess Modifier annotations
</name>
<name>
Custom Ac
c
ess Modifier annotations
</name>
<dependencies>
<dependency>
...
...
access-modifier-annotation/src/main/java/org/kohsuke/accmod/AccessRestriction.java
View file @
e69c3329
...
...
@@ -85,6 +85,13 @@ public abstract class AccessRestriction {
*/
public
abstract
void
written
(
Location
loc
,
RestrictedElement
target
,
ErrorListener
errorListener
);
/**
* Whether this access restriction, if applied to a type, should also be considered to apply implicitly to all transitively nested members.
* @return by default, false
*/
public
boolean
appliesToNested
()
{
return
false
;
}
/**
* {@link AccessRestriction} that imposes no restriction.
...
...
access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/Location.java
View file @
e69c3329
...
...
@@ -74,4 +74,10 @@ public interface Location {
* access restrictions.
*/
ClassLoader
getDependencyClassLoader
();
/**
* Loads a configuration setting from the environment, such as when configured by a Maven plugin.
*/
/*@CheckForNull*/
String
getProperty
(
String
key
);
}
access-modifier-annotation/src/main/java/org/kohsuke/accmod/restrictions/Beta.java
0 → 100644
View file @
e69c3329
/*
* The MIT License
*
* Copyright 2018 CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
org.kohsuke.accmod.restrictions
;
import
org.kohsuke.accmod.impl.ErrorListener
;
import
org.kohsuke.accmod.impl.Location
;
import
org.kohsuke.accmod.impl.RestrictedElement
;
/**
* References are only allowed within the same module, as in {@link NoExternalUse},
* or when a special flag is set in the consuming module.
* This is the property {@code useBeta} with the value {@code true}.
*/
public
class
Beta
extends
DoNotUse
{
@Override
public
void
error
(
Location
loc
,
RestrictedElement
target
,
ErrorListener
errorListener
)
{
if
(
target
.
isInTheInspectedModule
())
{
return
;
}
if
(
"true"
.
equals
(
loc
.
getProperty
(
"useBeta"
)))
{
return
;
}
errorListener
.
onError
(
null
,
loc
,
target
+
" is still in beta"
);
}
}
access-modifier-annotation/src/main/java/org/kohsuke/accmod/restrictions/DoNotUse.java
View file @
e69c3329
...
...
@@ -61,4 +61,10 @@ public class DoNotUse extends AccessRestriction {
public
void
error
(
Location
loc
,
RestrictedElement
target
,
ErrorListener
errorListener
)
{
errorListener
.
onError
(
null
,
loc
,
target
+
" must not be used"
);
}
@Override
public
boolean
appliesToNested
()
{
return
true
;
}
}
access-modifier-checker/pom.xml
View file @
e69c3329
...
...
@@ -4,7 +4,7 @@
<parent>
<artifactId>
access-modifier
</artifactId>
<groupId>
org.kohsuke
</groupId>
<version>
1.1
2
</version>
<version>
1.1
4
</version>
</parent>
<artifactId>
access-modifier-checker
</artifactId>
<packaging>
maven-plugin
</packaging>
...
...
access-modifier-checker/src/it/beta-fail/api/pom.xml
0 → 100644
View file @
e69c3329
<?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>
<parent>
<groupId>
test
</groupId>
<artifactId>
beta-fail
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
api
</artifactId>
<dependencies>
<dependency>
<groupId>
org.kohsuke
</groupId>
<artifactId>
access-modifier-annotation
</artifactId>
<version>
@project.version@
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
access-modifier-checker/src/it/beta-fail/api/src/main/java/api/Api.java
0 → 100644
View file @
e69c3329
package
api
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.Beta
;
public
class
Api
{
@Restricted
(
Beta
.
class
)
public
static
void
experimental
()
{}
static
{
experimental
();
// OK
}
}
access-modifier-checker/src/it/beta-fail/caller/pom.xml
0 → 100644
View file @
e69c3329
<?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>
<parent>
<groupId>
test
</groupId>
<artifactId>
beta-fail
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
caller
</artifactId>
<dependencies>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
api
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.kohsuke
</groupId>
<artifactId>
access-modifier-checker
</artifactId>
<version>
@project.version@
</version>
<executions>
<execution>
<goals>
<goal>
enforce
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
access-modifier-checker/src/it/beta-fail/caller/src/main/java/caller/Caller.java
0 → 100644
View file @
e69c3329
package
caller
;
import
api.Api
;
public
class
Caller
{
public
Caller
()
{
Api
.
experimental
();
// illegal
}
}
access-modifier-checker/src/it/beta-fail/invoker.properties
0 → 100644
View file @
e69c3329
invoker.goals
=
clean package
invoker.buildResult
=
failure
access-modifier-checker/src/it/beta-fail/pom.xml
0 → 100644
View file @
e69c3329
<?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>
test
</groupId>
<artifactId>
beta-fail
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<packaging>
pom
</packaging>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
</properties>
<modules>
<module>
api
</module>
<module>
caller
</module>
</modules>
</project>
\ No newline at end of file
access-modifier-checker/src/it/beta-fail/postbuild.groovy
0 → 100644
View file @
e69c3329
assert
new
File
(
basedir
,
'build.log'
).
text
.
contains
(
'[ERROR] caller/Caller:8 api/Api.experimental()V is still in beta'
)
access-modifier-checker/src/it/beta-pass/api/pom.xml
0 → 100644
View file @
e69c3329
<?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>
<parent>
<groupId>
test
</groupId>
<artifactId>
beta-pass
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
api
</artifactId>
<dependencies>
<dependency>
<groupId>
org.kohsuke
</groupId>
<artifactId>
access-modifier-annotation
</artifactId>
<version>
@project.version@
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
access-modifier-checker/src/it/beta-pass/api/src/main/java/api/Api.java
0 → 100644
View file @
e69c3329
package
api
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.Beta
;
public
class
Api
{
@Restricted
(
Beta
.
class
)
public
static
void
experimental
()
{}
static
{
experimental
();
// OK
}
}
access-modifier-checker/src/it/beta-pass/caller/pom.xml
0 → 100644
View file @
e69c3329
<?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>
<parent>
<groupId>
test
</groupId>
<artifactId>
beta-pass
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
caller
</artifactId>
<dependencies>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
api
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.kohsuke
</groupId>
<artifactId>
access-modifier-checker
</artifactId>
<version>
@project.version@
</version>
<executions>
<execution>
<goals>
<goal>
enforce
</goal>
</goals>
<configuration>
<properties>
<property>
<name>
useBeta
</name>
<value>
true
</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
access-modifier-checker/src/it/beta-pass/caller/src/main/java/caller/Caller.java
0 → 100644
View file @
e69c3329
package
caller
;
import
api.Api
;
public
class
Caller
{
public
Caller
()
{
Api
.
experimental
();
// OK
}
}
access-modifier-checker/src/it/beta-pass/invoker.properties
0 → 100644
View file @
e69c3329
invoker.goals
=
clean package
access-modifier-checker/src/it/beta-pass/pom.xml
0 → 100644
View file @
e69c3329
<?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>
test
</groupId>
<artifactId>
beta-pass
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<packaging>
pom
</packaging>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
</properties>
<modules>
<module>
api
</module>
<module>
caller
</module>
</modules>
</project>
\ No newline at end of file
access-modifier-checker/src/it/failOnError/api/pom.xml
0 → 100644
View file @
e69c3329
<?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>
<parent>
<groupId>
test
</groupId>
<artifactId>
failOnError
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
api
</artifactId>
<dependencies>
<dependency>
<groupId>
org.kohsuke
</groupId>
<artifactId>
access-modifier-annotation
</artifactId>
<version>
@project.version@
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Prev
1
2
3
Next