Date: Mon, 28 Apr 1997 17:27:51 +0000
From: Per Velschow <pervel@cybernet.dk>
To: ejberk@princeton.edu
Subject: Bug in JavaLex
Hello!
I have been using JavaLex and CUP for a while with JDK 1.0.2. But then I
tried using it with the new JDK 1.1.1 with some problems. The biggest
problems where in CUP (I will mail my problem to them), but there was
also a little problem in JavaLex.
It has to do with the new API in JDK 1.1.1. SUN has "deprecated" some
constructors and methods so that you get a warning when you try to
compile a program using them. Specifically in the generated code from
JavaLex it uses the following deprecated constructor:
String(byte[], int, int, int)
The solution I have found is very easy (if it works) just let the lexer
use the constructor String(byte[], int, int) instead. It uses the
platform's default character encoding.
You can find out more about this here
http://www.javasoft.com/products/jdk/1.1/docs/api/java.lang.String.html
I actually have made the change myself by replacing the line
m_outstream.writeBytes("\t\treturn (new java.lang.String(yy_buffer,
0, \n");
with
m_outstream.writeBytes("\t\treturn (new
java.lang.String(yy_buffer,\n");
Yours,
Per Velschow
=====================================
Per Velschow
mailto:pervel@isa.dknet.dk
http://www.isa.dknet.dk/~pervel/