@@ -49,7 +49,7 @@ object JavaTagDocumenter {
49
49
50
50
topDocMat.find()
51
51
52
- val bodyPat = Pattern .compile(""" (?sm)(.*? @interface """ + className +
52
+ val bodyPat = Pattern .compile(""" (?sm)(.*? @? interface """ + className +
53
53
""" ) *(\{.*\})""" )
54
54
val bodyMat = bodyPat.matcher(topDocMat.group(2 ))
55
55
@@ -137,10 +137,14 @@ object JavaTagDocumenter {
137
137
fileContents.contains(
138
138
" Note: This is actually an annotation defined in Java" )
139
139
140
+ def isMarkerAssertion (fileContents : String ): Boolean =
141
+ fileContents.contains(
142
+ " Marker trait for ScalaTest-compatible assertion types" )
143
+
140
144
for {
141
145
srcFile <- javaSources
142
146
val contents = Source .fromFile(srcFile).mkString
143
- if isAnnotation(contents)
147
+ if isAnnotation(contents) || isMarkerAssertion(contents)
144
148
} yield {
145
149
val filename = srcFile.getName
146
150
val className = filename.replaceFirst(""" \.java$""" , " " )
@@ -155,11 +159,14 @@ object JavaTagDocumenter {
155
159
val newTop = genNewTop(top)
156
160
val newBody = genNewBody(body)
157
161
val newContents =
158
- newTop
159
- .replaceFirst(className + " $" ,
160
- " trait " + className +
161
- " extends java.lang.annotation.Annotation " + newBody +
162
- " \n " )
162
+ if (isMarkerAssertion(contents))
163
+ newTop.replaceAllLiterally(" public interface " , " trait " )
164
+ else
165
+ newTop
166
+ .replaceFirst(className + " $" ,
167
+ " trait " + className +
168
+ " extends java.lang.annotation.Annotation " + newBody +
169
+ " \n " )
163
170
164
171
if (! destFile.exists || (srcFile.lastModified > destFile.lastModified)) {
165
172
createDirectory(file(destFile.getParent))
0 commit comments