Skip to content

Commit

Permalink
8297794: Deprecate JMX Management Applets for Removal
Browse files Browse the repository at this point in the history
Reviewed-by: dfuchs, mullan, rriggs, alanb
  • Loading branch information
kevinjwalls committed Dec 5, 2022
1 parent 619b68c commit 17666fb
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 19 deletions.
Expand Up @@ -162,8 +162,14 @@
* <p><STRONG>Note - </STRONG> The <CODE>MLet</CODE> class loader uses the {@link javax.management.MBeanServerFactory#getClassLoaderRepository(javax.management.MBeanServer)}
* to load classes that could not be found in the loaded jar files.
*
* @deprecated This API is part of Management Applets (m-lets), which is a legacy feature that allows loading
* of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to
* removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.
*
* @since 1.5
*/
@Deprecated(since="20", forRemoval=true)
@SuppressWarnings("removal")
public class MLet extends java.net.URLClassLoader
implements MLetMBean, MBeanRegistration, Externalizable {

Expand Down
Expand Up @@ -39,11 +39,15 @@
* It can be consulted by a subclass of {@link MLet} that overrides
* the {@link MLet#check MLet.check} method.
*
* @deprecated This API is part of Management Applets (m-lets), which is a legacy feature that allows loading
* of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to
* removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.
*
* @since 1.6
*/
@Deprecated(since="20", forRemoval=true)
public class MLetContent {


/**
* A map of the attributes of the <CODE>MLET</CODE> tag
* and their values.
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -39,11 +39,15 @@
* Exposes the remote management interface of the MLet
* MBean.
*
* @deprecated This API is part of Management Applets (m-lets), which is a legacy feature that allows loading
* of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to
* removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.
*
* @since 1.5
*/
@Deprecated(since="20", forRemoval=true)
public interface MLetMBean {


/**
* Loads a text file containing MLET tags that define the MBeans
* to be added to the MBean server. The location of the text file is
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,13 +38,16 @@
*
* @since 1.5
*/
@Deprecated(since="20", forRemoval=true)
class MLetObjectInputStream extends ObjectInputStream {

@SuppressWarnings("removal")
private MLet loader;

/**
* Loader must be non-null;
*/
@SuppressWarnings("removal")
public MLetObjectInputStream(InputStream in, MLet loader)
throws IOException, StreamCorruptedException {

Expand Down
Expand Up @@ -47,6 +47,7 @@
*
* @since 1.5
*/
@Deprecated(since="20", forRemoval=true)
class MLetParser {

/*
Expand Down Expand Up @@ -153,6 +154,7 @@ public Map<String,String> scanTag(Reader in) throws IOException {
/**
* Scan an html file for {@literal <mlet>} tags.
*/
@SuppressWarnings("removal")
public List<MLetContent> parse(URL url) throws IOException {
// Warning Messages
String requiresTypeWarning = "<arg type=... value=...> tag requires type parameter.";
Expand Down Expand Up @@ -249,7 +251,7 @@ public List<MLetContent> parse(URL url) throws IOException {
/**
* Parse the document pointed by the URL urlname
*/
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
public List<MLetContent> parseURL(String urlname) throws IOException {
// Parse the document
//
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -36,9 +36,14 @@
* ClassLoaderRepository}. This is true because this class implements
* the interface {@link PrivateClassLoader}.
*
* @deprecated This API is part of Management Applets (m-lets), which is a legacy feature that allows loading
* of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to
* removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.
*
* @since 1.5
*/
@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
@Deprecated(since="20", forRemoval=true)
@SuppressWarnings({"serial", "removal"}) // Externalizable class w/o no-arg c'tor
public class PrivateMLet extends MLet implements PrivateClassLoader {
private static final long serialVersionUID = 2503458973393711979L;

Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/Introspector/ClassLeakTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -56,6 +56,7 @@ public static void main(String[] args) throws Exception {
urls[i] = Paths.get(cpaths[i]).toUri().toURL();
}

@SuppressWarnings("removal")
PrivateMLet mlet = new PrivateMLet(urls, null, false);
Class<?> shadowClass = mlet.loadClass(TestMBean.class.getName());
if (shadowClass == TestMBean.class) {
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/MBeanServer/PostExceptionTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -432,6 +432,7 @@ public ObjectName registerMLet(MBeanServer server) throws Exception {
if (server.isRegistered(name)) {
return name;
}
@SuppressWarnings("removal")
final MLet mlet = new MLet(new URL[0],
ClassLoader.getSystemClassLoader());
return server.registerMBean(mlet, name).getObjectName();
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/loading/DocumentRootTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,6 +38,7 @@
import java.util.HashMap;
import javax.management.loading.MLetContent;

@SuppressWarnings("removal")
public class DocumentRootTest {
public static int test(URL documentBase, URL codeBase) {
int error = 0;
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/loading/GetMBeansFromURLTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -40,6 +40,7 @@
import javax.management.ServiceNotFoundException;
import javax.management.loading.MLet;

@SuppressWarnings("removal")
public class GetMBeansFromURLTest {

public static void main(String[] args) throws Exception {
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/loading/MLetCLR/MLetCommand.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -39,6 +39,7 @@
import javax.management.ObjectName;
import java.io.File;

@SuppressWarnings("removal")
public class MLetCommand {

public static void main(String[] args) throws Exception {
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/loading/MLetContentTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,6 +37,7 @@

import javax.management.loading.*;

@SuppressWarnings("removal")
public class MLetContentTest {
public static void main(String[] args) throws Exception {
System.out.println(">>> General test for the public class MLetContent.");
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/javax/management/loading/MLetInternalsTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -39,6 +39,7 @@
* @modules java.management/javax.management.loading:open
* @run testng MLetInternalsTest
*/
@SuppressWarnings("removal")
public class MLetInternalsTest {
private final static String CONSTRUCT_PARAMETER = "constructParameter";

Expand Down
Expand Up @@ -39,6 +39,7 @@
import javax.management.ObjectName;
import javax.management.loading.MLet;

@SuppressWarnings("removal")
public class MletParserLocaleTest {

public static void main(String[] args) throws Exception {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -45,6 +45,7 @@
import javax.management.ServiceNotFoundException;
import javax.management.loading.MLet;

@SuppressWarnings("removal")
public class ParserInfiniteLoopTest {

public static void main(String[] args) throws Exception {
Expand Down
4 changes: 3 additions & 1 deletion test/jdk/javax/management/mxbean/MXBeanLoadingTest1.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -81,6 +81,7 @@ public void run(Map<String, Object> args) {
+ ".class", "");

URL[] urls = new URL[]{new URL(clsLoadPath)};
@SuppressWarnings("removal")
PrivateMLet mlet = new PrivateMLet(urls, null, false);
Class<?> shadowClass = mlet.loadClass(TestMXBean.class.getName());

Expand Down Expand Up @@ -266,6 +267,7 @@ public void run(Map<String, Object> args) {
mbs.unregisterMBean(testName);
mbs.unregisterMBean(mletName);

@SuppressWarnings("removal")
WeakReference<PrivateMLet> mletRef =
new WeakReference<PrivateMLet>(mlet);
mlet = null;
Expand Down
4 changes: 3 additions & 1 deletion test/jdk/javax/management/relation/NonArrayListTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,6 +38,8 @@
import javax.management.loading.MLet;

public class NonArrayListTest {

@SuppressWarnings("removal") // use of MLet
public static void main(String[] args) throws Exception {
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
RelationService rs = new RelationService(true);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -101,6 +101,7 @@ public static void main(String[] args) throws Exception {

URLClassLoader jrcl = (URLClassLoader) jmxRemoteClassLoader;
URL[] urls = jrcl.getURLs();
@SuppressWarnings("removal")
PrivateMLet mlet = new PrivateMLet(urls, null, false);
Class shadowClass = mlet.loadClass(JMXServiceURL.class.getName());
if (shadowClass == JMXServiceURL.class) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -80,6 +80,7 @@ public static void main(String[] args) {
}
}

@SuppressWarnings("removal") // use of MLet
private static boolean test() throws Exception {
MBeanServer mbs = MBeanServerFactory.createMBeanServer();

Expand Down

1 comment on commit 17666fb

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.