question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Annotations like @SetSystemProperty are not inherited

See original GitHub issue

The following test fails:

@SetSystemProperty(key = "set prop A", value = "new A")
class SuperClass { }

@Nested
class TestClass extends SuperClass {

	@Test
	void shouldSetSystemPropertyToValue() {
		assertThat(System.getProperty("set prop A")).isEqualTo("new A");
	}

}

Unless I’m missing something, it stands to reason that it should pass because it should inherit the annotation from the super class. Am I missing something?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Michael1993commented, Mar 9, 2021

This should be a very simple fix, no? Just add the missing @Inherited annotation on our annotations. Or am I missing something?

1reaction
Michael1993commented, Mar 9, 2021

Part of the solution for this should include tests that verify the new behaviour.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inherited annotation is not being inherited - Stack Overflow
After adding the annotation @DocAnnotation("Super Annotation") to SubClass (that's the same one as in SuperClass ) it actually shows up twice, ...
Read more >
Clearing or Setting System Properties - JUnit Pioneer
Both annotations work on the test method and class level, are repeatable, combinable, and inherited from higher-level containers. After the annotated method has ......
Read more >
Inherited Annotations in Java - GeeksforGeeks
@inherited is a type of meta-annotation used to annotate custom annotations so that the subclass can inherit those custom annotations.
Read more >
picocli - a mighty tiny command line interface
When running on Java 6 or higher, the user input is not echoed to the console. After the user enters a password value...
Read more >
JUnit 5 User Guide
Such annotations are not inherited. @Tag. Used to declare tags for filtering tests, either at the class or method level; analogous to test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found