Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5840929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:49:14+00:00 2026-05-22T11:49:14+00:00

this is my first posted question. I have a fairly complicated OQL query which

  • 0

this is my first posted question. I have a fairly complicated OQL query which lists static fields of classes loaded in our packages. One problem I’m seeing with running the query against ‘jhat’ of Java 1.6.0_24 is that the ‘unique’ function doesn’t work as expected. I expect

select unique(['a', 'b', 'c', 'a'])

to return [‘a’, ‘b’, ‘c’] but instead it returns [‘a’], wtf?

If anyone’s interested the actual full query is (replace ‘com.mydomain’ with what you like):

select cl.name + ' -- ' + unique(map(filter(referees(cl), "classof(it).name != 'java.lang.Class' && classof(it).name != 'java.lang.String' && classof(it).name != 'sun.misc.Launcher$AppClassLoader' && classof(it).name != 'java.security.ProtectionDomain' && classof(it).name != '[Ljava.security.cert.Certificate;' && classof(it).name != 'sun.plugin2.applet.JNLP2ClassLoader'"), "classof(it).name")).join(', ')
from instanceof java.lang.Class cl
where /com.mydomain./(cl.name) && ! /com.mydomain.xs.protobuf./(cl.name)
&& length(filter(referees(cl), "classof(it).name != 'java.lang.Class' && classof(it).name != 'java.lang.String' && classof(it).name != 'sun.misc.Launcher$AppClassLoader' && classof(it).name != 'java.security.ProtectionDomain'")) > 0;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:49:15+00:00Added an answer on May 22, 2026 at 11:49 am

    By default, unique uniquifies on the object’s objectid, which is suitable for actual traced objects, but for strings it returns null. Thus, only the last string is kept (since all the strings have non-unique objectid values).

    You have two options:

    1. Uniquify on the traced objects, rather than their names:

      map(unique(filter(map(referees(cl), classof), "it.name != ...")), "it.name")
      
    2. Specify the “function” to uniquify with, so that it works for strings:

      unique(['a', 'b', 'c', 'a'], 'it')
      

      This will cause the strings themselves to be uniquified.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I posted this basic question before, but didn't get an answer I could work
This is my first post and I have the feeling that this is something
I have a mysql database which I support using phpMyAdmin. The website this is
I previously posted here: Controlling Access for Trial Subscription Since this is a new
Quick question, hopefully I am just missing something simple. Ok I have one class
This is one of the weirder things I've seen. I'm teaching an intro C++
I have a framework that I am building and is being compiled into a
I have a long-running console-based application Sender that sends simple text to STDOUT using
I am using Visual Studio 2010 Pro for simple C programming, I would like
I think the following is really basic but I don't really get what would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.