-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TAP5-2786: don't override final method in subclass
when in multiple classloader mode
- Loading branch information
Showing
9 changed files
with
183 additions
and
3 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
35 changes: 35 additions & 0 deletions
35
plastic/src/main/java/org/apache/tapestry5/plastic/MethodAlreadyExistsException.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,35 @@ | ||
// Copyright 2024 The Apache Software Foundation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.apache.tapestry5.plastic; | ||
|
||
/** | ||
* Exception raised when there's an attempt to create a method which | ||
* already exists in a class. | ||
* | ||
* This extends {@linkplain IllegalArgumentException} for backward compatibility. | ||
* | ||
* @since 5.9.0 | ||
*/ | ||
public class MethodAlreadyExistsException extends IllegalArgumentException | ||
{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public MethodAlreadyExistsException(String message) | ||
{ | ||
super(message); | ||
} | ||
|
||
} |
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
36 changes: 36 additions & 0 deletions
36
.../java/org/apache/tapestry5/integration/app1/components/SubclassWithFinalCachedMethod.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,36 @@ | ||
// Copyright 2024 The Apache Software Foundation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.apache.tapestry5.integration.app1.components; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.apache.tapestry5.annotations.Property; | ||
|
||
public class SubclassWithFinalCachedMethod extends SuperclassWithFinalCachedMethod | ||
{ | ||
|
||
@Property | ||
private int clientId = 2; | ||
|
||
private int counter = 10; | ||
|
||
@Override | ||
protected List<?> createList() | ||
{ | ||
return Arrays.asList("subclass", String.valueOf(counter++)); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...ava/org/apache/tapestry5/integration/app1/components/SuperclassWithFinalCachedMethod.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,47 @@ | ||
// Copyright 2024 The Apache Software Foundation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.apache.tapestry5.integration.app1.components; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.apache.tapestry5.annotations.Cached; | ||
import org.apache.tapestry5.annotations.Property; | ||
|
||
public class SuperclassWithFinalCachedMethod | ||
{ | ||
|
||
@Property | ||
private int clientId = 1; | ||
|
||
private int counter = 0; | ||
|
||
@Cached(watch = "clientId") | ||
protected final List<?> getList() | ||
{ | ||
return createList(); | ||
} | ||
|
||
protected List<?> createList() | ||
{ | ||
return Arrays.asList("superclass", String.valueOf(counter++)); | ||
} | ||
|
||
public final List<?> getListPublic() | ||
{ | ||
return getList(); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...t/java/org/apache/tapestry5/integration/app1/pages/SubclassWithFinalCachedMethodDemo.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,19 @@ | ||
// Copyright 2024 The Apache Software Foundation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.apache.tapestry5.integration.app1.pages; | ||
|
||
public class SubclassWithFinalCachedMethodDemo | ||
{ | ||
} |
12 changes: 12 additions & 0 deletions
12
...rces/org/apache/tapestry5/integration/app1/components/SuperclassWithFinalCachedMethod.tml
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,12 @@ | ||
<t:container | ||
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> | ||
<p> | ||
Client id: ${clientId}. | ||
</p> | ||
<p> | ||
List: ${listPublic}. | ||
</p> | ||
<p> | ||
List: ${listPublic}. | ||
</p> | ||
</t:container> |
10 changes: 10 additions & 0 deletions
10
...sources/org/apache/tapestry5/integration/app1/pages/SubclassWithFinalCachedMethodDemo.tml
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,10 @@ | ||
<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"> | ||
<h1>Trigger Demo</h1> | ||
|
||
<h3>Superclass:</h3> | ||
<t:superclassWithFinalCachedMethod/> | ||
|
||
<h3>Subclass:</h3> | ||
<t:subclassWithFinalCachedMethod/> | ||
|
||
</html> |