No special checks. If there is no META-INF/services/net.java.html.js.classes, then assume we can run without special classloaders preprocess
authorJaroslav Tulach <jaroslav.tulach@netbeans.org>
Thu, 30 Jan 2014 16:46:14 +0100
branchpreprocess
changeset 5101db285d9d38b
parent 509 186de7f12a7c
child 511 780f66d8ed29
No special checks. If there is no META-INF/services/net.java.html.js.classes, then assume we can run without special classloaders
boot/src/main/java/org/netbeans/html/boot/impl/FnUtils.java
boot/src/main/java/org/netbeans/html/boot/impl/Test.java
     1.1 --- a/boot/src/main/java/org/netbeans/html/boot/impl/FnUtils.java	Thu Jan 30 14:59:33 2014 +0100
     1.2 +++ b/boot/src/main/java/org/netbeans/html/boot/impl/FnUtils.java	Thu Jan 30 16:46:14 2014 +0100
     1.3 @@ -116,27 +116,7 @@
     1.4          if (l.getResource("META-INF/net.java.html.js.classes") != null) {
     1.5              return false;
     1.6          }
     1.7 -        Class<?> clazz;
     1.8 -        Closeable c = Fn.activate(new TrueFn());
     1.9 -        try {
    1.10 -            try {
    1.11 -                clazz = Class.forName("org.netbeans.html.boot.impl.Test", true, l);
    1.12 -            } catch (ClassNotFoundException ex) {
    1.13 -                clazz = Test.class;
    1.14 -            }
    1.15 -            final Object is = ((Callable<?>)clazz.newInstance()).call();
    1.16 -            return Boolean.TRUE.equals(is);
    1.17 -        } catch (LinkageError ex) {
    1.18 -            return false;
    1.19 -        } catch (Exception ex) {
    1.20 -            return false;
    1.21 -        } finally {
    1.22 -            try {
    1.23 -                c.close();
    1.24 -            } catch (IOException ex) {
    1.25 -                throw new IllegalStateException(ex);
    1.26 -            }
    1.27 -        }
    1.28 +        return true;
    1.29      }
    1.30      
    1.31      public static boolean isValid(Fn fn) {
    1.32 @@ -613,24 +593,4 @@
    1.33              }
    1.34          }
    1.35      }
    1.36 -
    1.37 -    private static final class TrueFn extends Fn implements Fn.Presenter {
    1.38 -        @Override
    1.39 -        public Object invoke(Object thiz, Object... args) throws Exception {
    1.40 -            return Boolean.TRUE;
    1.41 -        }
    1.42 -
    1.43 -        @Override
    1.44 -        public Fn defineFn(String code, String... names) {
    1.45 -            return this;
    1.46 -        }
    1.47 -
    1.48 -        @Override
    1.49 -        public void displayPage(URL page, Runnable onPageLoad) {
    1.50 -        }
    1.51 -
    1.52 -        @Override
    1.53 -        public void loadScript(Reader code) throws Exception {
    1.54 -        }
    1.55 -    } // end of TrueFn
    1.56  }
     2.1 --- a/boot/src/main/java/org/netbeans/html/boot/impl/Test.java	Thu Jan 30 14:59:33 2014 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,55 +0,0 @@
     2.4 -/**
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
     2.8 - *
     2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 - * Other names may be trademarks of their respective owners.
    2.11 - *
    2.12 - * The contents of this file are subject to the terms of either the GNU
    2.13 - * General Public License Version 2 only ("GPL") or the Common
    2.14 - * Development and Distribution License("CDDL") (collectively, the
    2.15 - * "License"). You may not use this file except in compliance with the
    2.16 - * License. You can obtain a copy of the License at
    2.17 - * http://www.netbeans.org/cddl-gplv2.html
    2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 - * specific language governing permissions and limitations under the
    2.20 - * License.  When distributing the software, include this License Header
    2.21 - * Notice in each file and include the License file at
    2.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 - * particular file as subject to the "Classpath" exception as provided
    2.24 - * by Oracle in the GPL Version 2 section of the License file that
    2.25 - * accompanied this code. If applicable, add the following below the
    2.26 - * License Header, with the fields enclosed by brackets [] replaced by
    2.27 - * your own identifying information:
    2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 - *
    2.30 - * Contributor(s):
    2.31 - *
    2.32 - * The Original Software is NetBeans. The Initial Developer of the Original
    2.33 - * Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
    2.34 - *
    2.35 - * If you wish your version of this file to be governed by only the CDDL
    2.36 - * or only the GPL Version 2, indicate your decision by adding
    2.37 - * "[Contributor] elects to include this software in this distribution
    2.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.39 - * single choice of license, a recipient has the option to distribute
    2.40 - * your version of this file under either the CDDL, the GPL Version 2 or
    2.41 - * to extend the choice of license to its licensees as provided above.
    2.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.43 - * Version 2 license, then the option applies only if the new code is
    2.44 - * made subject to such option by the copyright holder.
    2.45 - */
    2.46 -package org.netbeans.html.boot.impl;
    2.47 -
    2.48 -import java.util.concurrent.Callable;
    2.49 -import net.java.html.js.JavaScriptBody;
    2.50 -
    2.51 -/**
    2.52 - *
    2.53 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.54 - */
    2.55 -public final class Test implements Callable<Boolean> {
    2.56 -    @Override @JavaScriptBody(args = {}, body = "return true;")
    2.57 -    public native Boolean call();
    2.58 -}