Skip to content

Commit e707c46

Browse files
author
Nicolai Parlog
committed
Create static, non-constant member of non-static inner class
1 parent e671d63 commit e707c46

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Check out the [jpms](http://blog.codefx.org/tag/jpms/) tag on my blog, [this dem
7474

7575
*[sealed classes](src/main/java/org/codefx/demo/java17/lang/sealed) (articles [1](https://www.infoq.com/articles/java-sealed-classes/), [2](https://nipafx.dev/java-visitor-pattern-pointless/), [JEP 409](https://openjdk.java.net/jeps/409))
7676
*[`instanceof` pattern matching](src/main/java/org/codefx/demo/java16/lang/instanceof_) (articles [1](https://nipafx.dev/java-pattern-matching/), [2](https://nipafx.dev/java-type-pattern-matching/), [JEP 394](https://openjdk.java.net/jeps/394))
77+
*[static members of (non-static) inner classes](src/main/java/org/codefx/demo/java16/lang/staticinner) ([JDK-8254105](https://bugs.openjdk.java.net/browse/JDK-8254105))
7778
*[text blocks](src/main/java/org/codefx/demo/java15/lang/text_blocks/TextBlocks.java) ([article](https://blog.codefx.org/java/text-blocks), [JEP 378](https://openjdk.java.net/jeps/378))
7879
*[switch expressions](src/main/java/org/codefx/demo/java14/lang/switch_/Switch.java) ([article](https://blog.codefx.org/java/switch-expressions/), [video](https://www.youtube.com/watch?v=1znHEf3oSNI), [JEP 361](https://openjdk.java.net/jeps/361))
7980
*[local-variable type inference with `var`](src/main/java/org/codefx/demo/java10/lang/var/VariableTypeInference.java) ([article](http://blog.codefx.org/java/java-10-var-type-inference/), [video](https://www.youtube.com/watch?v=Le1DbpRZdRQ), [JEP 286](http://openjdk.java.net/jeps/286))
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.codefx.demo.java16.lang.staticinner;
2+
3+
import java.time.LocalDateTime;
4+
5+
public class OuterClass {
6+
7+
// TODO
8+
9+
public static void main(String[] args) {
10+
System.out.println("foo");
11+
}
12+
13+
public class InnerClass {
14+
15+
static final String DATE = LocalDateTime.now().toString();
16+
17+
static String date() {
18+
return DATE;
19+
}
20+
21+
record InnerRecord(String component) { }
22+
23+
}
24+
25+
}

0 commit comments

Comments
 (0)