src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java
changeset 50898 12133a6e2613
parent 47216 71c04702a3d5
child 51713 d424675a9743
equal deleted inserted replaced
50897:a4d7eaf58623 50898:12133a6e2613
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    68     protected Names names;
    68     protected Names names;
    69 
    69 
    70     /** A character buffer for saved chars.
    70     /** A character buffer for saved chars.
    71      */
    71      */
    72     protected char[] sbuf = new char[128];
    72     protected char[] sbuf = new char[128];
       
    73     protected int realLength;
    73     protected int sp;
    74     protected int sp;
    74 
    75 
    75     /**
    76     /**
    76      * Create a scanner from the input array.  This method might
    77      * Create a scanner from the input array.  This method might
    77      * modify the array.  To avoid copying the input array, ensure
    78      * modify the array.  To avoid copying the input array, ensure
    87     }
    88     }
    88 
    89 
    89     protected UnicodeReader(ScannerFactory sf, char[] input, int inputLength) {
    90     protected UnicodeReader(ScannerFactory sf, char[] input, int inputLength) {
    90         log = sf.log;
    91         log = sf.log;
    91         names = sf.names;
    92         names = sf.names;
       
    93         realLength = inputLength;
    92         if (inputLength == input.length) {
    94         if (inputLength == input.length) {
    93             if (input.length > 0 && Character.isWhitespace(input[input.length - 1])) {
    95             if (input.length > 0 && Character.isWhitespace(input[input.length - 1])) {
    94                 inputLength--;
    96                 inputLength--;
    95             } else {
    97             } else {
    96                 input = Arrays.copyOf(input, inputLength + 1);
    98                 input = Arrays.copyOf(input, inputLength + 1);