forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- turn the warning in the docs into a subsection - mention the inheritance rules in the javadoc of the Scheduled annotation - fail the build if an abstract class/interface declares a method annotated with Scheduled - add support for static interface scheduled methods (so far only static methods declared on a class were supported) - fixes quarkusio#38781
- Loading branch information
Showing
6 changed files
with
159 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ployment/src/test/java/io/quarkus/scheduler/test/NonStaticScheduledAbstractClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.quarkus.scheduler.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.scheduler.Scheduled; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class NonStaticScheduledAbstractClassTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setExpectedException(IllegalStateException.class) | ||
.withApplicationRoot(root -> root | ||
.addClasses(AbstractClassWitchScheduledMethod.class)); | ||
|
||
@Test | ||
public void test() { | ||
fail(); | ||
} | ||
|
||
static abstract class AbstractClassWitchScheduledMethod { | ||
|
||
@Scheduled(every = "1s") | ||
void everySecond() { | ||
} | ||
|
||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...r/deployment/src/test/java/io/quarkus/scheduler/test/NonStaticScheduledInterfaceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.scheduler.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.scheduler.Scheduled; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class NonStaticScheduledInterfaceTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setExpectedException(IllegalStateException.class) | ||
.withApplicationRoot(root -> root | ||
.addClasses(InterfaceWitchScheduledMethod.class)); | ||
|
||
@Test | ||
public void test() { | ||
fail(); | ||
} | ||
|
||
interface InterfaceWitchScheduledMethod { | ||
|
||
@Scheduled(every = "1s") | ||
void everySecond(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters